Authentication Protocols
Total Page:16
File Type:pdf, Size:1020Kb
SECURING THE IN-VEHICLE NETWORK BY ANDREEA-INA RADU A thesis submitted to University of Birmingham for the degree of DOCTOR OF PHILOSOPHY School of Computer Science College of Engineering and Physical Sciences University of Birmingham October 2019 University of Birmingham Research Archive e-theses repository This unpublished thesis/dissertation is copyright of the author and/or third parties. The intellectual property rights of the author or third parties in respect of this work are as defined by The Copyright Designs and Patents Act 1988 or as modified by any successor legislation. Any use made of information contained in this thesis/dissertation must be in accordance with that legislation and must be properly acknowledged. Further distribution or reproduction in any format is prohibited without the permission of the copyright holder. Abstract Recent research into automotive security has shown that once a single electronic ve- hicle component is compromised, it is possible to take control of the vehicle. These components, called Electronic Control Units, are embedded systems which manage a significant part of the functionality of a modern car. They communicate with each other via the in-vehicle network, known as the Controller Area Network, which is the most widely used automotive bus. In this thesis, we introduce a series of novel proposals to improve the security of both the Controller Area Network bus and the Electronic Control Units. The Controller Area Network suffers from a number of shortfalls, one of which is the lack of source authentication. We propose a protocol that mitigates this funda- mental shortcoming in the Controller Area Network bus design, and protects against a number of high profile media attacks that have been published. We derive a set of desirable security and compatibility properties which an authentication protocol for the Controller Area Network bus should possess. We evaluate our protocol, along with other proposed protocols in the literature, with respect to the defined properties. Our systematic analysis of the protocols allows the automotive industry to make an informed choice regarding the adoption suitability of these solutions. However, it is not only the communication of Electronic Control Units that needs to be secure, but the firmware running on them as well. The growing number of Elec- tronic Control Units in a vehicle, together with their increasing complexity, prompts the need for automated tools to test their security. Part of the challenge in designing such a tool is the diversity of Electronic Control Unit architectures. To this end, this thesis presents a methodology for extracting the Control Flow Graph from the Elec- tronic Control Unit firmware. The Control Flow Graph is a platform independent rep- resentation of the firmware control flow, allowing us to abstract from the underlying architecture. We present a fuzzer for Electronic Control Unit firmware fuzz-testing via Controller Area Network. The extracted Control Flow Graph is tagged with static data used in instructions which influence the control flow of the firmware. It is then used to create a set of input seeds for the fuzzer, and in altering the inputs during the fuzzing process. This approach represents a step towards an efficient fuzzing methodology for Electronic Control Units. To our knowledge, this is the first proposal that uses static analysis to guide the fuzzing of Electronic Control Units. This research was funded by Jaguar Land Rover and the Engineering and Physical Sciences Research Council (Industrial CASE Award 14220107) as part of the project Lightweight Cryp- tography for Next Generation Vehicle Electrical Architecture. Acknowledgements My research and this thesis would not have been possible without the support of my PhD supervisor, Flavio Garcia, who is an amazing mentor and role model. Thank you for all your guidance, and for all the coffee that kept me awake during these past five years. I would like to thank my examiners, Casten Maple and David Oswald for their time reviewing this manuscript, and my thesis group members, Mark Ryan and Dave Parker, for their appraisal of my work, throughout my studies. My time at the University of Birmingham has been enriched by numerous peo- ple I would like to give thanks, to name a few: Richard Thomas, Mihai Ordean, Tom Chothia, David Oswald, David Galindo, Edu Marin, Chris Hicks, Volker Sorge, Eike Ritter, George Vasilakis, Zitai Chen, Shehnila Zardari, Tom Goodman, Lauren Rawlins and Gurchetan Grewal, the latter who convinced me to embark on my PhD journey; and a special thanks to my office colleagues, who have always found time for exquisite office banter: Sam Thomas, Jan van den Herrewegen, Chris McMahon-Stone, Nabi Omidvar, Kit Murdock and Lauri Laaksonen. I would like to thank my partner, Daniel Clark, for his love, patience, and confi- dence in me. Also, for his endless appetite for debate and analytical discussions, it has surely sharpened my critical self. To my parents, Carmen and Teodor, you have provided me with all the love, sup- port and strength I could have ever wished for. Thank you for always believing in me and encouraging me to forge my own path. Abbreviations and Acronyms ABS Anti-lock Braking System ADAS Advanced Driver-Assistance Systems ADC Analog-to-Digital Converter AEC Authentication Error Channel API Application Program Interface AUTOSAR AUTomotive Open System ARchitecture BAP Binary Analysis Platform BCM Body Control Module BIL Binary Independent Language CAN Controller Area Network CFG Control Flow Graph CFL Control Flow List CMAC Cipher-based Message Authentication Code CPU Central Processing Unit CRC Cyclic Redundancy Check CRYIF Crypto Interface CRYPTO Crypto Driver CSM Crypto Service Manager CSMA/CD+AMP Carrier Sense Multiple Access with Collision Detection and Arbitration Message Priority DLC Data Length Code DMR Direct Memory Reference DTC Data Trouble Code DoS Denial of Service EBS Electronically-Controlled Braking System ECM Engine Control Module ECU Electronic Control Unit FPGA Field-Programmable Gate Array FS Flow Status FV Freshness Value GMAC Galois Message Authentication Code GPIO General Purpose Input/Output GPS Global Positioning System JSON JavaScript Object Notation JTAG Joint Test Action Group HMAC Hash-based Message Authentication Code HSM Hardware Security Module HVAC Heating, Ventilation and Air Conditioning IDA Interactive DisAssembler IDS Intrusion Detection System IO Input/Output IPAS Intelligence Park Assist System IPC Instrument Panel Cluster IR Intermediate Representation ISN Interrupt Source Node LIN Local Interconnect Network LR Link Register MAC Message Authentication Code MCU Microcontroller Unit MIPS Microprocessor without Interlocked Pipelined Stages MOST Media Oriented Systems Transport MPH Miles Per Hour NRZ Non Return Zero NvM Non-volatile Random-Access Memory OBD-II On-Board Diagnostics OS Operating System PAM Parking Assist Module PCB Printed Circuit Board PCI Protocol Control Information PDF Portable Document Format PDU Protocol Data Unit PPC PowerPC PPT Probabilistic Polynomial Time PSCM Power Steering Control Module RAM Random Access Memory REC Receive Error Counter RFID Radio-Frequency Identification ROM Read Only Memory RPM Rotations Per Minute SAE Society of Automotive Engineers SecOC Secure Onboard Communication SID Service Identifier SN Sequence Number SPE Signal Processing Engine SPI Serial Peripheral Interface SWD Serial Wire Debug TEC Transmit Error Counter TEE Trusted Execution Environment TPMS Tyre Pressure Monitoring System UART Universal Asynchronous Receiver Transmitter UDS Unified Diagnostics Services V2X Vehicle-to-Everything VLE Variable Length Encoding WMA Windows Media Audio Contents 1 Introduction1 1.1 Contributions and Thesis Overview.....................4 I Preliminaries9 2 Background 11 2.1 Controller Area Network............................ 11 2.1.1 CAN Bus Protocol (ISO 11898).................... 13 2.1.2 CAN-TP Protocol (ISO 15765-2).................... 17 2.1.3 UDS (ISO 14229)............................ 19 2.2 AUTOSAR Classic Platform Standards.................... 21 2.2.1 Secure Onboard Communication................... 22 2.2.2 Crypto Stack............................... 24 2.2.3 Key Manager.............................. 25 2.2.4 Cryptographic Algorithms Recommendations........... 26 2.3 Summary..................................... 27 3 Vehicle Security Threats 29 3.1 From Hypothesising Security Risks. ..................... 30 3.2 To Assessing ECUs Under Local Access. ................... 30 3.3 Then Gaining Access Remotely. ....................... 35 3.4 To the Ultimate Remote Pwn!......................... 38 3.5 Summary..................................... 40 ƞ II CAN Bus Authentication 41 4 A Lightweight Authentication Protocol for CAN 43 4.1 Motivation.................................... 43 4.2 Contribution................................... 44 4.3 Building Blocks for Authentication Protocols................ 45 4.3.1 Security Notions............................ 45 4.3.2 Message Authentication Codes.................... 47 4.3.3 Adversarial Model........................... 48 4.4 LEIA: A Lightweight Authentication Protocol for CAN.......... 49 4.4.1 Session Key Generation........................ 50 4.4.2 Sending Authenticated Messages................... 51 4.4.3 Resynchronisation........................... 52 4.5 Dealing with the Shortcomings of CAN................... 54 4.6 Performance Evaluation............................ 58 4.6.1 Implementation............................