Detecting Malicious Anomalies in Heavy-Duty Vehicular Networks Using Long Short-Term Memory Models
Abstract
1. Introduction
2. Background
2.1. CAN Message Format
2.2. SAE J1939 Message Format
2.3. Deep Learning Approach to Detecting Anomalies
2.4. Performance Evaluation—Measure of Effectiveness
- True positive (tp): detector identifies an anomaly correctly;
- False positive (fp): detector incorrectly labels benign traffic as anomalous;
- True negative (tn): detector identifies benign traffic correctly; and
- False negative (fn): detector incorrectly labels anomalous traffic as benign.
2.5. Performance Evaluation—Measure of Efficiency
3. Intrusion Detection System Architecture
3.1. J1939 Data Selection
3.2. Long Short-Term Memory Neural Network Models
3.3. LSTM Architecture and Hyper-Parameter Optimization
3.4. Simulated J1939 Anomalies
3.5. Replay Attacks
3.6. Field Modification Attacks
3.7. Anomaly-Based Detection Architecture
4. Experimental Results
4.1. Data Sequence Breakdown
4.2. Overall AUC Performance
4.3. Model Performance Metrics
4.4. Results Breakdown by Attack Type
5. Discussion
5.1. Contributions
5.2. Future Work
- Reproduce experiments with larger datasets and utilize real attack data along with diverse types of attacks and compare results;
- Group related SPNs into one LSTM model to yield the potential for better results;
- Reconfigure IDS to allow deployment on a physical platform for real-time detection;
- Recreate experiments where LSTM models are trained based on the optimization of the hyper-parameters for every model ID.
5.3. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
AD | Anomaly Detector |
AUC | Area Under Curve |
CAN | Controller Area Network |
DoS | Denial-of-Service |
DRDC | Defence Research and Development Centre |
ECU | Electronic Control Unit |
EV | Electric Vehicle |
HLP | Higher Layer Protocol |
IDS | Intrusion Detection System |
IPS | Intrusion Prevention System |
LSTM | Long Short-Term Memory |
PG | Parameter Group |
PGN | Parameter Group Number |
RNN | Recurrent Neural Network |
ROC | Receiving Operating Characteristic |
SAEs | Society of Automotive Engineers |
SPNs | Suspect Parameter Numbers |
References
- Palandrani, P. A Decade of Change: How Tech Evolved in the 2010s and What’s in Store for the 2020s. Global X ETFs NASDAQ. Available online: https://www.nasdaq.com/articles/a-decade-of-change%3A-how-tech-evolved-in-the-2010s-and-whats-in-store-for-the-2020s#:~:text=What%20changed?,s%20to%2015%20Mbit/s.&text=For%20perspective%2C%20this%20reduced%20the,media%2C%20all%20on%20the%20go.&text=Then%20and%20now%20stat:%20Daily,to%20132%20minutes%20in%202019 (accessed on 4 March 2025).
- Bosch, R. CAN Specification, Version 2.0; Bosch Gmbh: Gerlingen-Schillerhöhe, Germany, 1991; p. 72.
- Valasek, C.; Miller, C. A Survey of Remote Automotive Attack Surfaces; IOActive: Seattle, DC, USA, 2014; p. 90. [Google Scholar]
- J1939-71; Vehicle Application Layer. SAE International: Warrendale, PA, USA, 2010. Available online: https://www.sae.org/standards/content/j1939/71_201002/ (accessed on 10 June 2019).
- Lokman, S.-F.; Othman, A.T.; Abu-Bakar, M.-H. Intrusion Detection System for Automotive Controller Area Network (CAN) bus system: A review. EURASIP J. Wirel. Commun. Netw. 2019, 2019, 184. [Google Scholar] [CrossRef]
- Butler, M. An Intrusion Detection System for Heavy-Duty Truck Networks. In Proceedings of the International Conference on Cyber Warfare and Security, Dayton, OH, USA, 2–3 March 2017; pp. 399–406. [Google Scholar]
- Mukherjee, S.; Walkery, J.; Rayz, I.; Daily, J. A Precedence Graph-Based Approach to Detect Message Injection Attacks in J1939 Based Networks. In Proceedings of the 2017 15th Annual Conference on Privacy, Security and Trust (PST), Calgary, AB, Canada, 28–30 August 2017; pp. 67–6709. [Google Scholar] [CrossRef]
- Murvay, P.-S.; Groza, B. Security Shortcomings and Countermeasures for the SAE J1939 Commercial Vehicle Bus Protocol. IEEE. Trans. Veh. Technol. 2018, 67, 4325–4339. [Google Scholar] [CrossRef]
- Zachos, M. Securing J1939 Communications Using Strong Encryption with FIPS 140-2. In WCXTM 17: SAE World Congress Experience; SAE International: Warrendale, PA, USA, 2017. [Google Scholar] [CrossRef]
- Shirazi, H.; Ray, I.; Anderson, C. Using Machine Learning to Detect Anomalies in Embedded Networks in Heavy Vehicles. In Proceedings of the 12th International Symposium on Foundations & Practice of Security, Toulouse, France, 5–7 November 2019. [Google Scholar]
- Jichici, C.; Groza, B.; Ragobete, R.; Murvay, P.-S.; Andreica, T. Effective Intrusion Detection and Prevention for the Commercial Vehicle SAE J1939 CAN Bus. IEEE. Trans. Intell. Transp. Syst. 2022, 23, 17425–17439. [Google Scholar] [CrossRef]
- Mukherjee, S.; Chatterjee, R.; Daily, J. TruckSentry: Context Aware Intrusion Detection and Prevention System for J1939 Networks. IEEE. Open J. Intell. Transp. Syst. 2025, 6, 294–309. [Google Scholar] [CrossRef]
- Taylor, A.; Leblanc, S.; Japkowicz, N. Anomaly Detection in Automobile Control Network Data with Long Short-Term Memory Networks. In Proceedings of the 2016 IEEE International Conference on Data Science and Advanced Analytics (DSAA), Montreal, QC, Canada, 17–19 October 2016. [Google Scholar]
- Taylor, A.; Leblanc, S.; Japkowicz, N. Probing the Limits of Anomaly Detectors for Automobiles with a Cyberattack Framework. IEEE. Comput. Soc. 2018, 33, 54–62. [Google Scholar] [CrossRef]
- Artail, H.; Halabi, J. A Lightweight Synchronous Cryptographic Hash Chain Solution to Securing the Vehicle CAN bus. In Proceedings of the 2018 IEEE International Multidisciplinary Conference on Engineering Technology (IMCET), Beirut, Lebanon, 14–16 November 2018. [Google Scholar]
- Wang, Q.; Sawhney, S. VeCure: A Practical Security Framework to Protect the CAN Bus of Vehicles. In Proceedings of the 2014 International Conference on the Internet of Things (IOT), Cambridge, MA, USA, 6–8 October 2014. [Google Scholar]
- ISO 11898-1:2024; Road Vehicles—Controller Area Network (CAN)—Part 1: Data Link Layer and Physical Coding Sublayer. International Organization for Standardization: Geneva, Switzerland, 2024. Available online: https://www.iso.org/obp/ui/en/#iso:std:iso:11898:-1:ed-3:v1:en (accessed on 22 March 2019).
- Corrigan, S. Introduction to the Controller Area Network (CAN), Application Report SLOA101B; Texas Instruments Incorporated: Dallas, TX, USA, 2016. [Google Scholar]
- J1939-11; Physical Layer, 250 Kbps, Twisted Shielded Pair. SAE International: Warrendale, PA, USA, 2016. Available online: https://www.sae.org/standards/content/j1939/11_201612/ (accessed on 10 June 2019).
- Malhotra, P.; Vig, L.; Shroff, G.; Agarwal, P. Long Short Term Memory Networks for Anomaly Detection in Time Series. In Proceedings of the 23rd European Symposium on Artificial Neural Networks, ESANN 2015, Bruges, Belgium, 22–24 April 2015. [Google Scholar]
- Pandey, P. Simplifying the ROC and AUC Metrics; Towards Data Science: Toronto, ON, Canada, 2019; Available online: https://towardsdatascience.com/understanding-the-roc-and-auc-curves-a05b68550b69 (accessed on 26 October 2019).
- Bergstra, J.; Bengio, Y. Random Search for Hyper-Parameter Optimization. J. Mach. Learn. Res. 2012, 13, 281–305. [Google Scholar]
- Srivastava, N.; Hinton, G.; Krizhevsky, A.; Sutskever, I.; Salakhutdinov, R. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. J. Mach. Learn. Res. 2014, 15, 1929–1958. [Google Scholar]
- Géron, A. Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems; O’Reilly Media, Inc.: Sebastopol, CA, USA, 2019. [Google Scholar]
- Deep AI. What Is the F-Score? Available online: https://deepai.org/machine-learning-glossary-and-terms/f-score (accessed on 13 July 2020).
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V. Scikit-learn: Machine Learning in Python. J. Mach. Learn. Res. 2011, 12, 2825–2830. [Google Scholar]
- Burakova, Y.; Hass, B.; Millar, L.; Weimerskirch, A. Truck Hacking: An Experimental Analysis of the SAE J1939 Standard. In Proceedings of the 10th USENIX Workshop on Offensive Technologies (WOOT 16), Berkeley, CA, USA, 8–9 August 2016. [Google Scholar]
- Karpathy, A. The Unreasonable Effectiveness of Recurrent Neural Networks. Andrej Karpathy blog. 2015. Available online: http://karpathy.github.io/2015/05/21/rnn-effectiveness/ (accessed on 4 November 2019).
- Hochreiter, S.; Schmidhuber, J. Long Short-Term Memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef] [PubMed]
- Bengio, Y. Learning Deep Architectures for AI. Found. Trends® Mach. Learn. 2009, 2, 1–127. [Google Scholar] [CrossRef]
- Kingma, D.P.; Ba, J. Adam: A Method for Stochastic Optimization. arXiv 2014, arXiv:1412.6980. Available online: http://arxiv.org/abs/1412.6980 (accessed on 4 June 2020).
- Tensorflow, tf.keras.callbacks.EarlyStopping. Available online: https://www.tensorflow.org/api_docs/python/tf/keras/callbacks/EarlyStopping (accessed on 4 June 2020).
- Dariz, L.; Ruggeri, M.; Costantino, G.; Martinelli, F. A survey over low-level security issues in heavy duty vehicles. In Proceedings of the Automotive Cyber Security Conference (ESCAR), Berlin, Germany, 14–15 November 2016; pp. 1–7. [Google Scholar]
- Markovitz, M.; Wool, A. Field classification, modeling and anomaly detection in unknown CAN bus networks. Veh. Commun. 2017, 9, 43–52. [Google Scholar] [CrossRef]
- McKinney, W. Python for Data Analysis: Data Wrangling with Pandas, NumPy, and Jupyter, 3rd ed.; O’Reilly: Sebastopol, CA, USA, 2022. [Google Scholar]
- Supply Chain Cybersecurity: A Comprehensive Guide. National Motor Freight Traffic Association. Available online: https://nmfta.org/supply-chain-cybersecurity-a-guide/ (accessed on 18 March 2025).
PGN | # of Bits Changed | # of Packets | Unique Packets | Unique % |
---|---|---|---|---|
0×F002 | 34 | 2,080,170 | 1,224,093 | 58.85 |
0×F003 | 32 | 1,050,817 | 303,003 | 28.83 |
0×F004 | 49 | 1,050,819 | 684,908 | 65.18 |
0×F005 | 44 | 208,017 | 385 | 0.19 |
CAN Detectors | J1939 Detectors |
---|---|
PGN 0×F002 | SPN 191-Transmission Output Shaft Speed |
SPN 161-Transmission Input Shaft Speed | |
PGN 0×F003 | SPN 91-Accelerator Pedal Position 1 |
SPN 92-Engine Percent Load At Current Speed | |
SPN 3357-Actual Maximum Available Engine-Percent Torque | |
SPN 5398-Estimated Pumping-Percent Torque | |
PGN 0×F004 | SPN 512-Driver’s Demand Engine-Percent Torque |
SPN 513-Actual Engine-Percent Torque | |
SPN 190-Engine Speed | |
SPN 2432-Engine Demand-Percent Torque | |
PGN 0×F005 | SPN 526-Transmission Actual Gear Ratio |
SPN 523-Transmission Current Gear |
Batch Size | # of Hidden Layers | # of Hidden Units | Input Sequence | Dropout Rate | Training Loss | Validation Loss | Training Accuracy | Validation Accuracy |
---|---|---|---|---|---|---|---|---|
16 | 3 | 16 | 20 | 0.2 | 0.1943 | 0.1902 | 0.7081 | 0.7611 |
16 | 3 | 64 | 10 | 0.2 | 0.0981 | 0.1067 | 0.0716 | 0.0483 |
32 | 2 | 64 | 5 | 0.5 | 0.2150 | 0.1863 | 0.6527 | 0.8078 |
32 | 2 | 16 | 20 | 0.2 | 0.2012 | 0.2439 | 0.6188 | 0.6909 |
32 | 1 | 16 | 5 | 0.5 | 0.2325 | 0.3343 | 0.6287 | 0.5073 |
32 | 3 | 64 | 10 | 0.2 | 0.3367 | 0.3228 | 0.7912 | 0.8016 |
64 | 3 | 64 | 5 | 0.2 | 0.2837 | 0.2755 | 0.8265 | 0.8301 |
64 | 3 | 16 | 10 | 0.2 | 0.3705 | 0.4150 | 0.7709 | 0.7571 |
64 | 2 | 32 | 5 | 0.5 | 0.2420 | 0.2358 | 0.5337 | 0.5913 |
64 | 3 | 32 | 10 | 0.5 | 0.1343 | 0.1694 | 0.0655 | 0.1679 |
Batch Size | # of Hidden Layers | # of Hidden Units | Input Sequence | Dropout Rate | Training Loss | Validation Loss | Training Accuracy | Validation Accuracy |
---|---|---|---|---|---|---|---|---|
16 | 3 | 32 | 10 | 0.5 | 0.4216 | 0.4132 | 0.7211 | 0.7328 |
64 | 1 | 128 | 10 | 0.2 | 0.2946 | 0.2958 | 0.8110 | 0.8204 |
64 | 3 | 512 | 40 | 0.4 | 0.2869 | 0.3849 | 0.8011 | 0.7966 |
64 | 2 | 128 | 10 | 0.2 | 0.2123 | 0.2198 | 0.5313 | 0.5438 |
64 | 4 | 64 | 10 | 0.2 | 0.3975 | 0.4717 | 0.7748 | 0.6879 |
64 | 2 | 128 | 10 | 0.5 | 0.2173 | 0.2142 | 0.7123 | 0.8332 |
128 | 3 | 1024 | 60 | 0.2 | 0.1442 | 0.1580 | 0.7111 | 0.9582 |
128 | 2 | 32 | 10 | 0.5 | 0.2505 | 0.2719 | 0.6141 | 0.5839 |
256 | 1 | 512 | 20 | 0.2 | 0.1541 | 0.1642 | 0.8066 | 0.8798 |
256 | 1 | 62 | 10 | 0.5 | 0.1551 | 0.2343 | 0.8770 | 0.5917 |
CAN Detector | J1939 Detector | CAN Detector from [13] | |||
---|---|---|---|---|---|
ID | AUC | ID | AUC | ID | AUC |
PGN 0×F002 | 0.6814 | SPN 191 | 0.9459 | 002 | 0.9738 |
SPN 161 | 0.9317 | 0D0 | 0.8023 | ||
PGN 0×F003 | 0.6164 | SPN 91 | 0.8768 | 0D1 | 0.9307 |
SPN 92 | 0.7820 | 0D4 | 0.9706 | ||
SPN 3357 | 0.7733 | 140 | 0.9048 | ||
SPN 5398 | 0.8822 | 141 | 0.8955 | ||
PGN 0×F004 | 0.7255 | SPN 512 | 0.8068 | 360 | 0.8161 |
SPN 513 | 0.7667 | 370 | 0.8070 | ||
SPN 190 | 0.9927 | ||||
SPN 2432 | 0.7837 | ||||
PGN 0×F005 | 0.9637 | SPN 526 | 0.8624 | ||
SPN 523 | 0.8431 | ||||
Overall Average | 0.7468 | Overall Average | 0.8539 | Overall Average | 0.8876 |
ID | Score Type | Threshold | Precision | Recall | fβ |
---|---|---|---|---|---|
SPN 191 | window | 0.8967 | 0.9966 | 0.5973 | 0.9901 |
SPN 161 | window | 0.9330 | 0.9975 | 0.7986 | 0.9950 |
0×F002 | max | 0.9968 | 0.9942 | 0.5468 | 0.9862 |
SPN 91 | max | 0.9997 | 0.9883 | 0.7366 | 0.9850 |
SPN 92 | window | 0.8724 | 0.9982 | 0.3793 | 0.9824 |
SPN 3357 | window | 0.8438 | 0.9985 | 0.4540 | 0.9868 |
SPN 5398 | window | 0.9192 | 0.9977 | 0.6040 | 0.9913 |
0×F003 | max | 0.9618 | 0.9893 | 0.9433 | 0.9889 |
SPN 512 | window | 0.9827 | 1.0000 | 0.2967 | 0.9771 |
SPN 513 | window | 0.9038 | 0.9889 | 0.5327 | 0.9805 |
SPN 190 | max | 0.9995 | 1.0000 | 0.9687 | 0.9997 |
SPN 2432 | window | 0.9096 | 0.9849 | 0.6507 | 0.9799 |
0×F004 | window | 0.6898 | 0.9810 | 0.9570 | 0.9807 |
SPN 526 | window | 0.9985 | 0.9955 | 0.5933 | 0.9889 |
SPN 523 | window | 0.9913 | 0.9985 | 0.4293 | 0.9855 |
PGN 0×F005 | window | 0.1056 | 0.9964 | 0.9978 | 0.9934 |
CAN Detector | J1939 Detector | ||||
---|---|---|---|---|---|
ID | AUC Replay | AUC Data Mod. | ID | AUC Replay | AUC Data Mod. |
PGN 0×F002 | 0.9760 | 0.6769 | SPN 191 | 0.8688 | 0.9576 |
SPN 161 | 0.8087 | 0.9527 | |||
PGN 0×F003 | 0.8368 | 0.6137 | SPN 91 | 0.7873 | 0.8870 |
SPN 92 | 0.6417 | 0.7914 | |||
SPN 3357 | 0.6802 | 0.7397 | |||
SPN 5398 | 0.7105 | 0.9175 | |||
PGN 0×F004 | 0.8009 | 0.7243 | SPN 512 | 0.7368 | 0.8335 |
SPN 513 | 0.6662 | 0.8049 | |||
SPN 190 | 0.9625 | 0.9950 | |||
SPN 2432 | 0.7111 | 0.8119 | |||
PGN 0×F005 | 0.9656 | 0.9637 | SPN 526 | 0.7563 | 0.8969 |
SPN 523 | 0.7005 | 0.8857 | |||
Overall Average | 0.8948 | 0.7447 | Overall Average | 0.7526 | 0.8728 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Potvin, M.J.; Leblanc, S.P. Detecting Malicious Anomalies in Heavy-Duty Vehicular Networks Using Long Short-Term Memory Models. Sensors 2025, 25, 4430. https://doi.org/10.3390/s25144430
Potvin MJ, Leblanc SP. Detecting Malicious Anomalies in Heavy-Duty Vehicular Networks Using Long Short-Term Memory Models. Sensors. 2025; 25(14):4430. https://doi.org/10.3390/s25144430
Chicago/Turabian StylePotvin, Mark J., and Sylvain P. Leblanc. 2025. "Detecting Malicious Anomalies in Heavy-Duty Vehicular Networks Using Long Short-Term Memory Models" Sensors 25, no. 14: 4430. https://doi.org/10.3390/s25144430
APA StylePotvin, M. J., & Leblanc, S. P. (2025). Detecting Malicious Anomalies in Heavy-Duty Vehicular Networks Using Long Short-Term Memory Models. Sensors, 25(14), 4430. https://doi.org/10.3390/s25144430