# Secure MARG Sensor-Based Attitude Estimation on SO(3) Under Randomly Occurring False Data Injection Attacks

Ghadeer Shaaban, Hassen Fourati, Alain Kibangou, Christophe Prieur

► To cite this version:

Ghadeer Shaaban, Hassen Fourati, Alain Kibangou, Christophe Prieur. Secure MARG Sensor-Based Attitude Estimation on SO(3) Under Randomly Occurring False Data Injection Attacks. ECC 2025 - 23rd European Control Conference, Jun 2025, Thessaloniki, Greece. pp.1-6. hal-05030049

HAL Id: hal-05030049

https://hal.science/hal-05030049v1

Submitted on 10 Apr 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Secure MARG Sensor-Based Attitude Estimation on SO(3) Under Randomly Occurring False Data Injection Attacks

Ghadeer Shaaban, Hassen Fourati, Alain Kibangou, and Christophe Prieur

**Abstract**— In many applications, attitude estimation algorithms rely on Magnetic field, Angular Rate, and Gravity measurements from a triad of sensors known as MARG sensors. Attitude estimation of rigid bodies is crucial for navigation systems which can be vulnerable to cyber-attacks. Several works in the literature focus on secure state estimation against randomly occurring false data injection (FDI) attacks on output measurements for both linear and nonlinear systems. However, no studies address this problem when the state belongs to the special orthogonal group SO(3), which provides a structured mathematical framework for attitude representation. Given the importance of SO(3) for attitude estimation, this paper proposes a secure MARG sensor-based attitude estimation on SO(3), subject to randomly occurring FDI attacks. A novel Kalman gain of the invariant extended Kalman filter (IEKF), which is typically used for attitude estimation under noisy measurements, is designed. The objective of the proposed design is to minimize the upper bound of the estimation error covariance matrix. The proposed algorithm is validated through Monte Carlo simulations.

***Index Terms***— Secure attitude estimation, SO(3), cyber-attacks, MARG sensors, invariant extended Kalman filter.

## I. INTRODUCTION

Attitude estimation of rigid bodies is crucial for navigation in several applications such as drones, robotics, and aerospace systems. Attitude estimation can be achieved using Earth's magnetic field and gravity measurements from a magnetometer and an accelerometer, respectively, in the absence of magnetic disturbances and external acceleration, and by solving the Wahba's problem [28]. Some of these algorithms are FQA [31], TRIAD and QUEST [26]. In many applications, attitude estimation relies on measurements from a triad of sensors called MARG (Magnetic field, Angular Rate, and Gravity) sensors. The angular rate (angular velocity) is measured by a gyroscope. Many MARG sensor-based attitude estimation algorithms exist in the literature. In the extended Kalman filter (EKF), the quaternion is used for attitude representation [23], [27], which is popular in the literature because it is an easy-to-implement method, however, normalization of the quaternion is required at each time step, which can further affect the quality of estimation. An improved algorithm is the invariant extended Kalman filter (IEKF) [2], where the attitude is expressed using the special orthogonal group SO(3). Significant attention is given

to estimation and filtering for systems on SO(3), some recent works are [3], [5], [24], [25].

With the rapid development of technologies and the integration of cyber and physical components in navigation systems, such as Unmanned Aerial Vehicles (UAVs) and Autonomous Vehicles (AVs), these systems have become perfect examples of Cyber-Physical Systems (CPS) which are vulnerable to cyber-physical threats. Several works, including [22], have highlighted the security vulnerabilities of UAVs, and [20] explores similar issues in autonomous vehicles. Real-world attacks on UAVs have also been reported in [13]. These growing concerns highlight the need for secure state estimation, particularly in attitude estimation, to ensure the resilience and safety of modern navigation applications.

CPS security research primarily addresses the defense strategies against three major types of cyber-attacks: denial of service (DoS) attacks, replay attacks, and false data injection (FDI) attacks. In a FDI attack, the attacker injects false signals into the system's input/output signals. Mitigating these threats involves three primary strategies: prevention, detection, and resilience [7], [8]. Prevention aims to reduce the possibility of being under attack risk, for example, it can be done by encrypting communication channels and implementing firewalls [10]. Detection involves determining whether an attack has occurred, typically using statistical tests on input/output signals. Resilience is the ability to resist and recover from an attack, performing secure control and state estimation. Resilience for secure state estimation against FDI attacks has received significant attention in the literature. For example, assuming certain conditions on observability and an upper bound on the number of compromised sensors, the secure state algorithms in [29], [30] rely on majority voting among sensors using a bank of observers, while the algorithms in [11] perform secure state estimation by solving optimization problems aimed at minimizing the sum of residuals from each sensor.

The design of secure state estimation against randomly occurring FDI attacks, where the occurrence of the attack follows a Bernoulli distribution, has been studied in various works [1], [9], [19], [32]. The Bernoulli distribution is used to describe the occurrence of FDI attacks because, at each time step, the attack may or may not succeed, depending on whether the protection mechanisms effectively block the attack or not. The Bernoulli distribution is characterized by the probability of occurrence, which represents the attack's success rate. This makes it an effective model for capturing the random nature of the attack's occurrence over time. Secure state estimation against randomly occurring

