1. Introduction
With the rapid development of big data, cloud computing, and mobile Internet technology, vehicles are gradually becoming more intelligent and network oriented [
1]. The application of the CAN bus makes communication between vehicles more efficient. However, the CAN bus is designed with a lack of security functions thus making it susceptible to being attacked by various types such as tampering and replay [
2]. In recent years, CAN networks have been subject to a series of attacks [
3]. In 2015, the 360 company announced that they had achieved a crack of the remote control function and a millimeter-wave radar system on Tesla [
4]. In 2017, the Keen Security Lab of Tencent implemented a remote attack on Tesla and eventually achieved unauthorized control of Tesla [
5]. To prevent these potential attacks in vehicles [
6], a variety of measures have been taken to establish security defenses such as encryption, authentication, anomaly detection system, and firewalls.
In anomaly detection technology research on the in-vehicle network, the CAN bus, has been widely used in recent years [
7,
8,
9] such as physical characteristics [
10], statistical approaches [
11], feature-based intrusion detection technology [
12], deep-learning [
13], and so on. For the physical characteristics of the vehicle, legal ECU created a file containing signal and voltage signatures for comparing the traffic with the profiles of unusual traffic [
14]. In [
10], they built fingerprints based on the ECU periodic frequency which establishes the ECUs clock baseline through the recursive least squares algorithm (RLS). Their method was able to detect some attacks caused by frequency abnormality. Muter [
15] and Asaj [
16] proposed a statistical feature-based information entropy approach to design IDSs in three different attack scenarios. However, their method did not perform well for tampering attack detection.
Moreover, many machine learning techniques are also being investigated and widely used in anomaly detection technology for CAN networks. For example, Kang et al. [
17] proposed an anomaly detection based on a deep neural network (DNN). The data packets exchanged between ECUs are trained to extract low-dimensional features that are used for classification, and this approach responded to attacks. In 2016, Taylor et al. [
18] proposed an anomaly detection based on a recurrent neural network (RNN) to detect CAN bus attacks. This method works through learning and predicting the next data field which is transmitted on the CAN bus. Nevertheless, it can only detect exceptions for a single ID. In 2020, Hossain et al. [
19] proposed an anomaly detection based on long short-term memory (LSTM) to detect and mitigate attacks on the CAN bus. The common problem of the aforementioned study is that it costs a lot of computation, which does not fit the CAN bus in a closed network with limited computing power, transmission bandwidth, and resources. Therefore, it is a very challenging work to study how to balance the security and high efficiency abnormally detection mechanism that can solve the problem of information security threats brought by external attacks in the resource-constrained vehicle interior network, which is also the significance of this paper and the core problem to be solved.
The human immune system (HIS) [
20] is a self-organizing, robust, and fault-tolerant system. It can protect against bacterial invasion and regulates many bodily functions. The artificial immune system (AIS) is a computer system developed by drawing on the mechanisms and functions associated with cells in the human immune system. The AIS protects computer networks mainly by identifying self/non-self-mechanisms and intrusion [
21]. Many artificial immune-based anomaly detection studies have also made some progress. For example, Igbe et al. [
22] proposed an architecture for a distributed network intrusion detection system based on artificial immunity. In 2018, Vidal et al. [
23] suggested an adaptive artificial immune network to mitigate DOS flooding attacks.
Through research and analysis, we have found that the HIS and in-vehicle network CAN bus share many symmetries in terms of system characteristics and safety such as the following: (1) there is a large number of ECU [
24] nodes in an in-vehicle CAN network, the HIS is also a complex system that is subject to a myriad of cells acting together; (2) in terms of system characteristics, the in-vehicle CAN bus network is generally distributed, self-organizing and robust, which are also fundamental characteristics of the HIS; (3) in terms of security, the in-vehicle CAN bus is exposed to hacking and intrusion, while the HIS is exposed to threats such as bacteria and viruses, furthermore both the HIS and in-vehicle CAN bus networks need to maintain a relatively stable operating state in a constantly changing external environment. The similarities between the HIS, anomaly detection, and the in-vehicle CAN bus network are given in
Table 1.
Considering the above similarities, both will exhibit different levels of antibodies when an abnormal situation arises for protecting autologous security. At the same time, the method of immune systems can ensure high detection efficiency compared with deep learning. Therefore, this paper focus on the artificial immune algorithm for detecting the in-vehicle CAN bus anomaly instruction.
The immune algorithm is an information processing algorithm inspired by the principle of immunity, which mainly simulates the mechanisms and functions possessed by lymphocytes and antibodies in the human immune system, including antigen presentation, antibody production, immune regulation, and immune memory. Although there is no complete and universal theoretical system, classical immune algorithms have been widely used by domestic and international scholars, among which the more prominent ones are the negative selection algorithm proposed by Forrest [
25] and the clonal selection algorithm proposed by Castrot [
26], both representatives of the first generation immune algorithm, which are adaptive immune algorithms based on the autologous/non-autologous model.
The dendritic cell algorithm (DCA) [
27] belongs to the second generation of artificial immune algorithms, which is designed according to the mechanism of the innate immune system, and get extensive usage in many fields, such as anomaly detection [
28,
29], vulnerability identification [
30], earthquake magnitude prediction [
31], big data classification [
32], etc., among which the most widely applied is anomaly detection. Current research on the DCA and improved dendritic cell algorithm (IDCA) [
33] has shown that the algorithm not only exhibits excellent detection accuracy but is also expected to help reduce the rate of misclassification and false alarms that occur in similar systems [
34].
As far as the relevance of the DCA algorithm to the CAN bus is concerned, the intrusion detection of CAN data is performed for each CAN data attribute, and DCA correlates the antigen and the signal. Thus, it makes each CAN data represent an antigen and each attribute a signal of DCA. This indicates that CAN message attributes are more compatible with DCA.
With the above background, we propose an effective anomaly detection method for an in-vehicle CAN network based on enhanced DCA. The method focuses on the CAN bus data attributes used for intrusion detection. We use the particle swarm optimization algorithm (PSO) and gravitational search algorithm (GSA) to optimize the DCA classifier to improve its detection accuracy. In addition, since the input signal of DCA relies heavily on human experience, we design DCA-based CAN message attribute matching rules. In our experiments, we capture real vehicle datasets to validate the detection performance of our approach for various attacks. Our main contributions are as follows:
In response to the unsatisfactory detection effect of the original DCA algorithm, we design an enhanced DCA algorithm based on particle swarm optimization (PSO) and the gravitational search algorithm (GSA) to improve the detection accuracy.
We designed an intrusion detection model based on the enhanced DCA algorithm. The model consists of four layers: a data layer, signal selection layer, classification layer, and output layer.
To address the problem that the input signal of the model signal selection layer is affected by the manual experience, a DCA-based CAN message attribute matching rule is proposed, which selects the most relevant features based on the information gain and standard deviation of CAN attributes to achieve adaptive signal selection.
The rest of the paper is organized as follows:
Section 2 presents the proposed PSO-GSA-DCA algorithm.
Section 3 presents the intrusion detection model. The analysis of the experimental results is given in
Section 4. Finally, conclusions are drawn in
Section 5.
3. Intrusion Detection Model for In-Vehicle Bus Network
3.1. Overview
Our overall goal is to detect attacks on vehicles, or more precisely, to determine whether a vehicle is under attack by detecting anomalous sequences on the in-vehicle CAN bus. We propose an enhanced dendritic cell algorithm based on PSO-GSA and design the intrusion detection system IDS. the enhanced DCA-based intrusion detection model for in-vehicle CAN bus networks consists of four main layers of structure: a data layer, signal selection layer, classification layer, and output layer. The specific schematic diagram is shown in
Figure 1.
3.2. Date Layer
The data layer mainly completes the collection of CAN bus data sets. The datasets used in the experiments were collected from the on-board CAN bus network of real cars, including attack-free data during normal driving of the car and attack datasets generated by injection attacks. To capture the CAN bus traffic in real time, we drove around the experiment building for about 2 h, connected the data collection device to the on-board diagnostic (OBD-II) port, and used an automotive bus simulation software (i.e., CAN Test) to monitor, store and inject abnormal messages from the on-board CAN network. This is shown in
Figure 2.
As shown in
Figure 3, we inject three kinds of attacks: DoS attack, fuzzing attack, and replay attack. Each attack is defined as follows:
DoS attack: Several high-priority CAN IDs (e.g., 0x000 CAN ID) are injected. We inject 0x000 CAN ID messages every 0.3 ms.
Replay attack: Repeated already received CAN messages are transmitted to the target ECU in a short period. We inject CAN ID and CAN data messages every 1 ms.
Fuzzy attack: Spoofed random CAN IDs and data values are injected into the CAN traffic. We injected CAN messages representing handbrake, steering, etc. into the messages with a period of 0.5 ms.
Table 2 shows the CAN bus dataset consisting of the training set and the test set. The “CAN messages” represent the total number of CAN packets. “Attack messages” indicate the number of packets containing at least one abnormal CAN data. The various types of data sets are independent of each other and are not of multiple classes. We allocate
of the packet to the training data and the remaining
to the test data to avoid overfitting problems during the training process.
3.3. Signal Selection Layer
The task of matching CAN message attributes with the input signals of the DCA algorithm is accomplished in this layer. To address the problem that the input signal in the signal selection layer relies heavily on manual experience, we design an enhanced DCA-based attribute matching rule for in-vehicle CAN messages to achieve adaptive signal selection, i.e., by calculating the information gain and standard deviation of CAN messages, we select the attributes among them that are important and contribute significantly to anomaly detection to be assigned to the DCA input signal. For the on-board CAN bus, the antigen is each message of the CAN bus, and the DCA input signal is the attribute value corresponding to the CAN message.
The standard data frame of the CAN bus contains attributes such as time stamp, CAN channel, CAN ID, data length code (DLC), data field, etc.
Figure 4 shows the standard data frame attributes of a CAN bus message.
For CAN bus data frames, the data field is the core content of the entire CAN data frame. This field represents the original information that needs to be sent by the ECU node, and a data field contains from 0 to 8 bytes of data.
Figure 5 reflects the byte order and the bit order when the information is sent.
For the DCA algorithm, the more attributes available can filter the solution that better matches the input signal of the algorithm, so the attribute division of the CAN bus message data field is mainly the following method: we divide the 8 bytes of the data field attribute into 8 attributes and calculate the information gain and standard deviation together with the original attribute.
The proportion of the class samples in the current training sample set
D is
,
, and the entropy of
D for binary classification is referred to as the information entropy
, then the information entropy of
D is defined as:
Attribute
in set
D with information entropy
, then the information entropy
of attribute
A included in the set of training samples
D is defined as:
Information gain for
A can be calculated as:
Standard deviation (
SD) mainly characterizes the deviation of various types of data from the mean; the larger the
SD, the larger the deviation of the data from the mean, and it is an important indicator of the degree of dispersion of a data set. Its calculation formula is
where
denotes the mean value of
employed.
We first calculate the information gain of each attribute of the CAN bus data and remove the attributes with low information gain from the dataset and extract the attributes with high information gain. Then we design matching rules to assign the extracted CAN message attributes to the three input signals of the DCA algorithm.
Table 3 lists the information gained from each attribute of the message.
As can be seen from
Table 3, the information gain of the timestamp attribute is small and the difference with other attributes is relatively obvious. Since the channel attribute takes only one value and does not have classification characteristics, these attributes cannot be used as the judgment basis for anomaly detection.
The standard deviations were found for each of the 10 attributes filtered by calculating the information gain, and
Table 4 shows the standard deviations of the 10 attributes.
The information gain of an attribute related to a CAN bus message indicates the statistical relevance of the attribute in terms of classification. The higher the information gain of a CAN message attribute, the more classification characteristics the message attribute can provide. The smaller the standard deviation, the more stable and reliable the data are. Therefore, we design the signal matching rules based on the information gain and standard deviation.
In the DCA algorithm, since the PAMP indicates abnormal data and the SS signal indicates normal data, both signals embody deterministic behavior, while the DS signal indicates possible abnormal data, which represents a high degree of data dispersion. Therefore, the CAN bus data attributes with high information gain and relatively small standard deviation are chosen to be suitable for matching with the PAMP and SS input signals. The remaining attributes are matched with the DS signal. Finally, the matching of the on-board CAN message attributes with the DCA algorithm input signal is realized. The properties of its matching rules are specifically assigned as follows:
PAMP: CAN ID, DLC;
SS: CAN ID, DLC;
DS: Date0, Date1, Date2, Date3, Date4, Date5.
A total of 25 types of CAN ID data messages are collected in our dataset, each type of message has a different identifier ID, so the 25 types of IDs are numbered to make them numerical. Each byte in the DATA field is a hexadecimal number, which is first converted to decimal and then normalized to a range of 0 to 100 using the normalization function together with other attributes; Equation (
28) defines the normalized linear function.
3.4. Classification Layer
The classification layer mainly accomplishes the work of abnormal data detection. Using the designed matching rules to match the data of the dataset with the input signal of the enhanced DCA algorithm, the DCA algorithm is executed, and finally, the data are judged to be abnormal according to the output.
DCA is an abnormality detection algorithm that generates output signals by fusing input signals, then determines the status of DCs based on the output signals, and finally evaluates the abnormality of antigens based on the status of DCs. The input signals include pathogen-associated molecular patterns (PAMP), danger signals (DS), and safe signals (SS). The output signals include the co-stimulatory molecules (CSM), the semi-mature signal (
sDC), and the mature signal (
mDC). CSM is primarily used to determine whether the DC has reached the state transition condition,
sDC indicates that the antigenic environment is safe, and
mDC indicates that the antigenic environment is dangerous. The abstract model of
DC signal processing is shown in
Figure 6.
From
Figure 6, it can be seen that the inter-influence relationship between the input and output signals satisfies: PAMPs affect CSM,
mDC; DS affects CSM,
mDC; SS affects CSM,
sDC, and
mDC, where SS harms
mDC. The degree of influence between the input and output signals is converted into the inter-signal weights, there are three main signal weight matrices available, as shown in
Table 5.
For signal fusion processing, mainly through the signal weight matrix described above and using the weighted summation formula, the signal processing formula can be expressed by Equation (
29).
Among them, represents the output, to indicates the three output signals: CSM, sDC, and mDC; means the input signals, which are PAMP, DS, and SS, respectively, and is the weight from to .
The output signals csm,
sDC, and
mDC are obtained by fusing the input signals using the weight matrix. If the CSM reaches the migration threshold (MT) which is set, the
and
will be compared, otherwise, the signal acquisition will continue. If
, the
DC is converted to a semi-mature state, indicating that the antigen is in a normal state when the antigen environment value is 0. Otherwise, the
DC is converted to a mature state, indicating that the antigen is abnormal, with the antigen environment value of 1.
The comprehensive evaluation of the antigen is mainly based on the number of semi-mature DCs and mature DCs ultimately converted, then generates the abnormality degree evaluation index, i.e., mature context antigen value (
MCAV), which indicates the proportion of the number of times the antigen was presented as semi-mature DCs to the total number of times it was presented.
where
is the number of antigens converted to
mDC, and
is the conversion to
sDC.
MCAV is a range between 0 and 1, and the closer it is to 1, the more probability that the antigen is abnormal.
In the comprehensive evaluation module, we set an abnormality threshold, and by comparing the
MCAV value of each antigen with the abnormality threshold, it gives a detection result of whether the antigen is abnormal or not. If the
MCAV is greater than the abnormality threshold, the antigen is judged to be abnormal. In classical DCA, the abnormality threshold is a user-defined setting. However, in practice, it is impossible to set up several different abnormality thresholds for the same detection criteria, there is some relationship between the abnormality thresholds and the number of detected abnormal data. Therefore, we give a method to generate the abnormality threshold automatically according to the dataset.
where
indicates the number of abnormal data in the CAN dataset and
denotes the total amount of datasets used for training. Algorithm 2 outlines the DCA detection algorithm based on CAN bus messages.
Algorithm 2 The DCA detection algorithm based on In-Vehicle CAN bus. |
- Require:
Input signals, PAMP, SS, DS; Weights Matrix, ; Number of abnormal data in -
CAN dataset, ; The total amount of CAN data trained, ; - Ensure:
Output signals (, , ); Mature Context Antigen Value, ; Degree -
of anomaly; - 1:
for each CAN data used for training do - 2:
Setup migration threshold, ; - 3:
while do - 4:
Acquire and store antigens ← CAN Data; - 5:
Get input signal ← CAN signal attributes; - 6:
Calculate output signals ← ; - 7:
if then - 8:
if then - 9:
; - 10:
else - 11:
; - 12:
end if - 13:
end if - 14:
set ; - 15:
end while - 16:
end for - 17:
for each antigen type do - 18:
Calculate ; - 19:
; - 20:
if then - 21:
return Abnormal; - 22:
else - 23:
return Normal; - 24:
end if - 25:
end for
|
4. Experiments and Results
Three indicators were employed to evaluate the performance of the scheme:
,
, and
, as illustrated by the following equations.
For the operating state the car is in, indicates that previously normal vehicles were incorrectly detected as being under attack; denotes that the attack was successfully detected; represents that the vehicle was under attack without being detected; means that the vehicle is in normal condition but the detection result still indicates that the vehicle is normal.
In order to select the most suitable transformation weight matrix for the DCA input and output signals, we analyzed the influence of different weight matrices on the performance of the algorithm, and the DCA algorithms with three different weight matrices were optimized with PSO-GSA respectively. This is shown in
Figure 7 below.
Figure 7 shows the variation of error rate with PSO-GSA algorithm population iteration for three DCA algorithms with different weight matrices. Where the horizontal coordinate is the number of iterations and the vertical coordinate represents the error rate. From the experiments, it can be seen that the population iterates to 100 generations when all three schemes find the optimal solution and tend to stabilize the value at the later stage. The PSO-GSA-DCA detection algorithm based on weight matrix three is the most efficient and has the lowest error rate, and the detection error rates of the detection models based on weight matrix two and weight matrix three differ less but neither has a better performance than weight matrix three, so weight matrix three is used as the influence weight value of the input and output signals of the PSO-GSA-DCA intrusion detection system.
It is well known that the detection performance of an intrusion detection system is the key to an intrusion detection system. To check the detection performance of the IDS model for different types of attacks, we tested our proposed IDS model using three types of CAN bus packets including a DoS attack, fuzzy attack, and replay attack. This is shown in
Figure 8 below.
From
Figure 8, we can see that PSO-GSA-DCA-IDS has good detection accuracy for several types of attacks. The detection accuracy of DoS attacks can be close to
, and the detection accuracy of the other two types of attacks is no less than
, indicating that the intrusion detection system model has good detection performance.
In
Figure 9, the time cost of the model to detect CAN frames is shown. In the experiment, the test messages are divided into three different batches of 64, 128, and 256. The results show that the PSO-GSA-DCA-IDS model requires only 0.077 ms, 0.082 ms, and 0.08 ms time cost on average for the three batches. In addition, the model actually detects 64 messages continuously. This means that the model can reason in 1 s about 5 times the number of CAN transmission messages in 1 s. Therefore, the model is feasible for real-time detection.
To further evaluate the performance of the proposed IDS model, we compare PSO-GSA-DCA with the current in-vehicle CAN network intrusion detection model constructed by the classical immune algorithms NSA [
25] and CSA [
26], as well as the original DCA and IDCA in terms of detection accuracy. It is shown in
Figure 10 and
Figure 11 below.
As shown in
Figure 10 and
Figure 11, PSO-GSA-DCA can reach more than
in terms of detection accuracy, which is advantageous compared with other immune models. In terms of time overhead, our model takes slightly less time to perform anomaly detection than some anomaly detection models and is at a lower level of loss overall. Thus, our model is superior both in terms of detection accuracy and time overhead.
5. Conclusions and Future Work
In this paper, we propose an effective-strength DCA-based anomaly detection method for in-vehicle CAN buses. We merged the PSO and GSA algorithms to optimize the DCA classifier. Firstly, we match CAN message attributes with DCA input signals (PAMPs, DS, SS), mainly by calculating the information gain and standard deviation of CAN data attributes to set up matching rules. Then, the anomaly detection model is built to train the data for anomaly detection. We validate the experiments by capturing datasets from real vehicles, as well as injecting three kinds of attacks (DoD, fuzzy, replay) to generate attack datasets to verify the model’s detection performance on the attack datasets. Meanwhile, we conduct comparison experiments with other detection algorithms, and the results show that PSO-GSA-DCA has high detection accuracy and lower time cost. Thus our method has better performance in anomaly detection.
In our future work, we will consider the implementation of strengthened DCA-based anomaly detection in real CAN bus networks to evaluate the performance of anomaly detection in real-time. Moreover, we will investigate how to detect an unknown attack on a vehicle. Eventually, we will consider combining innate immune algorithms with adaptive immune algorithms to build a complete intrusion detection defense system, while the combination of DCA with other adaptive immune algorithms is to be further investigated.