Transformer-Based IDS for CAN Bus Security
Transformer-Based IDS for CAN Bus Security
ABSTRACT Despite the significant advantages of communication systems between electronic control units,
the controller area network (CAN) protocol is vulnerable to attacks owing to its weak security structure. The
persistent development of intrusion detection systems (IDS) is geared toward preventing vehicles from being
targeted by malicious attacks. Recurrent neural networks (RNNs) have emerged as a prominent approach
in this domain, contributing significantly to the evolution of IDS. Nonetheless, RNN-based methods have
certain limitations in step-by-step processing. Their feature extraction at any given point in time only relies
on the hidden state of previously observed information, possibly resulting in missing features in the context
vector. In this paper, we propose a novel multi-class IDS using a transformer-based attention network
(TAN) for an in-vehicle CAN bus. Our model builds on the self-attention mechanism, removing RNNs and
classifying attacks into multiple categories. Furthermore, the proposed models can detect replay attacks by
aggregating sequential CAN IDs. The experimental results indicate that the TAN is more efficient than the
baselines for different input data types and datasets. The highlight is that, although sequential CAN IDs are
used, our model can identify intrusion messages without requiring message labeling. Finally, by inheriting
the advantages of transformers, TAN employs transfer learning to improve the performance of models trained
on small data from other car models.
INDEX TERMS CAN, intrusion detection system, multi-class classification, replay attacks, self-attention,
transformer.
I. INTRODUCTION work (IVN) is the controller area network (CAN). The CAN
Due to recent developments in the field of intelligent vehi- exhibits many advantages over other networks, including the
cles, modern cars can provide drivers with an excellent local interconnected network (LIN) and FlexRay, owing to
experience. However, rapidly evolving utilities and functions its high speed and efficiency. In addition to serving as an
require expanding car control systems [1]. Electronic control IVN, the CAN has been effectively employed in numerous
units (ECUs), which serve as building blocks for complex industrial applications, including aircraft, railways, and X-ray
in-vehicle systems, regulate the message broadcast network machines [3]. However, owing to its efficiency and simple
to ensure smooth operation between components such as design, the CAN bus is vulnerable to cyberattacks because
the throttle, brake, engine, and steering wheel [2]. The units intruders can easily influence physical subsystems. For exam-
transmit control signals through networks by using a network ple, an attacker can inject harmful messages directly through
protocol. The most extensively implemented in-vehicle net- physical onboard diagnostic (OBD-II) ports or access the
network remotely using telematics services [4].
The associate editor coordinating the review of this manuscript and Many manual approaches, such as certification, scan-
approving it for publication was Vicente Alarcon-Aquino . ners, access control, and firewalls, have been proposed to
B. ATTACK MODELS
FIGURE 4. Fuzzy attack.
The lack of network segmentation, authenticity, and
data encryption represents a fundamental vulnerability of
in-vehicle CAN [11]. Lee et al. [12] and Song et al. [13]
demonstrated that ECU nodes do not consider the sources
of CAN messages. Consequently, cyber-attackers can easily
carry out common network attacks on the CAN bus. The
attack scenarios considered in this study are introduced in
this section and depicted in Figs. 3–6.
FIGURE 5. Spoofing attack.
1) FLOOD ATTACK
Common (denial-of-service) DoS attacks. The flood attack
method involves submitting a large number of valid requests
that exceed the CAN bus processing capabilities. The attacker
intends to exhaust the system resources and paralyze the
functions.
2) FUZZY ATTACK
FIGURE 6. Replay attack.
The attacker repeatedly injected the CAN bus by using ran-
dom messages. To disrupt the vehicle’s functions, the attacker
examines in-vehicle information CAN packets and selects the
There are two design criteria for the CAN message format:
target CAN IDs to cause unexpected activity.
a standard frame (CAN 2.0A) and an extended frame (CAN
2.0B). Fig. 2 illustrates the general architecture of a CAN
frame. The following functional descriptions were applied to 3) SPOOFING ATTACK
the constituent fields: This is also known as a malfunction (Mal) attack. During
SOF (start of the frame field). The dominant bit repre- a spoofing attack, the intruder uses the CAN IDs obtained
sents the synchronization and the start of the frame. to target the specific subsystem functions in the vehicle.
CAN ID (arbitration field). Identification and frame pri- Abnormal messages are generated by gradually changing the
ority for arbitration. payload.
RTR (remote transmission request). The identity bit
indicates whether the frame is remote or a data frame. 4) REPLAY ATTACK
IDE (identifier extension). The bit identifies the CAN An attacker captures a legitimate message and injects it
frame type. A dominant bit defines the 11-bit standard, randomly into the CAN bus. These abnormal messages
whereas a recessive bit defines the 29-bit extended frame. force vehicles to repeat actions with potentially dangerous
DLC (data length code). The size of the DLC ranged results. These attacks are difficult to detect without examining
from 0 to 8 bits, indicating the byte length of the data field. sequential patterns in the CAN.
Data field. The 64-bit payload is responsible for commu-
nication between ECUs. III. RELATED WORK
CRC (cyclic redundancy check field). 16 control the data An IDS is a network security technology built to detect signs
checksum. of suspicious presence and generate alerts when cybersecurity
threats are discovered [9]. Because CAN lacks built-in secu- as evaluated using their dataset. They also demonstrated that
rity features, the in-vehicle network system utilizes an IDS to an LSTM-based IDS is more efficient for in-vehicle intrusion
monitor malicious activities between the CAN and external detection than a survival analysis method [18]. Khan et al.
interfaces. Many approaches have been developed to identify developed a multi-stage deep learning framework which com-
intrusions on the CAN buses. bines normal state-based and a bidirectional LSTM archi-
According to its design, Wu et al. categorized in-vehicle tecture [19]. Their outcomes indicated that the framework
network IDS a fingerprints-based (bus level), parameter- outperforms a variety of current state-of-the-art systems and
monitoring-based (message level), information-theoretic- can detect zero-day outbreaks from Internet of Vehicles
based (data-flow level), and machine-learning-based networks. In another periodicity-based study, Song et al.
(functional level) [14]. Machine learning and deep learning developed a CNN-based IDS to extract spatial features from
represent the primary approaches in the research field of 29 sequential CAN ID data frames [4]. Furthermore, their
in-vehicle network IDS. With outstanding advantages in model was optimized to minimize unnecessary components
learning data behaviors, machine- and deep-learning-based in the inception-resnet architecture. In another approach,
IDS are capable of defending against unidentified attacks Hoang et al. presented a semi-supervised learning method
within the CAN bus through input data analysis. using convolutional adversarial autoencoders (CAAE) [20].
In terms of data mining, Sun et al. categorized intrusion Their methodology leveraged the autoencoder mechanism
detection algorithms into three groups: semantic-based, data for unsupervised training, followed by supervised fine-tuning
domain-based, and periodicity-based [10]. with partial data to enhance the precision of the model. Their
Semantic-based methods attempt to analyze the semantics lightweight model achieved a high performance within a 40%
of CAN messages. Wasicek et al. developed a context-aware dataset compared to the baseline model.
IDS to classify cyber threats in in-vehicle network sys- Other studies have attempted to combine the spatial and
tems [15]. Their approach exploits the information obtained temporal features [5], [21]. Lo et al. used a convolutional neu-
by an existing sensor to improve the precision of an IDS ral network (CNN) and LSTM to learn representative features
by using an ANN. The report showed that semantic-based from CAN traffic [5]. The author performed binary classifica-
methods, such as chip tuning, can unveil anomalous manip- tion to demonstrate that the hybrid deep learning-based IDS
ulations. In another approach, a data-domain-based IDS successfully recognized suspicious behaviors in the CAN
addresses the vulnerability of CAN by exploiting the regu- bus. The results on the Car Hacking Dataset [4] showed that
larity of CAN IDs. Based on RNN algorithms, these meth- their method outperformed other related works.
ods predict the next bit or package. For instance, Qin et al. CNN-LSTM achieved SOTA performance in the binary
suggested long short-term memory (LSTM) to forecast CAN classification of the CAN bus. However, this approach does
messages in two data formats [16] and compared several loss not consider the natural sequential CAN IDs. These short-
functions for time-series prediction to achieve optimal results. comings can be exploited for replay attack scenarios in which
Similarly, periodicity-based IDS use sequential patterns of the attacker utilizes injected malicious messages extracted
CAN messages to identify malicious sequences in data traffic. from the CAN bus.
Hossain et al. proposed an LSTM-based IDS that learns the Research related to transfer learning has also been applied
temporal features from multivariate time-series CAN traf- to periodicity-based models such as LSTM. Kang et al.
fic [17]. The overall accuracy of this approach was 99.995% deployed LSTM-based transfer learning for in-vehicle CAN
and evaluated it using a survival dataset [22]. Their report most studies have ignored that recurrent neural network
indicated that the performance of a model trained on a small (RNN) algorithms incur vanishing and exploding gradient
dataset can be improved significantly. The transfer learning problems [25].
approach related to vehicle intrusion detection systems has With advancements in computer processing capabilities,
yielded promising results. Tariq et al. used transfer learning various recent research studies have proposed utilizing
combined with CNN-LSTM to demonstrate the ability to self-attention mechanisms to tackle the limitations of RNNs.
transfer knowledge from large to small datasets [23]. Through Nam et al. deployed bidirectional GPT for an in-vehicle
one-shot learning, CNN-LSTM transfer learning achieved a IDS [26]. The author performed binary classifications to
performance improvement of 26.06% over the baselines. demonstrate that their model could detect the anomalous
In addition to the spectral and temporal features, sev- segment in the case of an extremely sparsely attacked CAN
eral recent studies have considered the correlation between ID. However, the authors did not provide any comparisons
each element in CAN traffic. Wei et al. proposed an intru- regarding the time inference. Moreover, the limitation of their
sion detection model based on an attention mechanism and work is discussed, as the model can only detect malicious
autoencoder [24]. They applied an encoder and decoder to message segments without identifying injected CAN IDs.
represent the potential features of the CAN messages. The Wu et al. introduced a robust transformer-based approach
attention layer then learns the importance of the extracted for IDS on network traffic [27]. According to their report,
hidden features and feeds them into the classification layer their model outperforms support vector machine and deep
to calculate the prediction result. According to their exper- learning algorithms, including RNN, on both individual
imental results, a hybrid of an autoencoder and an atten- attack types and multi-class datasets in terms of efficiency.
tion mechanism is highly promising for the OTIDS dataset. Their model had a longer training time than other mod-
Other methodologies based on the attention mechanism have els, and comparisons of inference time were not presented.
investigated the selection of points of significance in a target In another study, Sharma et al. approach transformer model
from hidden features. Sun et al. proposed a CNN-LSTM and by using CNN for embeding layer [28]. The results show
attention model using bit flip rate preprocessing [10] and that using CNN can improve model performance in pre-
demonstrated the model’s robustness and reliability for intru- dicting driver intent. Our study focus on developing an
sion detection systems. They also discussed the shortcomings intrusion detection system based on the transformer architec-
and future research directions to improve their performance. ture for in-vehicle CAN bus. Table 1 presents several compar-
The attention mechanism was combined with other algo- isons between our proposed method and previous CAN IDS
rithms to preserve useful features in data traffic. However, studies.
WO ∈ Rhdv ×dm
5: Updating θC by optimizing Lcross_entropy
6: Updating [α0 , . . . , αw ] by Multihead(Q, K, V)
FIGURE 8. Architecture of transformer-based attention network.
7: end for
IV. METHODOLOGY
The following section proposes a novel multi-class IDS using
a transformer-based attention network for an in-vehicle CAN
bus. Our proposed IDS comprises the two models shown in
Fig. 7: an IDS using only a single message and an IDS using
sequential CAN IDs. Note that the first model detects DoS,
fuzzy, and spoofing attacks better than SOTA RNN-based
IDS [5]. However, it cannot detect replay attacks because
it uses only a single message. Accordingly, we designed a FIGURE 9. Single message preprocessing.
second model to detect replay attacks by using sequential
CAN IDs.
identity mappings to the input layer. These mappings are
A. OVERALL ARCHITECTUTE then added to the output layer. Context vectors are generated
For a comprehensive evaluation, the proposed system (Fig. 7) at the end of the encoding phase. To mitigate overfitting
consists of two components corresponding to different data during training, we employed a technique that dropout lay-
types: a single message and sequential CAN IDs. ers with 0.15 rate are interleaved with normalization layers.
In the single-message component, we fed the preprocessed Subsequently, selective information is fed to a simple neural
data into a classification model based on the transformer network such as feed-forwarding layers. The output of the
architecture. The two primary components of a transformer multi-class classifier was a linear layer that performed prob-
are the encoder and decoder [29]. The encoder is the most abilistic predictions for each class. The probabilities are fed
essential component for classification. As shown in Fig. 8, into a softmax function, and the class with the highest return
to remove recursion and convolution, the transformer-based value results from classification.
attention network must embed positional encoding to mark For sequential CAN IDs, we performed data processing
the arrangement of the tokens in the input. The combina- using only the identified fields. Packets containing sequential
tion of input and positional encoding enables the model to CAN IDs are fed into the classification model. We use the
obtain sequence features. After adding positional informa- same model as that used in the single-message approach.
tion, the self-attention algorithm calculates the correlation Unlike single-message inputs, the components in sequen-
between tokens in a single message. To maintain propaga- tial CAN IDs represent identifiers. The use of sequential CAN
tion of signals, we used residual connections that perform IDs overcomes the repeated intrusions extracted from the
1: for j P from 0 to (b − w) do
2: if i=0 w yi = 0 then Yj = 0
3: else
FIGURE 10. Sequential CAN ID preprocessing.
4: for i = 0 to w do
5: if yi ̸ = 0 then Yj = yi
6: end for
we use sliding windows to generate sequential CAN IDs,
enabling the detection of anomalies at the segment level.
In a single message, we use the arbitration field, data length
code, and data payload (Fig. 9). All identifications and values
CAN bus. Consider the example of an accepted CAN message in the data field were converted from hexadecimal to decimal
with a brake signal. The attacker can extract these messages formats. Each data field value is a byte (8 bits) in size and
from the CAN and inject them into an in-vehicle network. is assigned a value from 0 to 255. To maintain a uniform
The single-message IDS then accepts intrusive brake signals data length, we assigned null values of 256. However, the
as safety messages, posing a danger to the driver. The training actual length of the message is still the specified by the DLC.
process for the sequential CAN IDs data type is summarized We then define 0 and 1 as normal and anomalous messages,
in Algorithm 1. respectively [5].
The use of a single-message input can identify malicious For sequential CAN IDs, we considered only sequential
messages in the CAN bus, whereas sequential CAN IDs can patterns on the CAN bus. As shown in Fig. 10, CAN IDs
only detect anomalous segments. To identify malicious mes- were similarly converted into numeric forms. In each mes-
sages in sequential CAN IDs, we extracted attention scores. sage, the T and R tags represent an anomaly and a normal
Following classification, these scores highlight malicious message, respectively. We assume that only one attack type
messages in the segment. occurs in each segment and consider continuous CAN IDs as
The transformer is well-known for its transfer learning time-series data for each time step. A sliding window divides
capabilities in language processing, image classification, and all identifications in the dataset among the data segments and
audio classification tasks [30], [31], [32]. In this study, uses them as the input data. Suppose that, for a dataset with
we considered the feasibility of using a pre-trained model to n records, the input sequence at the ith time window is
improve the performance of limited data. The transfer learn-
ing technique can provide knowledge trained on a model with Xi = [xi1 , xi2 , . . . , xiw ], i ≤ (n − w) (1)
extensive data from one car to a model with less data from
another car. We applied the same data processing method to where w is the window size and xit represents the identifier of
the target dataset. The target and source data were trained the CAN message at time t. The label generation process is
using the same model. For multi-class classification, the out- presented in Algorithm 2.
put layer can be adjusted to fit the target data.
C. IDENTIFICATION FOR EACH MALICIOUS MESSAGE
B. PREPROCESSING DATA As previously mentioned, the self-attention mechanism rep-
The quality of data has a significant impact on the quality of resents the core of the transformer model. That is, self-
training. Because machine learning methods cannot directly attention is the most significant development step that
use the raw data extracted from the vehicle, preprocessing differentiates transformers from traditional recurrent neu-
must be applied to convert the data into a suitable type. ral networks, such as RNNs and LSTM. Because the
We removed redundant values, filled in null values, and self-attention mechanism assigns higher weights to important
transformed the data into a standardized form to ensure data information, we assume divergence between the attention
usability. We consider two critical data types: single messages scores of normal and abnormal messages in each CAN ID
and sequential CAN IDs. Although single-message intrusion segment. We extracted the attention scores to demonstrate
detection approaches yield high performance [5], they present the ability to identify malicious IDs. We used the multi-head
a vulnerability if the attacker injects replay messages that attention layer’s output to calculate the attention score and
were previously verified to be secure. To address this issue, exploit it for message intrusion identification.
The underlying concept of the self-attention mechanism is TABLE 2. Car hacking dataset statistics.
to map a set of query and key-value vector pairs to an out-
put vector. Similar to the attention mechanism, self-attention
receives (Q, K , V ) as the input, where Q, K , and V are the
query, key, and value matrices, respectively. (Q, K , V ) is sep-
arated into sub-space representations, also known as heads,
in which each attention weight is focused on a different head
in parallel. Because of parallel computation, we concatenated
the heads’ individual results to obtain the final attention TABLE 3. INV intrusion detection dataset statistics.
weights. Therefore, the multi-head self-attention function can
be expressed as follows:
Q
headi = Attention(QWi , KWiK , VWiV ) (2)
Multihead(Q, K , V ) = Concat(head1 , . . . , headn )WO (3)
where WO ∈ Rhdv ×dm are the output parameter matrices, dv
is a dimension of value matrices, dm is a dimension of the
model. TABLE 4. Survival analysis dataset statistics.
Instead of allowing the output to attend to important fea-
tures of the input, the self-attention mechanism allows input
tokens to interact with each other. The query and key are iden-
tical in the self-attention mechanism [29]. Assume that the
CAN input is X = [x1 , x2 , . . . , xn ], with dm
ntokens, xi ∈d R×d .
The initialized trainable parameters WQ , WK ∈ R m k,
TABLE 6. Comparison with other models on single-message data. TABLE 8. Comparison on sequential data with a window size of 32.
TABLE 10. Comparison on sequential data with a window size of 128. model with a more comprehensive view of the abnormality
in the CAN bus. Our experiment started with data from Car
Hacking dataset.
2) SEQUENTIAL CAN ID
As mentioned above, the model performance is significantly
affected by hyperparameters. Therefore, we evaluate the per-
formance for window sizes ranging from 16 to 256. Each
sequential input was labeled as normal or abnormal, with the
output being a multi-class classification value. The super-
vised learning process continuously updates the weights in
the model to recognize the sequence of CAN IDs in the time
domain. The results presented in Tables 7 and 11 indicate that
the transformer model easily outperforms the baselines, par-
ticularly in fuzzy attack scenarios. Furthermore, an increase
in the window size from 16 to 128 helped all models extract
more features from sequential CAN IDs, thereby improv-
ing the classification results. Our model classified abnor-
mal intrusions almost perfectly in the DoS dataset for every
TABLE 11. Comparison on sequential data with a window size of 256. window size. The reason is that the attacker is forced to
use a high-priority message – CAN ID 0x000 – for this
attack, making it easy for the system to detect intrusions.
The results for the spoofing attack dataset showed ERs of
less than 1 when the window size exceeded 32. In particular,
in the fuzzy dataset, the F1 score of CNN-LSTM increased
from 0.71820 to 0.99496, whereas our model improved from
0.99985 to 0.99993, with a gradual increase in the input
data length. Thus, the proposed model yields better extracted
information from longer sequential CAN IDs, thereby achiev-
ing better results for larger window sizes. Our results indicate
that most F1 scores decreased as the CAN ID chain length
increased from 128 to 256, as the baselines experienced bot-
tlenecks when the window size increased significantly. Our
model also achieved the lowest ER values for most attack
types compared to the other models. As shown in Table 10,
the error rates of the baseline models were greater than 5%,
and the error rates of the Transformer model for the DoS,
Fuzzy, Gear and RPM Spoofing datasets were 0.0%, 0.001%,
0.112%, and 0.009%, respectively. We also presented ROC
curves with AUC values of the proposed model and baseline
models in Fig. 12 in order to compare the overall performance
between models with a window size of 128. The results indi-
cate that our model improves safety by detecting the majority
of intrusions and minimizing false alarms.
TABLE 12. Comparison the proposed model and CNN-LSTM on replay attack dataset.
FIGURE 13. Confusion matrices of CNN-LSTM, replay attack dataset, KIA FIGURE 16. Confusion matrices of transformer, replay attack dataset,
soul, using sequential CAN ID (a) and single message (b). Hyundai Sonata, using sequential CAN ID (a) and single message (b).
TABLE 13. F1 scores of intrusion identification with 16 CAN IDs on Car TABLE 14. Comparison of transfer learning on KIA soul.
Hacking dataset.
TABLE 15. Comparison of transfer learning on Chevrolet Spark. IDs, extracts information more selectively, and outperforms
other excellent methods in our evaluations. Various experi-
ments were conducted to demonstrate the advantages of the
proposed model. With a single-message input, our model
achieved perfect results on the car-hacking dataset, with an F1
score of 1.00, and error rates of approximately 0% for all four
attack scenarios. In particular, our model yielded a superior
performance when evaluated using sequential data. Although
the transformer requires a longer inference time with the
same input length, the result of our model with 16 sequential
CAN IDs still outperforms that of others. We found that
the proposed model can provide better results on the replay
attack dataset than CNN-LSTM, which yields SOTA intru-
sion detection performance for CAN buses. We employed
the self-attention mechanism to identify intrusive messages in
CAN segments without requiring message level labeled data
TABLE 16. Comparison of model complexity.
in the training phase. The results of our experiment support
the safe maintenance of vehicle operations following attacks.
Furthermore, we presented an application of transfer learning
to our model. The results show that the transformer can share
knowledge from the source model with the target model to
improve intrusion detection. A limitation of our study lies
in the fact that we experimented with an extracted dataset.
Classification becomes more difficult when the model is
baseline models. Previous experiments in [4] have shown applied to vehicles operating in a real-time environment.
that reducing the batch size can optimize the inference time, The direction of our future development will be unknown
thereby minimizing the overall detection latency of IDS. attack detection in real-life attack scenarios. Finally, using the
Therefore, we evaluated the performance of the model using sliding window results in the appearance of many malicious
a batch size of 1. That is, we evaluate the processing time messages in single data segments. This complication can be
required by the model to handle given input data (s/batch). resolved using multi-label multi-class classification methods
The results of the time costs analysis are listed in Table 16. in the future.
In accordance with the J1939 standards [37], the Society of
Automotive Engineers (SAE) recommends a signaling rate REFERENCES
of 250kb/s for the CAN bus, despite its maximum capacity [1] G. Leen and D. Heffernan, ‘‘Expanding automotive electronic systems,’’
of 1 Mb/s [37]. At this recommended rate, the CAN bus can Computer, vol. 35, no. 1, pp. 88–93, 2002.
[2] N. A. Stanton, M. Young, and B. McCaulder, ‘‘Drive-by-wire: The case of
transmit up to 1908 CAN frames per second. Regarding the driver workload and reclaiming control with adaptive cruise control,’’ Saf.
CPU, the proposed model was capable of processing more Sci., vol. 27, nos. 2–3, pp. 149–159, Nov. 1997.
than 10,000 messages and making approximately 85 predic- [3] B. Galloway and G. P. Hancke, ‘‘Introduction to industrial control net-
works,’’ IEEE Commun. Surveys Tuts., vol. 15, no. 2, pp. 860–880,
tions per second, given an inference time of 11.6 ms/batch. 2nd Quart., 2013.
Compared to the ability to process 4,300 messages per second [4] H. M. Song, J. Woo, and H. K. Kim, ‘‘In-vehicle network intrusion detec-
by performing 150 inferences on DCNN [4], despite having a tion using deep convolutional neural network,’’ Veh. Commun., vol. 21,
Jan. 2020, Art. no. 100198.
longer inference time with a larger window size, our proposed
[5] W. Lo, H. Alqahtani, K. Thakur, A. Almadhor, S. Chander, and G. Kumar,
model is capable of processing more messages per second. ‘‘A hybrid deep learning based intrusion detection system using spatial–
A comparison shows that the proposed model is suitable for temporal representation of in-vehicle network traffic,’’ Veh. Commun.,
vol. 35, Jun. 2022, Art. no. 100471.
real-time detection.
[6] Bosch, Robert Bosch GmbH, Gerlingen, Germany, 1991.
[7] M. Farsi, M. Barbosa, and K. Ratcliff, ‘‘An overview of controller area
VI. CONCLUSION AND FUTURE WORK network,’’ Comput. Control Eng. J., vol. 10, no. 3, pp. 113–120, Jun. 1999.
[8] R. De Andrade, K. N. Hodel, J. F. Justo, A. M. Laganá, M. M. Santos, and
In this paper, we proposed a transformer-based attention Z. Gu, ‘‘Analytical and experimental performance evaluations of CAN-FD
network as an intrusion detection system for CAN buses bus,’’ IEEE Access, vol. 6, pp. 21287–21295, 2018.
in an in-vehicle environment. This study aimed to present [9] H. J. Jo and W. Choi, ‘‘A survey of attacks on controller area networks and
a novel approach for better intrusion detection that can corresponding countermeasures,’’ IEEE Trans. Intell. Transp. Syst., vol. 23,
no. 7, pp. 6123–6141, Jul. 2022.
take over the role of RNNs. The core of the proposed [10] H. Sun, M. Chen, J. Weng, Z. Liu, and G. Geng, ‘‘Anomaly detection for
approach is a self-attention mechanism. Taking advantage in-vehicle network using CNN-LSTM with attention mechanism,’’ IEEE
of the correlations between the components in CAN data, Trans. Veh. Technol., vol. 70, no. 10, pp. 10880–10893, Oct. 2021.
[11] R. Buttigieg, M. Farrugia, and C. Meli, ‘‘Security issues in controller area
the transformer-based model offers powerful feature extrac- networks in automobiles,’’ in Proc. 18th Int. Conf. Sci. Techn. Autom.
tion capabilities, performs well on longer sequential CAN Control Comput. Eng. (STA), Dec. 2017, pp. 93–98.
[12] H. Lee, S. H. Jeong, and H. K. Kim, ‘‘OTIDS: A novel intrusion detection [35] T.-N. Hoang and D. Kim, ‘‘Supervised contrastive ResNet and trans-
system for in-vehicle network by using remote frame,’’ in Proc. 15th Annu. fer learning for the in-vehicle intrusion detection system,’’ 2022,
Conf. Privacy, Secur. Trust (PST), Aug. 2017, p. 5709. arXiv:2207.10814.
[13] H. M. Song, H. R. Kim, and H. K. Kim, ‘‘Intrusion detection system based [36] The In-Vehicle Network Intrusion Detection Dataset of Information Secu-
on the analysis of time intervals of CAN messages for in-vehicle network,’’ rity R&D Data Challenge, Hacking Countermeasure Res. Lab, Korea
in Proc. Int. Conf. Inf. Netw. (ICOIN), Jan. 2016, pp. 63–68. Univ., Seoul, South Korea, 2019.
[14] W. Wu, R. Li, G. Xie, J. An, Y. Bai, J. Zhou, and K. Li, ‘‘A survey of [37] J1939 Recommended Practice for a Serial Control and Communications
intrusion detection for in-vehicle networks,’’ IEEE Trans. Intell. Transp. Vehicle Network, SAE Int., Warrendale, PA, USA, 2013.
Syst., vol. 21, no. 3, pp. 919–933, Mar. 2020.
[15] A. Wasicek, M. D. Pese, A. Weimerskirch, Y. Burakova, and K. Singh,
‘‘Context-aware intrusion detection in automotive control systems,’’ in
Proc. 5th ESCAR USA Conf., 2017, pp. 21–22.
[16] H. Qin, M. Yan, and H. Ji, ‘‘Application of controller area network (CAN)
bus anomaly detection based on time series prediction,’’ Veh. Commun., TRIEU PHONG NGUYEN received the B.S.
vol. 27, Jan. 2021, Art. no. 100291. degree in control engineering and automation
[17] M. D. Hossain, H. Inoue, H. Ochiai, D. Fall, and Y. Kadobayashi, ‘‘LSTM- system from the Ho Chi Minh City University
based intrusion detection system for in-vehicle can bus communications,’’ of Transport (UT-HCMC), Vietnam, in 2021.
IEEE Access, vol. 8, pp. 185489–185502, 2020. He is currently pursuing the M.S. degree with
[18] M. L. Han, B. I. Kwak, and H. K. Kim, ‘‘Anomaly intrusion detection the Department of Mobility Convergence Security
method for vehicular networks based on survival analysis,’’ Veh. Commun., in Engineering, Soonchunhyang University, Asan,
vol. 14, pp. 52–63, Oct. 2018.
South Korea. From January 2020 to January 2021,
[19] I. A. Khan, N. Moustafa, D. Pi, W. Haider, B. Li, and A. Jolfaei, he was an Assistant Researcher with the Artificial
‘‘An enhanced multi-stage deep learning framework for detecting mali-
Intelligence Laboratory, Graduate Institute,
cious activities from autonomous vehicles,’’ IEEE Trans. Intell. Transp.
UT-HCMC. From February 2021 to January 2022, he was an Artificial
Syst., vol. 23, no. 12, pp. 25469–25478, Dec. 2022.
Intelligence Engineer with Heligate Japan Software Company, Vietnam. His
[20] T.-N. Hoang and D. Kim, ‘‘Detecting in-vehicle intrusion via semi-
research interest includes deep learning, the Internet of Things, and security
supervised learning-based convolutional adversarial autoencoders,’’ Veh.
Commun., vol. 38, Dec. 2022, Art. no. 100520. networks.
[21] A. K. Desta, S. Ohira, I. Arai, and K. Fujikawa, ‘‘Rec-CNN: In-vehicle
networks intrusion detection using convolutional neural networks trained
on recurrence plots,’’ Veh. Commun., vol. 35, Jun. 2022, Art. no. 100470.
[22] L. Kang and H. Shen, ‘‘A transfer learning based abnormal CAN bus
message detection system,’’ in Proc. IEEE 18th Int. Conf. Mobile Ad Hoc
Smart Syst. (MASS), Oct. 2021, pp. 545–553. HEUNGWOO NAM (Member, IEEE) received
[23] S. Tariq, S. Lee, and S. S. Woo, ‘‘CANTransfer: Transfer learning based the B.S. degree in computer science and engi-
intrusion detection on a controller area network using convolutional LSTM neering from Kyung Hee University, South Korea,
network,’’ in Proc. 35th Annu. ACM Symp. Appl. Comput., Mar. 2020, in 2002, and the M.S. degree in computer science
pp. 1048–1055. and engineering and the Ph.D. degree in electron-
[24] P. Wei, B. Wang, X. Dai, L. Li, and F. He, ‘‘A novel intrusion detection ics and computer engineering from Korea Univer-
model for the CAN bus packet of in-vehicle network based on atten- sity, South Korea, in 2005 and 2010, respectively.
tion mechanism and autoencoder,’’ Digit. Commun. Netw., vol. 9, no. 1, From September 2010 to May 2015, he was a
pp. 14–21, Feb. 2023. Research Professor with Korea University. From
[25] S. Hochreiter and J. Schmidhuber, ‘‘Long short-term memory,’’ Neural May 2015 to December 2017, he was a Visiting
Comput., vol. 9, no. 8, pp. 1735–1780, 1997. Researcher with the Scripps Institution of Oceanography (SIO), University
[26] M. Nam, S. Park, and D. S. Kim, ‘‘Intrusion detection method using bi- of California, San Diego (UCSD). From December 2017 to August 2020,
directional GPT for in-vehicle controller area networks,’’ IEEE Access, he was a Research Professor with the Smart Submerged Floating Tunnel
vol. 9, pp. 124931–124944, 2021. System Research Center, KAIST. Since September 2020, he has been an
[27] Z. Wu, H. Zhang, P. Wang, and Z. Sun, ‘‘RTIDS: A robust transformer- Assistant Professor with the Department of Computer Engineering, Daegu
based approach for intrusion detection system,’’ IEEE Access, vol. 10, University. His research interests include communication networks and pro-
pp. 64375–64387, 2022. tocols, underwater acoustic communication systems, autonomous underwa-
[28] O. Sharma, N. C. Sahoo, and N. B. Puhan, ‘‘Kernelized convolutional ter vehicles, wireless and underwater sensor networks, and structural health
transformer network based driver behavior estimation for conflict res- monitoring.
olution at unsignalized roundabout,’’ ISA Trans., vol. 133, pp. 13–28,
Feb. 2023.
[29] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez,
and I. Polosukhin, ‘‘Attention is all you need,’’ in Proc. Adv. Neural Inf.
Process. Syst., vol. 30, 2017, pp. 1–11.
[30] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, ‘‘BERT: Pre-training
DAEHEE KIM (Member, IEEE) received the
of deep bidirectional transformers for language understanding,’’ 2018,
arXiv:1810.04805. B.S. degree in electrical and electronic engineer-
[31] B. Han, Z. Chen, and Y. Qian, ‘‘Local information modeling with self- ing from Yonsei University, Seoul, South Korea,
attention for speaker verification,’’ in Proc. IEEE Int. Conf. Acoust., Speech in 2003, and the M.S. and Ph.D. degrees in electri-
Signal Process. (ICASSP), May 2022, pp. 6727–6731. cal and electronic engineering from Korea Univer-
[32] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, sity, Seoul, in 2006 and 2016, respectively.
T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszko- From 2006 to 2016, he was a Senior Engineer
reit, and N. Houlsby, ‘‘An image is worth 16×16 words: Transformers for with Samsung Electronics, Suwon, South Korea,
image recognition at scale,’’ 2020, arXiv:2010.11929. where he conducted research on WiMAX and LTE
[33] S. J. Pan and Q. Yang, ‘‘A survey on transfer learning,’’ IEEE Trans. Knowl. systems. He is currently an Assistant Professor
Data Eng., vol. 22, no. 10, pp. 1345–1359, Oct. 2010. with the Department of Internet of Things, Soonchunhyang University, Asan,
[34] F. Zhuang, Z. Qi, K. Duan, D. Xi, Y. Zhu, H. Zhu, H. Xiong, and Q. He, South Korea. His research interest includes the Internet of Things, energy
‘‘A comprehensive survey on transfer learning,’’ Proc. IEEE, vol. 109, management, blockchain, 5G/6G, and security for wireless networks.
no. 1, pp. 43–76, Jan. 2021.