<footnote>Ghadeer Shaaban, Hassen Fourati, Alain Kibangou, and Christophe Prieur are with Univ. Grenoble Alpes, CNRS, Inria, Grenoble-INP, GIPSA-lab, Grenoble, France. Alain Kibangou is also with the Faculty of Science, University of Johannesburg (Auckland Park Campus), Johannesburg 2006, South Africa. (e-mails: ghadeer.shaaban@gipsa-lab.fr; hassen.fourati@gipsa-lab.fr; alain.kibangou@gipsa-lab.fr; christophe.prieur@gipsa-lab.fr)</footnote>
FDI attacks on the output with occurrence represented by Bernoulli distribution is done for linear systems in [16] by modifying the Kalman gain in the Kalman filter taking into account the attack on the output. The gain design in the secure Kalman filter aims to minimize the upper bound of the estimation error covariance matrix. Based on the same principle, several works extended to nonlinear systems, e.g. secure extended Kalman filter (EKF) [17], [19], secure uncented Kalman filter (UKF) [18], and secure High-degree cubature Kalman filter [32]. All the cited works on secure estimation under randomly occurring FDI attacks assume that the false injected signal to the output is bounded, which is a realistic assumption, as attackers generally aim to remain undetectable; thus, larger false injected signals are more likely to be detected. Limited research has focused on securing attitude estimation against FDI attacks. In [14], a secure attitude estimation method for AVs systems is proposed, which involves preprocessing the compromised measurements prior to their use in attitude estimation. To the best of the authors' knowledge, no research has yet explored secure attitude estimation on SO(3) against FDI attacks.

The main contribution of this paper is the design of secure MARG sensor-based attitude estimation on SO(3), specifically in scenarios where accelerometer and magnetometer measurements are under randomly occurring FDI attacks. The proposed algorithm proposes a novel Kalman gain design within the IEKF framework, thus we call it secure-IEKF. This algorithm provides an estimation along with an upper bound for the estimation error covariance matrix, and this upper bound is locally minimal among filters with the same form of IEKF.

In practical scenarios, an attacker may compromise the communication channels transmitting the accelerometer and magnetometer measurements [15]. Additionally, electromagnetic interference (EMI) attacks can introduce malicious electromagnetic signals to alter sensor outputs [6]. Moreover, random sensor failures can be interpreted as randomly occurring false data injection (FDI) attacks.

The remainder of this paper is structured as follows: Section II gives a mathematical background. Section III provides the problem statement. Section IV introduces the algorithms' steps. Section V provides a comprehensive derivation of the algorithm and a discussion of the its parameters. Section VI shows simulation to validate the proposed algorithm, and a comparison with IEKF using Monte Carlo simulations. The paper ends with a conclusion in Section VII.

## II. BACKGROUND AND PRELIMINARIES

In this paper, matrices are denoted by bold uppercase symbols, vectors by bold lowercase symbols, and scalars by lowercase symbols. The expected value operation and matrix trace operation are denoted by $E(.)$ and $tr(.)$ respectively. The matrices $\mathbf{I}$ and $\mathbf{0}$ represent the identity matrix and the all-zero matrix, respectively, with compatible dimensions.

The attitude, which is the rotation between two frames, fixed and moving frames, can be represented mathematically by a 3 × 3 rotation matrix, that belongs to the special

orthogonal group [5], [21]:

$$SO(3) = \{ \mathbf{R} \in \mathbb{R}^{3 \times 3} : \mathbf{R}\mathbf{R}^{\mathrm{T}} = \mathbf{I}_3, \det(\mathbf{R}) = 1 \}.$$

A vector $\xi \in \mathbb{R}^3$ is mapped to an element $\mathbf{R} \in SO(3)$ via the exponential map $\exp_m : \mathbb{R}^3 \to SO(3)$, expressed by the following formula [5]:

$$\exp_m(\mathbf{0}) = \mathbf{I},$$

$$\text{and } \forall \xi \in \mathbb{R}^3 \setminus \{\mathbf{0}\},$$

$$\exp_m(\xi) = \mathbf{I} + \frac{\sin(\|\xi\|)}{\|\xi\|}(\xi)_\times + 2 \frac{\sin(\|\xi\|/2)^2}{\|\xi\|^2}(\xi)_\times^2,$$

where $(\xi)_\times$ is the skew-symmetric matrix corresponding to the vector $\xi \in \mathbb{R}^3$, defined by:

$$\begin{pmatrix} \xi \\ \xi_2 \\ \xi_3 \end{pmatrix}_\times = \begin{pmatrix} 0 & -\xi_3 & \xi_2 \\ \xi_3 & 0 & -\xi_1 \\ -\xi_2 & \xi_1 & 0 \end{pmatrix}. \quad (1)$$

The paper utilizes the following key properties of the exponential map and the skew-symmetric matrix. Let $\xi_1, \xi_2, \mathbf{v}_1, \mathbf{v}_2 \in \mathbb{R}^3$, with $\mathbf{v}_1$ and $\mathbf{v}_2$ being sufficiently small. We have:

$$\exp_m(\xi)^{-1} = \exp_m(-\xi), \quad (2)$$

$$\exp_m(\mathbf{v}_1) \approx \mathbf{I} + (\mathbf{v}_1)_\times, \quad (3)$$

$$\exp_m(\mathbf{v}_1 + \mathbf{v}_2) \approx \exp_m(\mathbf{v}_1) \exp_m(\mathbf{v}_2), \quad (4)$$

$$(\xi_1)_\times \xi_2 = -(\xi_2)_\times \xi_1. \quad (5)$$

The estimation error on SO(3) is given by $\hat{\mathbf{R}}^{-1}\mathbf{R} \in SO(3)$ [5], where $\mathbf{R} \in SO(3)$ represents the true rotation matrix and $\hat{\mathbf{R}} \in SO(3)$ is its estimate. This error can be mapped to a vector $\xi \in \mathbb{R}^3$ through the inverse of the exponential map, and thus estimation error covariance matrix can be defined as $\mathbf{P} = E(\xi\xi^T)$.

The following lemma will be utilized in this paper.

**Lemma 1 ([19]):** For any dimension-compatible matrices $\mathbf{D}, \mathbf{E}$, and a scalar $\varepsilon > 0$, the following inequality holds:

