Hello. Hello, everyone. First of all, thank you for joining us today. And our topic is V2G will go through the wires. Where will we talk about the V2G and the cyber security issues that come with it. First of all, let me introduce us. I am Pavel Kuhn, cyber security researcher. And I'm currently working at Auxilium Pentest Lab with Tom. Yeah, hello from myself too. I'm Tomas Rampinis. I'm the technical director of Auxilium Pentest Labs. And yeah, like, let's start. Our main goal today is to analyze the state of cyber security in the automotive industry and get an in-depth look on the EV architecture and this undeniably emerging attack vector. We want to explore and understand the communication protocols used in EV charging today. And introduce you to our security tool, V2G Evil, that we built with Pavel during his university thesis. And finally, create a reference point for EV security research and evaluation. Something that we feel our industry is lacking, basically. Alongside other vectors in the automotive security landscape. So let's start with the introduction to vehicle cyber security. And basically, it goes without question that the automotive industry cannot be considered something new. We are basically talking about 100 plus year old mechanical engineering industries. And nothing is new about this. The constant need for connectivity and technological aspects of it push those companies to make a real, like, restructuring and start implementing technologies that didn't have the know-how or the capacity to do so before. Which is good for us, that's why we are here in the end. But really bad for the security and safety of the affected vehicles that we're testing. On the other hand, you have all these startups that started as technology companies first. Which have a way better security posture and culture. But the industry as a whole struggles for the last decade. To be honest, I cannot see a clear light in this path. Isolating the part we will focus in this talk, we have the emerging industry of electric and hybrid vehicles. Mainly developed to decentralize pollution and make better use of clean energy solutions. And additionally, you have several advantages in comparison to internal combustion engine vehicles. For example, heavy gains in speed and efficiency. While early models used basic charging, the last decade charging standards are applied and enforced in many ways. Which led to the standardization of the ports, protocols and underlying data in a wide range of applicability for different continents and standards. This is, of course, in addition to the digital communication needed during charging. Which expanded the attack surface of the vehicles as we knew from them before. And created new attack vectors that we can start playing with. What I'm saying here is that it's not something new or groundbreaking. By any means. But the state of EV charging security is a barely touched topic by researchers. And here we have a really simple representation of a modern vehicle. Which normally includes a bunch of interconnected ECUs. Responsible for different functionality in the vehicle. This can be from single headlight ECUs to huge DC-DC converters. And what we see, though, is that while this vehicle till now was reasonably isolated by the outside world, now we have a new externally accessible port. Which connects to a charging station. And this leaves a big room for error. And if not properly implemented and designed, several unexpected instances can occur. And while architecture and vehicle design of interconnected vehicles might not seem as important, there are numerous instances that they play a big part of how severe our findings are during a pen test. And how, in the end, can or cannot affect the safety of the driver, passengers, or even pedestrians. And as we keep digging deeper, let's discuss a bit about charging in terms of vehicles and the automotive industry. First of all, there are several charging methods, including conductive, wireless, and some exotic ones that we only see in some manufacturers, like battery swaps and bidirectional charging. And on top of that, there are different types, depending on the needs of the user and the capabilities of the vehicle, including AC and DC charging. Supplying different advantages and disadvantages, as we will see later. And finally, during charging, there are also different modes of charging, where basically the first three modes are focused to AC, and the fourth one in DC charging. Talking about some boring stuff here, there are a lot of different available standards, and as our main focus is the combined charging standard, or CCS. Basically for Europe, and we just have this undeniably big list of standards for different levels of this full implementation, ranging from the connector itself to the high-level communication needed between the EV and the charger. And this CCS standard is basically an effort towards a single unified for electric vehicle charging, which considering where we are today, you might disagree. And yeah, the reason I said this is because there are a number of different standards out there in the wild. Mostly divided to the different continents, but lately several manufacturers decided to move into the Tesla standard, the supercharger standard, mainly in the USA and mainly because of the heavily invested charging network in the US roads. And of course, that does not affect Europe, at least for now, but the opportunity for a unified standard, in my opinion, is kind of lost at this point. And yeah, as we look at this circle of this CCSAC type 2 connector, we can distinguish several pins. Some of them is the CP pin, which is crucial for communication between the car and the charging station, and the pin with the highest interest for us as cybersecurity researchers. It basically allows the station to check the vehicle status and ensure it's safe to charge. Then the PP pin ensures that the correct connector is used and provides information on the current carrying capacity of the cable that we're using. The AC type 2 connector supports charging at various power levels from household outlets to high power public chargers. And here we have the DC CCS type 2 connector, an extension of the AC type 2 connector designed to support direct current fast charging. And this connector, also known as combo 2, basically incorporates the same pins as the AC type 2 connector for AC charging, but adds two additional pins specifically for DC charging. And the combination of these pins in a single connector is what gives this combined charging name. And it provides the flexibility of using either AC or DC, depending on the charging station and the vehicle capabilities. Here we can basically get an understanding of how this works internally in the different implementations of DC or AC charging. And on the other hand, we have the DC charging where the power electronics for the conversion of the current exists in the EVSC side. So the charger, while when you want to use the slower solution of AC charging, the conversion is still happening inside the vehicle itself by the onboard charger. Additionally, we can get an understanding of the communication channel that exists in those scenarios. Really important, as we will see later, especially in safety critical cases where the current needs to be negotiated. From this, we clearly understand that charging is not only simple power transfer and data exchange is also happening under the hood. Many times with important information like payment details, voltage, current requirements, time of charging, and others. And to get a better understanding of how this communication is structured, I will pass it to Pavel. So let's have a look at the charging flow. It's a high-level overview. So first, the user plugs the CCS connector to his car. And then the low-level communication starts. If the EV is in the state B and the signal has the five-person duty cycle, it can change to the high-level communication. And during the high-level communication, they are exchanged to digital information about the charging. And that's how my journey and master thesis started. So it's just a meme. So let's have a look at the low-level communication at first. Low-level communication in the charging process is also called basic signaling. It offers basic control of the charging process between the EV and EVSE. The EV controls the voltage value by adding or removing the resistors in the pilot signal. And based on the measured voltage, the EVSE can recognize the EV's state. The most important is the state B and state C, as you can see in the table. Depending on the given state resulting from the measured voltage value, the EVSE generates a pulsed modulation signal with a specific duty cycle. This value of the duty cycle value is controlled by the charging station and measured in the vehicle. And the simplified outcome from the low-level communication is that the state B means that EV is connected but not charging. And the state C is EV is connected and ready for charge. As I said, 5% duty cycle affords the high-level communication. As you could see, the low-level communication is not so interesting from the cybersecurity perspective because it only involves physical signaling. However, low-level communication is important in the sense that it enforces high-level communication for the specific state and the duty cycle. So let's explore the high-level communication. First of all, why do we need a high-level communication? Why do low-level communication is not sufficient enough? In the beginning, EV charging relied on the basic signaling methods only, which are sufficient for simple on-off commands to start or stop. But after some time, with the growing number of the electric vehicles and the complexity of our energy ecosystem, this basic form of the communication is no longer sufficient. High-level communication provides the optimized charging process. As we already described before, the precondition for high-level communication is the low-level communication with specific state and the duty cycle. And the high-level communication is only applicable for charging modes 3 and 4. And the high-level communication is mandatory for the mode 4, which is the DC charging, because there is a need to exchange some additional information to avoid the damage to the battery. The ISO 15118 defined all the high-level communication and the full name is Vehicle-to-Grid Communication Interface. And the part Vehicle-to-Grid has an acronym V2G. That's the reason why we named our tool V2GEvil, because it stands for the evaluation of the V2G communication. There is the comparison of the ISO and the IEC. As you can see, the ISO implements all of the OSI layers. And the new protocol is V2G Transfer Protocol, which I will explain in the following slides. We are aiming from the third network layer and above, up to the application layer. So the high-level communication is more complex, so there is bigger space for mistakes, and we are aiming for this. Here you can see the V2G communication flow, which is basically changing from one state to another. There is also exchange of the V2G messages. And after this is done, the charging is completed. Here you can see the V2G message, the header, the structure of the V2G message. I have to be now really fast, because we have only a few minutes. So this is the structure of the header. We have a different payload type, as you can see on the slide. Then the first of the V2G messages is the SDP request. There is some exchange for the security and transfer protocol for this. You have also the structure of the SDP request. Then the station will respond with the SDP response, with the information of IP address and the port for the communication over TCP protocol. And then the V2G communication can start. Here you can see the V2G message structure. It's divided into two different types. And the concept that we are aiming to cause some issues in this part, which is the decoding from EXI to XML, and also to this part, which is from this content and structure to the data structures. Here you can see just a simple representation of the message in XML format, which is later encoded to EXI. And I think we have to skip this. Yeah, so some words about the testing environment, because we need some specified testing environment where we use the DLAN Green PHY eval board and the DLAN Green PHY module. Basically, it has PLC support and PLC-to-Ethernet bridging support, which helps us with everything that was described in theory before. And we use this QCA 7000 Green PHY firmware, which allows us to configure, to configure, module as an EMOB charger or EMOB vehicle. So we potentially have the ability to act both as a charger and a vehicle. And it has implicit support for the Slack EVSC and the ACCC side, so the charger and the vehicle in this case. Here we have a sort of our complete development setup, where one board acts as the vehicle and one as the charger or the EVSC. And there are several ways that we can perform the PLC communication, as you see, but we chose to use a coax cable, as it will also be more appropriate for using the real world scenario to avoid interferences from other cables. And to conclude, you will be surprised if I tell you that many of the cheap Chinese controllers for Ethernet over power line use the same exact Qualcomm chip that we are also using. And if you are in one tight budget, let's say in most cases, you can reflush this chip with the appropriate firmware and run our tool with a budget of around 20 euros, comparing to a couple of hundred euros on the boards that I showed you before. And as always, we're referring to the first two layers. For the rest of the layers, we used as a reference the joint operating system for EV chargers, which in the start, we used both for the EVSC and the ACCC parts in order to properly implement all the parts of the communication. Later on, we developed our own malicious ACCC part to test against the Joseph EVCC reference implementation. And yeah, now let's go to our tool. So here you can see the architecture of our tool and its modules. So you have different modules and we will explain the most important modules in the next slides. So first of all, we have the implementation of V2G transfer protocol, which is basically the module V2GTP is basically the implementation of that transfer protocol. So this module is responsible for the V2G packet parsing, decoding and creating V2GTP packets. And the next module is the sniffer. The initial reason for developing the sniffer was to capture the V2G communication between the EV and EVSC and verify the correctness of our implementation of the V2G transfer protocol. So let's take a look at the demo. Thanks. So first of all, we start the station reference implementation, which is waiting for connection. Then we start our sniffer module with option V2GTP, which decodes the TCP raw data to V2G transfer protocol packet. Then we start the EVCC module, which is connecting like the car is connecting to the station, and then you can see the message exchange. And this is the output of the sniffer module that you can see that there's the V2GTP header and V2GTP payload. These are the SDP requests and the response. The next slide, you can also see that our sniffer module can also decode the EXI data, which are this payload that it's decoded to the XML document. The next two modules are the messages and the station. Messages are responsible to creating the messages and the conversion between the EXI and XML. And the station module is our implementation of the SECC, which is the Supply Equipment Communication Controller. And the station module is the core for the security modules. Let's start with the modules that are dedicated to the security testing. First of all, we have the enumerator module, which can help to enumerate the EV. For example, if the TLS is required or not, what is the TLS version? What are the supported cipher suites? And what is the application protocol required by the EV? So here you can see the demo that we start our station in enumerate mode. We enumerate all of the possible information. Then we start the EVCC to connect to our station. And then you can see the outcome of the enumerator. Here you can see the result. As I said, you can see the supported protocols, the TLS version and ciphers. And the last module is the fuzzer module, which is the most important module for the security testing. And using the fuzzer module, we can test the resilience of the EV to the invalid or malformed parameter values in the V2G response messages. So basically the fuzzer is sending malicious and invalid values for the parameters and it aims to the process of decoding the EXI to XML. So let's have a look at the demo. We start the fuzzer and waiting again for the EVCC to connect. And after the EVCC connects, there is some message exchange and in some of the messages we supply the invalid data. Here you can see the invalid data of some parameters and the result is that we can cause some errors on the EVCC side. The fuzzer module also can fuzz only one message and the result is that we can cause some decoding error in the unmarshall binary, which has some handful unmarshall method that reads a source of the XML data and binds its values to a new instance of Java object. And as we know from some articles, the unmarshall can be vulnerable to XML external entity injection attacks. So there is the space to implement the exploitation modules and exploit this further. So let's finish. Basically, there are a lot of enhancements that we can do on the tool. We will not go through them. We don't have time. But to conclude, communication electric vehicle says it has some potential from our point of view with bigger needs in the future, more sensitive data will start to flow and subsequently passed by EVs and EVSCs. And there are no open source tools available to cover these emerging attack vectors. That's why we build this and we hope that you will start using it and you will start getting to research vehicles in this way that it's uncovered till now. We want our tool to act as an easy way for people to get introduced and start researching both EVs and chargers in an efficient and modular way. Thank you and our tool will be released after DEF CON 32.