Secure Can Logging and Data Analysis
Total Page:16
File Type:pdf, Size:1020Kb
THESIS SECURE CAN LOGGING AND DATA ANALYSIS Submitted by Duy Van Department of Systems Engineering In partial fulfillment of the requirements For the Degree of Master of Science Colorado State University Fort Collins, Colorado Fall 2020 Master’s Committee: Advisor: Jeremy Daily Steve Simske Christo Papadopoulos Stephen Hayne Copyright by Duy Van 2020 All Rights Reserved ABSTRACT SECURE CAN LOGGING AND DATA ANALYSIS Controller Area Network (CAN) communications are an essential element of modern vehicles, particularly heavy trucks. However, CAN protocols are vulnerable from a cybersecurity perspective in that they have no mechanism for authentication or authorization. Attacks on vehicle CAN systems present a risk to driver privacy and possibly driver safety. Therefore, developing new tools and techniques to detect cybersecurity threats within CAN networks is a critical research topic. A key component of this research is compiling a large database of representative CAN data from operational vehicles on the road. This database will be used to develop methods for detecting intrusions or other potential threats. In this paper, an open source CAN logger was developed that used hardware and software following the industry security standards to securely log and transmit heavy vehicle CAN data. A hardware prototype demonstrated the ability to encrypt data at over 6 Megabits per second (Mbps) and successfully log all data at 100% bus load on a 1 Mbps baud CAN network in a laboratory setting. An AES- 128 Cipher Block Chaining (CBC) encryption mode was chosen. A Hardware Security Module (HSM) was used to generate and securely store asymmetric key pairs for cryptographic communication with a third-party cloud database. It also implemented Elliptic-Curve Cryptography (ECC) algorithms to perform key exchange and sign the data for integrity verification. This solution ensures secure data collection and transmission because only encrypted data is ever stored or transmitted, and communication with the third-party cloud server uses shared, asymmetric secret keys as well as Transport Layer Security (TLS). ii ACKNOWLEDMENT Throughout the writing of this thesis, I have received a great deal of assistance. I would like to first thank my mentor, Dr. Jeremy Daily, who has guided me through this project with his valuable knowledge and dedication. I would also like to thank Dr. Steve Simske, Dr. Christo Papadopoulos, and Dr. Stephen Hayne for being on my thesis committee. Thanks to all my research colleagues who have helped me throughout the project. More importantly, I would like to thank my parents and my wife for their wise counsel and sympathetic ear. In addition, I would like to thank the National Motor Freight Traffic Association, especially Urban Jonson and Ben Gardiner within the organization for greatly supporting the project during the project development and in the data collection process. I would like to thank Colorado State University as well as The University of Tulsa for providing the facilities and resources to conduct the research. And lastly, I would like to extend my sincere thanks to the National Science Foundation as the project sponsor. iii PROJECT DISCLAIMER This material is based upon work supported by the National Science Foundation under Grant No. 1715409, with the title of “SaTC: CORE: Small: Collaborative: GOALI: Detecting and Reconstructing Network Anomalies and Intrusions in Heavy Duty Vehicles.” Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. iv TABLE OF CONTENTS Chapter 1. Introduction ................................................................................................................... 1 A. Background ......................................................................................................................... 1 B. Objective ............................................................................................................................. 7 C. Motivation ........................................................................................................................... 8 D. Related Research ................................................................................................................. 9 E. Approach ........................................................................................................................... 12 F. Contribution ...................................................................................................................... 12 G. Organization of Thesis ...................................................................................................... 13 Chapter 2. Hardware Design ......................................................................................................... 15 A. Requirements .................................................................................................................... 15 B. Design Alternatives ........................................................................................................... 18 C. Block Diagram .................................................................................................................. 25 D. Detailed Schematics .......................................................................................................... 25 i. Teensy 3.6 ...................................................................................................................... 29 ii. Third CAN channel .................................................................................................... 31 iii. CAN Transceivers ...................................................................................................... 32 iv. J1708 ........................................................................................................................... 33 v. J1708/CAN2 Multiplexing ............................................................................................. 34 vi. Local Interconnect Network (LIN) ............................................................................. 35 vii. Single-wire CAN ........................................................................................................ 36 viii. Hardware security module .......................................................................................... 37 ix. WiFi module ............................................................................................................... 39 x. Voltage regulator and power protection ......................................................................... 41 xi. Voltage monitoring ..................................................................................................... 42 xii. Push button and optoisolator transistor output ........................................................... 43 xiii. Mini USB .................................................................................................................... 45 xiv. LEDs and light pipes .................................................................................................. 46 xv. D-Sub 15 Connector ................................................................................................... 47 xvi. Bias resistors ............................................................................................................... 49 E. Printed Circuit Board (PCB) Layout................................................................................. 49 F. Bill of Materials ................................................................................................................ 50 G. Assembly and Manufacturing ........................................................................................... 52 H. Checklist ........................................................................................................................... 55 I. Functional Tests and Results ............................................................................................ 57 i. CAN0 and CAN1 test ..................................................................................................... 57 ii. Autobaud test .............................................................................................................. 58 iii. AES-128 test ............................................................................................................... 61 iv. Logging speed test ...................................................................................................... 65 v. SHA-256 test .................................................................................................................. 73 vi. ATECC608A key configuration ................................................................................. 75 vii. ECDH pre-master calculation test .............................................................................. 76 v viii. ATECC608A AES-128 .............................................................................................. 80 ix. ECDSA sign and verify test........................................................................................ 82 x. CAN2 and multiplexing test ........................................................................................... 86 xi. Single-Wire CAN test ................................................................................................. 88 xii. LIN test ......................................................................................................................