$$\mathbf{D}\mathbf{E} + \mathbf{E}^{\mathrm{T}}\mathbf{D}^{\mathrm{T}} \le \varepsilon\mathbf{D}\mathbf{D}^{\mathrm{T}} + \varepsilon^{-1}\mathbf{E}\mathbf{E}^{\mathrm{T}}$$

## III. PROBLEM FORMULATION

We consider the following discrete-time attitude dynamic [5]:

$$\mathbf{R}_{k+1} = \mathbf{R}_k \exp(\omega_k + \mathbf{w}_k), \quad (6)$$

where, for each time $k$, the attitude is denoted by $\mathbf{R}_k$, and it belongs to SO(3). The input is $\omega_k = \Delta T \omega_k^{\mathrm{true}}$, where $\omega_k^{\mathrm{true}}$ is the measured angular velocity, and $\Delta T$ is the sampling time. The process noise $\mathbf{w}_k$ is assumed to be a zero-mean white random signal with positive definite covariance matrix $\mathbf{Q}_k$. The accelerometer and magnetometer measure the body acceleration and the magnetic field written in the body frame and denoted by $\mathbf{a}_k^b$ and $\mathbf{b}_k^b$, respectively. In the absence of external acceleration, magnetic disturbance, and cyber-physical attack, these two measurements are as follows:

$$\begin{pmatrix} \mathbf{a}_k^b \\ \mathbf{b}_k^b \end{pmatrix} = \mathbf{h}(\mathbf{R}_k) + \mathbf{v}_k, \quad (7)$$
and the function h is defined as $h(\mathbf{R}_k) = \begin{pmatrix} \mathbf{R}_k^{-1}\mathbf{g} \\ \mathbf{R}_k^{-1}\mathbf{m}_e \end{pmatrix}$, where g, m_e ∈ ℝ³ are the Earth's gravity and magnetic field written in the Earth's fixed frame, respectively. The measurement noise v_k is assumed to be a zero-mean white random signal with positive definite covariance matrices R_k.

Under randomly occurring FDI attacks on the accelerometer and magnetometer measurements, the output model is described as follows:

$$y_k = \begin{pmatrix} \mathbf{a}_k^b \\ \mathbf{b}_k^b \end{pmatrix} + \gamma_k \delta_k, \quad (8)$$

where $\delta_k \in ℝ^6$ is the false injected signal, which is unknown, and it is assumed to be bounded, and more precisely there exists a known matrix $\bar{\Delta}$ i.e.

$$\delta_k \delta_k^T \le \bar{\Delta}. \quad (9)$$

The random variable $\gamma_k$ is independent Bernoulli distributed white sequences taking values in {0, 1} with probabilities $P(\gamma_k = 1) = \bar{\gamma}$ and $P(\gamma_k = 0) = 1 - \bar{\gamma}$, where $\bar{\gamma} \in [0, 1]$, and it is assumed to be known. At time step k, $\gamma = 1$ indicates an attack occurs on the measurements, while $\gamma = 0$ means the measurements are safe. The random variables $\mathbf{w}_k$, $\mathbf{v}_k$ and $\gamma_k$ are assumed to be uncorrelated.

The objective of this paper is to design a secure filter that estimates the attitude $\mathbf{R}_k$ in the presence of the false injected signal $(\gamma_k \delta_i)_{i \le k}$, based on the inputs $(\omega_k)_{i \le k}$, and the outputs $(\mathbf{y}_k)_{i \le k}$. For this purpose, a novel recursive algorithm is designed, which gives an estimate of $\mathbf{R}_k$ with the upper bound of its covariance matrix $\mathbf{\Pi}_k$, based on the estimate of $\mathbf{R}_{k-1}$ with an upper bound of its covariance matrix $\mathbf{\Pi}_{k-1}$, the input $\omega_{k-1}$, and the output $\mathbf{y}_k$.

## IV. MAIN RESULTS: SECURE FILTER DESIGN

For systems under FDI attacks on the output, with randomly occurring presented by Bernoulli distribution, the works in [16], [17], [19] design secure state estimation algorithms based on modifying the Kalman gain in KF (for linear systems), and EKF and UKF (for nonlinear systems), respectively. The modified Kalman gain is designed to minimize the upper bound of the state estimation covariance matrix.

Based on the same principle, we propose secure-IEKF that gives an estimate of the attitude on SO(3) in the presence of a false injected signal to the output, based on modifying the Kalman gain in the IEKF, to minimize the upper bound of the attitude estimation covariance matrix. Secure-IEKF consists of two steps, as in IEKF, prediction and correction. The prediction follows the dynamic model with noise set to zero. The correction is applied using the exponential map of the Kalman gain multiplied by the difference between the output and the predicted output. The two steps are as follows:

$$\hat{\mathbf{R}}_{k|k-1} = \hat{\mathbf{R}}_{k-1} \exp_m(\omega_{k-1}), \quad (10)$$

$$\hat{\mathbf{R}}_k = \hat{\mathbf{R}}_{k|k-1} \exp_m \left( \mathbf{K}_k \left( \mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1}) \right) \right), \quad (11)$$

where $\mathbf{K}_k$ is the Kalman gain that is designed to minimize the upper bound of the estimation error covariance matrix,

taking into account the randomly occurring FDI attacks on the output. For easy reference and comparison, Algorithm 1 is the IEKF algorithm adapted for attitude estimation using MARG sensors [2], [5].

### Algorithm 1 IEKF

**Inputs:** $\hat{\mathbf{R}}_{k-1}$, $\mathbf{\Pi}_{k-1}$, $\omega_{k-1}$, $\mathbf{y}_k$

▷ Prediction:

1: $\hat{\mathbf{R}}_{k|k-1} = \hat{\mathbf{R}}_{k-1} \exp_m(\omega_{k-1})$

2: $\mathbf{\Pi}_{k|k-1} = \mathbf{\Pi}_{k-1} + \mathbf{Q}_{k-1}$

▷ Correction:

3: $\mathbf{H}_k = \begin{pmatrix} (\hat{\mathbf{R}}_{k|k-1}^{-1}\mathbf{g}) \times \\ (\hat{\mathbf{R}}_{k|k-1}^{-1}\mathbf{m}_e) \times \end{pmatrix}$

4: $\mathbf{S}_k = \mathbf{H}_k \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T + \mathbf{R}_k$

5: $\mathbf{K}_k = \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T \mathbf{S}_k^{-1}$

6: $\hat{\mathbf{R}}_k = \hat{\mathbf{R}}_{k|k-1} \exp_m \left( \mathbf{K}_k \left( \mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1}) \right) \right)$

7: $\mathbf{\Pi}_k = (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbf{\Pi}_{k|k-1}$

8: return $\hat{\mathbf{R}}_k$, $\mathbf{\Pi}_k$

Algorithm 2 presents the detailed steps of the proposed recursive secure-IEKF. The inputs of this recursive filter are

### Algorithm 2 Secure-IEKF

**Inputs:** $\hat{\mathbf{R}}_{k-1}$, $\mathbf{\Pi}_{k-1}$, $\omega_{k-1}$, $\mathbf{y}_k$

▷ Prediction (derived in Section V-A):

1: $\hat{\mathbf{R}}_{k|k-1} = \hat{\mathbf{R}}_{k-1} \exp_m(\omega_{k-1})$

2: $\mathbf{\Pi}_{k|k-1} = \mathbf{\Pi}_{k-1} + \mathbf{Q}_{k-1}$

▷ Correction (derived in Section V-B):

3: $\mathbf{H}_k = \begin{pmatrix} (\hat{\mathbf{R}}_{k|k-1}^{-1}\mathbf{g}) \times \\ (\hat{\mathbf{R}}_{k|k-1}^{-1}\mathbf{m}_e) \times \end{pmatrix}$

4: $\mathbf{S}_k = (1 + \bar{\gamma}\epsilon) \mathbf{H}_k \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T + \bar{\gamma}(\epsilon^{-1} + 1)\bar{\Delta} + \mathbf{R}_k$

5: $\mathbf{K}_k = (1 + \bar{\gamma}\epsilon) \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T \mathbf{S}_k^{-1}$

6: $\hat{\mathbf{R}}_k = \hat{\mathbf{R}}_{k|k-1} \exp_m \left( \mathbf{K}_k \left( \mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1}) \right) \right)$

7: $\mathbf{\Pi}_k = (1 + \bar{\gamma}\epsilon) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbf{\Pi}_{k|k-1}$

8: return $\hat{\mathbf{R}}_k$, $\mathbf{\Pi}_k$

the estimated attitude $\hat{\mathbf{R}}_{k-1}$ with the upper bound of its covariance matrix $\mathbf{\Pi}_{k-1}$, the input $\omega_{k-1}$, and the output $\mathbf{y}_k$. The algorithm outputs are the estimated attitude $\hat{\mathbf{R}}_k$ with the upper bound of its covariance matrix $\mathbf{\Pi}_k$. This upper bound is locally minimal among filters with the same form of correction step (11) as in IEKF. The scalar $\epsilon > 0$ is a positive constant, serving as a tunable parameter of the algorithm. The algorithm steps are detailed in the next section.

**Remark:** The steps of Algorithm 2 are the same as Algorithm 1 except for steps 4, 5 and 7. When $\bar{\gamma} = 0$, i.e. there is no attack on the output, the steps of the Algorithm 2 become identical to Algorithm 1.

## V. SECURE FILTER DERIVATION

This section provides a detailed derivation of Algorithm 2. It consists of three subsections: the first ex-
plains the prediction, the second explains the correction, and the third discusses the algorithm parameters. We denote the prediction error and the corresponding covariance matrix by $\exp_m(\xi_{k|k-1}) = \hat{\mathbf{R}}_{k|k-1}^{-1}\mathbf{R}_k$ and $\mathbf{P}_{k|k-1} = \mathbb{E}(\xi_{k|k-1}\xi_{k|k-1}^T)$, respectively, and we define the estimation error and the corresponding covariance matrix by $\exp_m(\xi_k) = \hat{\mathbf{R}}_k^{-1}\mathbf{R}_k$ and $\mathbf{P}_k = \mathbb{E}(\xi_k\xi_k^T)$, respectively.

### A. Prediction

Employing the attitude dynamic (6), and the prediction (10) in the prediction error $\exp_m(\xi_{k|k-1})$ gives: $\exp_m(\xi_{k|k-1}) = \exp_m(-\omega_{k-1})\hat{\mathbf{R}}_{k-1}^{-1}\mathbf{R}_{k-1}\exp_m(\omega_{k-1} + \mathbf{w}_{k-1}) = \exp_m(-\omega_{k-1})\exp_m(\xi_{k-1})\exp_m(\omega_{k-1} + \mathbf{w}_{k-1})$. Applying the first-order approximation (4) gives:

$$ \xi_{k|k-1} = \xi_{k-1} + \mathbf{w}_{k-1}. \quad (12) $$

Then the prediction error covariance matrix is

$$ \mathbf{P}_{k|k-1} = \mathbb{E}(\xi_{k|k-1}\xi_{k|k-1}^T) = \mathbf{P}_{k-1} + \mathcal{Q}_{k-1}. $$

The prediction error covariance matrix in the previous time step is upper bounded by $\Pi_{k-1}$, i.e. $\mathbf{P}_{k-1} \le \Pi_{k-1}$, thus $\mathbf{P}_{k|k-1} \le \Pi_{k-1} + \mathcal{Q}_{k-1}$, and the upper bound of the prediction error covariance matrix is given by:

$$ \Pi_{k|k-1} = \Pi_{k-1} + \mathcal{Q}_{k-1}. \quad (13) $$

### B. Correction

The estimation error is given by $\exp_m(\xi_k) = \hat{\mathbf{R}}_k^{-1}\mathbf{R}_k$, employing the correction equation (11) gives:

$$ \begin{aligned} \exp_m(\xi_k) &= \exp_m(-\mathbf{K}_k(\mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1})))\hat{\mathbf{R}}_{k|k-1}^{-1}\mathbf{R}_k, \\ &= \exp_m(-\mathbf{K}_k(\mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1})))\exp_m(\xi_{k|k-1}). \end{aligned} $$

Applying first-order approximation (4) gives:

$$ \begin{aligned} \xi_k &= -\mathbf{K}_k (\mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1})) + \xi_{k|k-1}, \\ &= -\mathbf{K}_k (\mathbf{h}(\mathbf{R}_k) - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1}) + \gamma_k \delta_k + \mathbf{v}_k) + \xi_{k|k-1}. \end{aligned} \quad (14) $$

Note that applying (4) relies on the assumption that the vector $\mathbf{y}_k - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1})$ is sufficiently small. Although this condition is not theoretically guaranteed at all time steps due to the potential presence of cyber attacks, simulation results indicate that the approximation remains valid and leads to accurate estimation performance in practice.

The difference $\tilde{\mathbf{h}}_k = \mathbf{h}(\mathbf{R}_k) - \mathbf{h}(\hat{\mathbf{R}}_{k|k-1})$ can be simplified as follows:

$$ \begin{aligned} \tilde{\mathbf{h}}_k &= \begin{pmatrix} \mathbf{R}_k^{-1} - \hat{\mathbf{R}}_{k|k-1}^{-1} & \mathbf{g} \\ \hat{\mathbf{R}}_k^{-1} - \hat{\mathbf{R}}_{k|k-1}^{-1} & \mathbf{m}_e \end{pmatrix} \\ &= \begin{pmatrix} (\exp_m(-\xi_{k|k-1}) - \mathbf{I}_3) \hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{g} \\ (\exp_m(-\xi_{k|k-1}) - \mathbf{I}_3) \hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{m}_e \end{pmatrix}, \end{aligned} $$

using the first-order approximation (3), followed by employing the skew-symmetric matrix property (5), gives:

$$ \begin{aligned} \tilde{\mathbf{h}}_k &= \begin{pmatrix} -(\xi_{k|k-1}) \times \hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{g} \\ -(\xi_{k|k-1}) \times \hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{m}_e \end{pmatrix}, \\ &= \begin{pmatrix} (\hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{g}) \times \xi_{k|k-1} \\ (\hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{m}_e) \times \xi_{k|k-1} \end{pmatrix}, \\ &= \mathbf{H}_k \xi_{k|k-1}, \end{aligned} \quad (15) $$

where $\mathbf{H}_k = \begin{pmatrix} (\hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{g}) \times \\ (\hat{\mathbf{R}}_{k|k-1}^{-1} \mathbf{m}_e) \times \end{pmatrix}$, substituting (15) in (14) gives:

$$ \begin{aligned} \xi_k &= -\mathbf{K}_k (\mathbf{H}_k \xi_{k|k-1} + \gamma_k \delta_k + \mathbf{v}_k) + \xi_{k|k-1}, \\ &= (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \xi_{k|k-1} - \gamma_k \mathbf{K}_k \delta_k - \mathbf{K}_k \mathbf{v}_k. \end{aligned} $$

Now, we calculate $\mathbf{P}_k = \mathbb{E}(\xi_k\xi_k^T)$:

$$ \begin{aligned} \mathbf{P}_k &= (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbb{E}(\xi_{k|k-1} \xi_{k|k-1}^T) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k)^T \\ &\quad + \mathbb{E}(\gamma_k^2) \mathbf{K}_k \delta_k \delta_k^T \mathbf{K}_k^T + \mathbf{K}_k \mathbb{E}(\mathbf{v}_k \mathbf{v}_k^T) \mathbf{K}_k^T \\ &\quad - \mathbb{E}(\gamma_k) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbb{E}(\xi_{k|k-1}) \delta_k^T \mathbf{K}_k^T \\ &\quad - \mathbb{E}(\gamma_k) \mathbf{K}_k \delta_k \mathbb{E}(\xi_{k|k-1}^T) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k)^T \\ &\quad - (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbb{E}(\xi_{k|k-1}) \mathbb{E}(\mathbf{v}_k^T) \mathbf{K}_k^T \\ &\quad - \mathbf{K}_k \mathbb{E}(\mathbf{v}_k) \mathbb{E}(\xi_{k|k-1}^T) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k)^T \\ &\quad + \mathbb{E}(\gamma_k) \mathbf{K}_k \delta_k \mathbb{E}(\mathbf{v}_k^T) \mathbf{K}_k^T \\ &\quad + \mathbb{E}(\gamma_k) \mathbf{K}_k \mathbb{E}(\mathbf{v}_k) \delta_k^T \mathbf{K}_k^T, \end{aligned} $$

we know that $\mathbf{P}_{k|k-1} = \mathbb{E}(\xi_{k|k-1}\xi_{k|k-1}^T)$, $\mathbb{E}(\mathbf{v}_k) = \mathbf{0}$, $\mathbb{E}(\mathbf{v}_k\mathbf{v}_k^T) = \mathbf{R}_k$, $\mathbb{E}(\gamma_k) = \bar{\gamma}$, $\mathbb{E}(\gamma_k^2) = \bar{\gamma}^2$, thus:

$$ \begin{aligned} \mathbf{P}_k &= (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbf{P}_{k|k-1} (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k)^T \\ &\quad + \bar{\gamma} \mathbf{K}_k \delta_k \delta_k^T \mathbf{K}_k^T + \mathbf{K}_k \mathbf{R}_k \mathbf{K}_k^T \\ &\quad - \bar{\gamma} (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbb{E}(\xi_{k|k-1}) \delta_k^T \mathbf{K}_k^T \\ &\quad - \bar{\gamma} \mathbf{K}_k \delta_k \mathbb{E}(\xi_{k|k-1}^T) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k)^T. \end{aligned} $$

Applying Lemma 1 on $(\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbb{E}(\xi_{k|k-1})$ and $\mathbf{K}_k \delta_k$, and applying these properties $\delta_k \delta_k^T \le \mathbf{\Delta}$, $\mathbb{E}^2(\cdot) \le \mathbb{E}(\cdot^2)$, and $\mathbf{P}_{k|k-1} \le \Pi_{k-1|k-1}$:

$$ \begin{aligned} \mathbf{P}_k \le \mathbf{\Pi}_k = & (1 + \bar{\gamma}\epsilon) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbf{\Pi}_{k|k-1} (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k)^T \\ & + (\epsilon^{-1} + 1) \bar{\gamma} \mathbf{K}_k \bar{\mathbf{\Delta}} \mathbf{K}_k^T + \mathbf{K}_k \mathbf{R}_k \mathbf{K}_k^T, \end{aligned} $$

we rearrange it for easier trace derivation later:

$$ \begin{aligned} \mathbf{\Pi}_k = & \mathbf{K}_k ((1 + \bar{\gamma}\epsilon)\mathbf{H}_k \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T + (\epsilon^{-1} + 1)\bar{\gamma}\bar{\mathbf{\Delta}} + \mathbf{R}_k)\mathbf{K}_k^T \\ & - (1 + \bar{\gamma}\epsilon)\mathbf{K}_k \mathbf{H}_k \mathbf{\Pi}_{k|k-1} \\ & - (1 + \bar{\gamma}\epsilon)\mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T \mathbf{K}_k^T \\ & + (1 + \bar{\gamma}\epsilon)\mathbf{\Pi}_{k|k-1}. \end{aligned} \quad (16) $$

In order to minimize the trace of $\mathbf{\Pi}_k$, we find $\mathbf{K}_k$ that satisfies $\frac{\partial \mathrm{tr}(\mathbf{\Pi}_k)}{\partial \mathbf{K}_k} = \mathbf{0}$. Utilizing the matrix derivatives from [4] (Propositions 10.7.2 and 10.7.4), leads to $\frac{\partial \mathrm{tr}(\mathbf{\Pi}_k)}{\partial \mathbf{K}_k} = 2\mathbf{K}_k ((1 + \bar{\gamma}\epsilon)\mathbf{H}_k \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T + (\epsilon^{-1} + 1)\bar{\gamma}\bar{\mathbf{\Delta}} + \mathbf{R}_k) - \mathbf{K}_k \mathbb{E}(\xi_{k|k-1})\mathbf{H}_k^T$.
2(1 + $\bar{\gamma}\epsilon$) $\Pi_{k|k-1}H_k^T$, thus the following gain minimizes the trace of $\Pi_k$:

$$ \mathbf{K}_k = (1 + \bar{\gamma}\epsilon) \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T \mathbf{\Sigma}_k^{-1}, \quad (17) $$

which is step 5 in Algorithm 2, where

$$ \mathbf{S}_k = (1 + \bar{\gamma}\epsilon) \mathbf{H}_k \mathbf{\Pi}_{k|k-1} \mathbf{H}_k^T + \bar{\gamma}(\epsilon^{-1} + 1) \bar{\Delta} + \mathbf{R}_k, \quad (18) $$

which is step 4 in Algorithm 2. By applying this gain in (16), we obtain:

$$ \mathbf{\Pi}_k = (1 + \bar{\gamma}\epsilon) (\mathbf{I} - \mathbf{K}_k \mathbf{H}_k) \mathbf{\Pi}_{k|k-1}, \quad (19) $$

which is step 7 in Algorithm 2.

### C. Discussion

**Selection of $\epsilon$:** According to Lemma 1, any real positive value greater than zero can be chosen for $\epsilon$. However, in practice, selecting a very large or very small value for $\epsilon$ may degrade estimation performance. Therefore, this parameter serves as a tunable parameter of the algorithm.

**The effect of $\bar{\Delta}$:** Increasing $\bar{\Delta}$ leads to increasing $\mathbf{S}_k$, and thus decreasing $\mathbf{K}_k$, giving less weight to the correction step and making the estimation error covariance matrix upper bound larger. This result is expected, because increasing the upper bound of the false injected signal to the output makes the output unreliable, and making the estimator depends less on the output to perform the correction.

## VI. SIMULATIONS

This section aims to validate the proposed algorithm's effectiveness through simulations. The following three subsections present the simulation setup, the simulation results for the proposed algorithm, and finally, a comparison with IEKF. For a reliable comparison with the IEKF, we perform Monte Carlo simulations with 100 runs.

### A. Simulations setup

Each simulation has a duration of 100 s, with a sampling time of $\Delta T = 0.01$ s, i.e. $t_k = \Delta T k$, where $t_k$ is the time vector. The Earth's gravity and magnetic field are $\mathbf{g} = [0, 0, 9.81] \, \text{m/s}^2$ and $\mathbf{m}_e = [0.23, 0.01, 0.41] \, \text{Gauss}$, respectively. The true value of the body's angular velocity is $\omega_k = [0.8 \cos(1.2t_k), -1.1 \cos(0.5t_k), -0.4 \cos(0.3t_k)]^T$. The gyroscope, accelerometer, and magnetometer noises were set to be zero-mean white Gaussian noise signals with standard deviations of $\sigma_\omega = 0.05 \, \text{rad/s}$, $\sigma_a = 0.1 \, \text{m/s}^2$, and $\sigma_m = 0.01 \, \text{Gauss}$, respectively. The false data injected signal is set to $\delta_k = \sin(t)\delta_{max}$, where $\delta_{max} = [3, 3, 3, 0.2, 0.2, 0.2]^T$. Inspired by [19], we set $\epsilon = 0.001$. The initial true rotation matrix was set to correspond to $[45^\circ, 45^\circ, 45^\circ]$ in terms of Euler angles (Roll, Pitch, Yaw) using XYZ convention (Section 3.3 in [12]), while initial estimation error covariance matrix is set to the all-ones matrix, respectively.

For each Monte Carlo run, the initial attitude estimate is randomly generated, with roll and yaw uniformly sampled from $[-180^\circ, 180^\circ]$, and pitch from $[-90^\circ, 90^\circ]$, covering the full range of possible rotations [12]. Additionally, each run

has different noise sequences for sensor measurements and different Bernoulli sequences for the attack occurrence. All runs share the same measurement noise standard deviation and attack success rate.

### B. Secure-IEKF simulation results

In this subsection, simulation results are presented for the case $\bar{\gamma} = 0.7$, based on a single run with an initial estimated rotation matrix corresponding to Euler angles $[-45^\circ, -20^\circ, -15^\circ]$. Fig. 1 plots the estimation error accuracy obtained with the proposed algorithm, showing how the estimation error converges. After convergence, the error is less than 0.5 degrees for each Euler angle, for most of the time. To validate the upper bound of the estimation error covariance matrix, which applies to the estimation error on SO(3) mapped to vector space, we calculate the estimation error in this mapped space and plot it alongside the $\pm 3$ times the standard deviation, derived from the diagonal of the upper bound covariance matrix. The $\pm 3$ times the standard deviation contains 95% of the signal for a Gaussian distribution, though it is important to note that, due to first-order approximation, the resulting estimation error is not Gaussian. Fig. 2 shows that the $\pm 3$ times the standard deviation bounds the estimation error.

<figure><img src="image_2.png" /><figcaption>Fig. 1. Attitude estimation error for the proposed algorithm</figcaption></figure>

<figure><img src="image_3.png" /><figcaption>Fig. 2. Estimation error on SO(3) mapped to vector space alongside the $\pm 3$ times the standard deviation.</figcaption></figure>
### C. Comparison with IEKF

Table I shows the RMSE of the proposed secure-IEKF and IEKF for several scenarios of $\bar{\gamma}$. Both algorithms give

<table><caption>TABLE I
RMSE (IN DEGREES) FOR SECURE-IEKF AND IEKF</caption><thead><tr><th>γ̃</th><th>Secure-IEKF<br>RMSE (degrees)</th><th>IEKF<br>RMSE (degrees)</th></tr></thead><tbody><tr><td>0</td><td>0.228</td><td>0.228</td></tr><tr><td>0.5</td><td>0.255</td><td>8.68</td></tr><tr><td>0.7</td><td>0.259</td><td>12.4</td></tr></tbody></table>

the same accuracy when $\bar{\gamma} = 0$ because the secure-IEKF algorithm is identical to IEKF when $\bar{\gamma} = 0$, as discussed in the previous section. As $\bar{\gamma}$ increases, the estimation performance of the IEKF degrades because it treats the measurements as benign, whereas the secure-IEKF's estimation performance is not affected much, as it takes into account the possibility of attacks and their characteristics ($\bar{\gamma}$ and its upper bound).

## VII. CONCLUSION

This paper presented a secure attitude estimation approach on the special orthogonal group SO(3) based on Magnetic field, Angular Rate, and Gravity (MARG) measurements, where the accelerometer and magnetometer sensors are subject to randomly occurring False Data Injection (FDI) attacks characterized by a Bernoulli distribution. The proposed algorithm, secure invariant extended Kalman filter (secure-IEKF), was designed with a novel Kalman gain of IEKF, with the goal of minimizing the upper bound of the estimation error covariance matrix. Simulations demonstrated the algorithm's convergence and effectiveness in attitude estimation, as well as the validation of the upper bound on the estimation error covariance matrix. Additionally, Monte Carlo simulations showed that the performance of the standard IEKF degrades as the frequency of randomly occurring FDI attacks increases, while the secure-IEKF remains relatively unaffected. Future work will focus on formally proving the algorithm's convergence.

## REFERENCES

[1] S. Amin, G. A. Schwartz, and S. Shankar Sastry. Security of interdependent and identical networked control systems. Automatica, 49(1):186-192, 2013.

[2] A. Barrau and S. Bonnabel. Invariant Kalman filtering. Annu. Rev. Control, Robot., Auton. Syst., 1(1):237-257, 2018.

[3] S. Berkane and A. Tayebi. On the design of attitude complementary filters on SO(3). IEEE Trans. Autom. Control, 63(3):880-887, 2018.

[4] D. S. Bernstein. Matrix mathematics: theory, facts, and formulas. Princeton University Press, 2nd edition, 2009.

[5] S. Bonnabel and A. Barrau. The geometry of navigation problems. IEEE Trans. Autom. Control, 68(2):689-704, 2023.

[6] I. Boukabou, N. Kaabouch, and D. Rupanetti. Cybersecurity challenges in UAV systems: IEMI attacks targeting inertial measurement units. Drones, 8(12):738, 2024.

[7] M. S. Chong, H. Sandberg, and A. M. Teixeira. A tutorial Introduction to security and privacy for cyber-physical systems. In 2019 18th Eur. Control Conf., pages 968-978, Naples, Italy, 2019.

[8] S. M. Dibaji, M. Pirani, D. B. Flamholz, A. M. Annaswamy, K. H. Johansson, and A. Chakraborty. A systems and control perspective of CPS security. Annu. Rev. Control, 47:394-411, 2019.

[9] D. Ding, Z. Wang, Q.-L. Han, and G. Wei. Security control for discrete-time stochastic nonlinear systems subject to deception attacks. IEEE Trans. Syst., Man, Cybern. Syst., 48(5):779-789, 2018.

[10] F. Farokhi, I. Shames, and N. Batterham. Secure and private control using semi-homomorphic encryption. Control Eng. Pract., 67:13-20, 2017.

[11] H. Fawzi, P. Tabuada, and S. Diggavi. Secure estimation and control for cyber-physical systems under adversarial attacks. IEEE Trans. Autom. Control, 59(6):1454-1467, 2014.

[12] H. Fourati and D. E. C. Belkhiat, editors. Multisensor attitude estimation: fundamental concepts and applications. CRC Press, 2016.

[13] A. Y. Javaid, W. Sun, V. K. Devabhaktuni, and M. Alam. Cyber security threat analysis and modeling of an unmanned aerial vehicle system. In IEEE Conf. Technol. Homeland Secur. (HST), pages 585-590, Waltham, MA, USA, 2012.

[14] R. Jiang, X. Liu, H. Wang, and S. S. Ge. Secure estimation for attitude and heading reference systems under sparse attacks. IEEE Sens. J., 19(2):641-649, 2019.

[15] I. Jovanov and M. Pajic. Sporadic data integrity for secure state estimation. In IEEE 56th Annu. Conf. Decis. Control (CDC), pages 163-169, Melbourne, Australia, 2017. IEEE.

[16] L. Li, H. Yang, Y. Xia, and H. Yang. State estimation for linear systems with unknown input and random false data injection attack. IET Control Theory Appl., 13(6):823-831, 2019.

[17] S. Liu, G. Wei, Y. Song, and Y. Liu. Extended Kalman filtering for stochastic nonlinear systems with randomly occurring cyber attacks. Neurocomputing, 207:708-716, 2016.

[18] X. Liu, D. Bai, Y. Lv, R. Jiang, and S. S. Ge. UKF-based vehicle pose estimation under randomly occurring deception attacks. Secur. Commun. Netw., 2021:1-12, 2021.

[19] X. Liu, R. Jiang, H. Wang, and S. S. Ge. Filter-based secure dynamic pose estimation for autonomous vehicles. IEEE Sens. J., 19(15):6298-6308, 2019.

[20] S. Parkinson, P. Ward, K. Wilson, and J. Miller. Cyber threats facing autonomous and connected vehicles: Future challenges. IEEE Trans. Intell. Transp. Syst., 18(11):2898-2915, 2017.

[21] J. Reis, P. Batista, P. Oliveira, and C. Silvestre. Nonlinear observer on SO(3) for attitude estimation on rotating earth using single vector measurements. IEEE Control Syst. Lett., 3(2):392-397, 2019.

[22] N. M. Rodday, R. D. O. Schmidt, and A. Pras. Exploring security vulnerabilities of unmanned aerial vehicles. In IEEE/IFIP Netw. Oper. Manage. Symp. (NOMS), pages 993-994, Istanbul, Turkey, 2016.

[23] A. M. Sabatini. Quaternion-based extended Kalman filter for determining orientation by inertial and magnetic sensing. IEEE Trans. Biomed. Eng., 53(7):1346-1356, 2006.

[24] G. Shaaban, H. Fourati, A. Kibangou, and C. Prieur. Gyro-free Kalman filter with unknown inputs for SO(3)-based attitude estimation. In IEEE 13th Int. Conf. Indoor Position. Indoor Navig. (IPIN), Nuremberg, Germany, 2023.

[25] G. Shaaban, H. Fourati, A. Kibangou, and C. Prieur. MARG sensor-based attitude estimation on SO(3) under unknown external acceleration. IEEE Control Syst. Lett., 7:3795-3800, 2023.

[26] M. D. Shuster and S. D. Oh. Three-axis attitude determination from vector observations. J. Guid. Control Dyn., 4(1):70-77, 1981.

[27] Y. S. Suh. Orientation estimation using a quaternion-based indirect Kalman filter with adaptive estimation of external acceleration. IEEE Trans. Instrum. and Meas., 59(12):3296-3305, 2010.

[28] G. Wahba. Problem 65-1: A least squares estimate of satellite attitude. SIAM Review, 7(3):409-409, 1965.

[29] T. Yang, C. Murguia, M. Kuijper, and D. Nesic. An unknown input multiobserver approach for estimation and control under adversarial attacks. IEEE Trans. Control Netw. Syst., 8(1):475-486, 2021.

[30] T. Yang, C. Murguia, M. Kuijper, and D. Nešić. A multi-observer based estimation framework for nonlinear systems under sensor attacks. Automatica, 119:109043, 2020.

[31] X. Yun, E. R. Bachmann, and R. B. McGhee. A simplified quaternion-based algorithm for orientation estimation from earth gravity and magnetic field measurements. IEEE Transactions on Instrumentation and Measurement, 57(3):638-650, 2008.

[32] X. Zhang, Z. Yan, and Y. Chen. High-degree cubature Kalman filter for nonlinear state estimation with missing measurements. Asian J. Control, 24(3):1261-1272, 2022.