[00:00.000]Hello. Hello, everyone. First of all, thank you for joining us today.
[00:05.620]

[00:05.660]And our topic is V2G will go through the wires.
[00:09.260]

[00:09.600]Where will we talk about the V2G and the cyber security issues that come with it.
[00:16.280]

[00:18.140]First of all, let me introduce us. I am Pavel Kuhn, cyber security researcher.
[00:23.440]

[00:23.440]And I'm currently working at Auxilium Pentest Lab with Tom.
[00:29.260]

[00:30.280]Yeah, hello from myself too. I'm Tomas Rampinis.
[00:33.720]

[00:33.720]I'm the technical director of Auxilium Pentest Labs.
[00:36.200]

[00:36.940]And yeah, like, let's start.
[00:39.520]

[00:39.680]Our main goal today is to analyze the state of cyber security in the automotive industry
[00:44.040]

[00:44.680]and get an in-depth look on the EV architecture and this undeniably emerging attack vector.
[00:50.860]

[00:50.860]We want to explore and understand the communication protocols used in EV charging today.
[00:56.520]

[00:56.540]And introduce you to our security tool, V2G Evil,
[00:59.980]

[00:59.980]that we built with Pavel during his university thesis.
[01:03.900]

[01:03.900]And finally, create a reference point for EV security research and evaluation.
[01:09.040]

[01:09.040]Something that we feel our industry is lacking, basically.
[01:13.020]

[01:13.020]Alongside other vectors in the automotive security landscape.
[01:17.120]

[01:17.740]So let's start with the introduction to vehicle cyber security.
[01:22.380]

[01:22.380]And basically, it goes without question that the automotive industry cannot be considered something new.
[01:27.160]

[01:27.160]We are basically talking about 100 plus year old mechanical engineering industries.
[01:31.740]

[01:31.740]And nothing is new about this.
[01:33.340]

[01:33.340]The constant need for connectivity and technological aspects of it
[01:37.080]

[01:37.680]push those companies to make a real, like, restructuring and start implementing technologies
[01:44.340]

[01:44.900]that didn't have the know-how or the capacity to do so before.
[01:49.060]

[01:49.320]Which is good for us, that's why we are here in the end.
[01:53.100]

[01:53.100]But really bad for the security and safety of the affected vehicles that we're testing.
[01:57.360]

[01:57.360]On the other hand, you have all these startups that started as technology companies first.
[02:02.880]

[02:02.880]Which have a way better security posture and culture.
[02:08.400]

[02:08.400]But the industry as a whole struggles for the last decade.
[02:11.780]

[02:11.780]To be honest, I cannot see a clear light in this path.
[02:15.700]

[02:18.120]Isolating the part we will focus in this talk,
[02:21.840]

[02:21.840]we have the emerging industry of electric and hybrid vehicles.
[02:25.920]

[02:25.920]Mainly developed to decentralize pollution and make better use of clean energy solutions.
[02:31.320]

[02:31.320]And additionally, you have several advantages in comparison to internal combustion engine vehicles.
[02:38.500]

[02:38.500]For example, heavy gains in speed and efficiency.
[02:41.460]

[02:41.460]While early models used basic charging,
[02:44.740]

[02:44.740]the last decade charging standards are applied and enforced in many ways.
[02:50.720]

[02:50.720]Which led to the standardization of the ports, protocols and underlying data
[02:55.960]

[02:55.960]in a wide range of applicability for different continents and standards.
[03:00.940]

[03:00.940]This is, of course, in addition to the digital communication needed during charging.
[03:06.040]

[03:06.380]Which expanded the attack surface of the vehicles as we knew from them before.
[03:11.440]

[03:11.460]And created new attack vectors that we can start playing with.
[03:15.260]

[03:17.140]What I'm saying here is that it's not something new or groundbreaking.
[03:22.800]

[03:23.400]By any means.
[03:24.300]

[03:24.300]But the state of EV charging security is a barely touched topic by researchers.
[03:28.160]

[03:33.920]And here we have a really simple representation of a modern vehicle.
[03:38.860]

[03:38.860]Which normally includes a bunch of interconnected ECUs.
[03:41.820]

[03:41.820]Responsible for different functionality in the vehicle.
[03:44.940]

[03:44.940]This can be from single headlight ECUs to huge DC-DC converters.
[03:50.720]

[03:50.720]And what we see, though, is that while this vehicle till now was reasonably isolated
[03:56.120]

[03:56.760]by the outside world, now we have a new externally accessible port.
[04:01.480]

[04:01.480]Which connects to a charging station.
[04:03.700]

[04:03.700]And this leaves a big room for error.
[04:05.620]

[04:05.620]And if not properly implemented and designed, several unexpected instances can occur.
[04:10.660]

[04:10.660]And while architecture and vehicle design of interconnected vehicles might not seem as
[04:16.140]

[04:16.140]important, there are numerous instances that they play a big part of how severe our findings
[04:22.460]

[04:22.460]are during a pen test.
[04:23.940]

[04:23.940]And how, in the end, can or cannot affect the safety of the driver, passengers, or even
[04:29.160]

[04:29.160]pedestrians.
[04:30.160]

[04:30.620]And as we keep digging deeper, let's discuss a bit about charging in terms of vehicles
[04:35.860]

[04:36.380]and the automotive industry.
[04:38.140]

[04:38.140]First of all, there are several charging methods, including conductive, wireless, and
[04:43.880]

[04:43.880]some exotic ones that we only see in some manufacturers, like battery swaps and
[04:48.780]

[04:48.780]bidirectional charging.
[04:50.540]

[04:50.540]And on top of that, there are different types, depending on the needs of the user and the
[04:56.580]

[04:56.580]capabilities of the vehicle, including AC and DC charging.
[05:00.940]

[05:00.940]Supplying different advantages and disadvantages, as we will see later.
[05:05.120]

[05:05.120]And finally, during charging, there are also different modes of charging, where basically
[05:09.960]

[05:09.960]the first three modes are focused to AC, and the fourth one in DC charging.
[05:14.800]

[05:16.280]Talking about some boring stuff here, there are a lot of different available standards,
[05:21.180]

[05:21.180]and as our main focus is the combined charging standard, or CCS.
[05:27.220]

[05:27.380]Basically for Europe, and we just have this undeniably big list of standards for different
[05:32.880]

[05:32.880]levels of this full implementation, ranging from the connector itself to the high-level
[05:39.500]

[05:39.500]communication needed between the EV and the charger.
[05:43.100]

[05:43.100]And this CCS standard is basically an effort towards a single unified for electric vehicle
[05:48.300]

[05:49.300]charging, which considering where we are today, you might disagree.
[05:53.720]

[05:55.360]And yeah, the reason I said this is because there are a number of different standards out
[06:01.060]

[06:01.060]there in the wild.
[06:02.340]

[06:02.340]Mostly divided to the different continents, but lately several manufacturers decided to
[06:09.440]

[06:09.440]move into the Tesla standard, the supercharger standard, mainly in the USA and mainly because
[06:15.380]

[06:15.380]of the heavily invested charging network in the US roads.
[06:19.060]

[06:19.080]And of course, that does not affect Europe, at least for now, but the opportunity for
[06:24.540]

[06:24.660]a unified standard, in my opinion, is kind of lost at this point.
[06:27.840]

[06:28.900]And yeah, as we look at this circle of this CCSAC type 2 connector, we can distinguish
[06:35.280]

[06:35.280]several pins.
[06:36.360]

[06:36.360]Some of them is the CP pin, which is crucial for communication between the car and the
[06:42.040]

[06:42.040]charging station, and the pin with the highest interest for us as cybersecurity researchers.
[06:48.020]

[06:48.020]It basically allows the station to check the vehicle status and ensure it's safe to charge.
[06:53.580]

[06:53.580]Then the PP pin ensures that the correct connector is used and provides information
[06:59.260]

[06:59.260]on the current carrying capacity of the cable that we're using.
[07:04.560]

[07:04.720]The AC type 2 connector supports charging at various power levels from household outlets
[07:10.260]

[07:10.260]to high power public chargers.
[07:13.720]

[07:14.780]And here we have the DC CCS type 2 connector, an extension of the AC type 2 connector designed
[07:20.700]

[07:20.700]to support direct current fast charging.
[07:24.100]

[07:24.200]And this connector, also known as combo 2, basically incorporates the same pins as the
[07:29.420]

[07:29.420]AC type 2 connector for AC charging, but adds two additional pins specifically for DC charging.
[07:36.380]

[07:36.380]And the combination of these pins in a single connector is what gives this combined charging
[07:41.200]

[07:41.200]name.
[07:42.200]

[07:42.200]And it provides the flexibility of using either AC or DC, depending on the charging station
[07:47.740]

[07:47.740]and the vehicle capabilities.
[07:49.600]

[07:50.440]Here we can basically get an understanding of how this works internally in the different
[07:55.540]

[07:55.540]implementations of DC or AC charging.
[07:58.680]

[07:58.680]And on the other hand, we have the DC charging where the power electronics for the conversion
[08:03.880]

[08:03.880]of the current exists in the EVSC side.
[08:06.920]

[08:06.920]So the charger, while when you want to use the slower solution of AC charging, the conversion
[08:12.300]

[08:12.300]is still happening inside the vehicle itself by the onboard charger.
[08:16.880]

[08:16.880]Additionally, we can get an understanding of the communication channel that exists in
[08:21.920]

[08:21.920]those scenarios.
[08:22.700]

[08:22.700]Really important, as we will see later, especially in safety critical cases where the current
[08:27.700]

[08:27.700]needs to be negotiated.
[08:30.720]

[08:31.640]From this, we clearly understand that charging is not only simple power transfer and data
[08:37.700]

[08:37.700]exchange is also happening under the hood.
[08:39.860]

[08:39.860]Many times with important information like payment details, voltage, current requirements,
[08:45.560]

[08:45.560]time of charging, and others.
[08:48.120]

[08:48.120]And to get a better understanding of how this communication is structured, I will pass it
[08:52.460]

[08:52.460]to Pavel.
[08:53.260]

[08:56.640]So let's have a look at the charging flow.
[08:59.860]

[08:59.860]It's a high-level overview.
[09:02.340]

[09:02.340]So first, the user plugs the CCS connector to his car.
[09:06.520]

[09:06.720]And then the low-level communication starts.
[09:10.540]

[09:11.060]If the EV is in the state B and the signal has the five-person duty cycle, it can change
[09:17.600]

[09:17.600]to the high-level communication.
[09:19.620]

[09:19.620]And during the high-level communication, they are exchanged to digital information about
[09:24.260]

[09:24.260]the charging.
[09:25.220]

[09:27.920]And that's how my journey and master thesis started.
[09:32.060]

[09:32.060]So it's just a meme.
[09:34.680]

[09:37.020]So let's have a look at the low-level communication at first.
[09:40.860]

[09:43.400]Low-level communication in the charging process is also called basic signaling.
[09:48.600]

[09:48.600]It offers basic control of the charging process between the EV and EVSE.
[10:04.500]

[10:05.640]The EV controls the voltage value by adding or removing the resistors in the pilot signal.
[10:12.980]

[10:12.980]And based on the measured voltage, the EVSE can recognize the EV's state.
[10:19.040]

[10:19.960]The most important is the state B and state C, as you can see in the table.
[10:26.280]

[10:28.500]Depending on the given state resulting from the measured voltage value, the EVSE generates
[10:35.200]

[10:36.240]a pulsed modulation signal with a specific duty cycle.
[10:40.200]

[10:40.840]This value of the duty cycle value is controlled by the charging station and measured in the
[10:51.060]

[10:51.060]vehicle.
[10:51.700]

[10:52.400]And the simplified outcome from the low-level communication is that the state B means that
[10:59.000]

[10:59.000]EV is connected but not charging.
[11:02.540]

[11:02.540]And the state C is EV is connected and ready for charge.
[11:06.900]

[11:07.620]As I said, 5% duty cycle affords the high-level communication.
[11:11.980]

[11:14.640]As you could see, the low-level communication is not so interesting from the cybersecurity
[11:19.560]

[11:19.560]perspective because it only involves physical signaling.
[11:25.140]

[11:25.480]However, low-level communication is important in the sense that it enforces high-level
[11:31.040]

[11:31.040]communication for the specific state and the duty cycle.
[11:34.960]

[11:34.960]So let's explore the high-level communication.
[11:38.380]

[11:39.680]First of all, why do we need a high-level communication?
[11:42.580]

[11:42.580]Why do low-level communication is not sufficient enough?
[11:46.000]

[11:46.040]In the beginning, EV charging relied on the basic signaling methods only, which are sufficient
[11:52.680]

[11:52.680]for simple on-off commands to start or stop.
[11:56.380]

[11:56.740]But after some time, with the growing number of the electric vehicles and the complexity
[12:02.920]

[12:03.340]of our energy ecosystem, this basic form of the communication is no longer sufficient.
[12:11.200]

[12:11.820]High-level communication provides the optimized charging process.
[12:15.800]

[12:19.360]As we already described before, the precondition for high-level communication is the low-level
[12:24.280]

[12:24.280]communication with specific state and the duty cycle.
[12:27.600]

[12:27.680]And the high-level communication is only applicable for charging modes 3 and 4.
[12:33.980]

[12:33.980]And the high-level communication is mandatory for the mode 4, which is the DC charging,
[12:39.460]

[12:39.960]because there is a need to exchange some additional information to avoid the damage to the battery.
[12:46.960]

[12:50.010]The ISO 15118 defined all the high-level communication and the full name is
[12:58.090]

[12:58.090]Vehicle-to-Grid Communication Interface.
[13:01.030]

[13:01.030]And the part Vehicle-to-Grid has an acronym V2G.
[13:04.690]

[13:04.690]That's the reason why we named our tool V2GEvil,
[13:08.390]

[13:08.390]because it stands for the evaluation of the V2G communication.
[13:12.570]

[13:14.570]There is the comparison of the ISO and the IEC.
[13:21.550]

[13:21.810]As you can see, the ISO implements all of the OSI layers.
[13:27.010]

[13:27.450]And the new protocol is V2G Transfer Protocol, which I will explain in the following slides.
[13:34.670]

[13:36.150]We are aiming from the third network layer and above, up to the application layer.
[13:45.250]

[13:48.670]So the high-level communication is more complex,
[13:51.770]

[13:51.770]so there is bigger space for mistakes, and we are aiming for this.
[13:56.030]

[13:57.210]Here you can see the V2G communication flow,
[14:00.890]

[14:00.890]which is basically changing from one state to another.
[14:04.510]

[14:04.510]There is also exchange of the V2G messages.
[14:08.750]

[14:10.890]And after this is done, the charging is completed.
[14:16.390]

[14:17.070]Here you can see the V2G message, the header, the structure of the V2G message.
[14:23.730]

[14:23.990]I have to be now really fast, because we have only a few minutes.
[14:28.410]

[14:28.410]So this is the structure of the header.
[14:32.350]

[14:33.070]We have a different payload type, as you can see on the slide.
[14:36.850]

[14:37.490]Then the first of the V2G messages is the SDP request.
[14:42.370]

[14:42.410]There is some exchange for the security and transfer protocol for this.
[14:47.490]

[14:47.530]You have also the structure of the SDP request.
[14:50.530]

[14:50.830]Then the station will respond with the SDP response,
[14:55.790]

[14:55.790]with the information of IP address and the port for the communication over TCP protocol.
[15:02.030]

[15:02.930]And then the V2G communication can start.
[15:06.910]

[15:08.190]Here you can see the V2G message structure.
[15:12.230]

[15:13.930]It's divided into two different types.
[15:17.470]

[15:18.170]And the concept that we are aiming to cause some issues in this part,
[15:25.750]

[15:25.750]which is the decoding from EXI to XML,
[15:28.830]

[15:28.830]and also to this part, which is from this content and structure to the data structures.
[15:36.950]

[15:41.060]Here you can see just a simple representation of the message in XML format,
[15:47.240]

[15:47.240]which is later encoded to EXI.
[15:50.600]

[15:52.880]And I think we have to skip this.
[15:57.120]

[15:59.860]Yeah, so some words about the testing environment,
[16:04.100]

[16:04.100]because we need some specified testing environment
[16:07.360]

[16:07.360]where we use the DLAN Green PHY eval board and the DLAN Green PHY module.
[16:12.840]

[16:12.840]Basically, it has PLC support and PLC-to-Ethernet bridging support,
[16:16.300]

[16:16.300]which helps us with everything that was described in theory before.
[16:20.320]

[16:20.520]And we use this QCA 7000 Green PHY firmware,
[16:25.000]

[16:25.000]which allows us to configure, to configure,
[16:27.100]

[16:27.100]module as an EMOB charger or EMOB vehicle.
[16:30.680]

[16:30.680]So we potentially have the ability to act both as a charger and a vehicle.
[16:36.000]

[16:36.000]And it has implicit support for the Slack EVSC and the ACCC side,
[16:41.220]

[16:41.220]so the charger and the vehicle in this case.
[16:43.780]

[16:43.960]Here we have a sort of our complete development setup,
[16:46.980]

[16:46.980]where one board acts as the vehicle and one as the charger or the EVSC.
[16:52.900]

[16:52.900]And there are several ways that we can perform the PLC communication,
[16:56.300]

[16:56.300]as you see, but we chose to use a coax cable,
[16:59.680]

[16:59.680]as it will also be more appropriate for using the real world scenario
[17:03.380]

[17:03.380]to avoid interferences from other cables.
[17:06.520]

[17:06.900]And to conclude, you will be surprised if I tell you that
[17:09.820]

[17:09.820]many of the cheap Chinese controllers for Ethernet over power line
[17:13.660]

[17:13.660]use the same exact Qualcomm chip that we are also using.
[17:16.980]

[17:16.980]And if you are in one tight budget, let's say in most cases,
[17:20.580]

[17:20.580]you can reflush this chip with the appropriate firmware
[17:24.200]

[17:24.200]and run our tool with a budget of around 20 euros,
[17:27.360]

[17:27.360]comparing to a couple of hundred euros on the boards that I showed you before.
[17:31.420]

[17:32.380]And as always, we're referring to the first two layers.
[17:36.040]

[17:36.040]For the rest of the layers, we used as a reference
[17:38.240]

[17:38.240]the joint operating system for EV chargers,
[17:42.220]

[17:42.220]which in the start, we used both for the EVSC and the ACCC parts
[17:47.040]

[17:47.040]in order to properly implement all the parts of the communication.
[17:50.600]

[17:50.600]Later on, we developed our own malicious ACCC part
[17:54.260]

[17:54.260]to test against the Joseph EVCC reference implementation.
[17:59.720]

[18:00.880]And yeah, now let's go to our tool.
[18:04.120]

[18:04.920]So here you can see the architecture of our tool and its modules.
[18:10.620]

[18:10.620]So you have different modules and we will explain
[18:14.380]

[18:14.380]the most important modules in the next slides.
[18:17.260]

[18:17.820]So first of all, we have the implementation of V2G transfer protocol,
[18:23.980]

[18:23.980]which is basically the module V2GTP
[18:27.760]

[18:27.760]is basically the implementation of that transfer protocol.
[18:31.360]

[18:31.360]So this module is responsible for the V2G packet parsing,
[18:36.620]

[18:36.620]decoding and creating V2GTP packets.
[18:39.820]

[18:40.000]And the next module is the sniffer.
[18:43.580]

[18:43.580]The initial reason for developing the sniffer was
[18:46.680]

[18:46.680]to capture the V2G communication between the EV and EVSC
[18:53.880]

[18:53.880]and verify the correctness of our implementation of the V2G transfer protocol.
[19:00.950]

[19:02.040]So let's take a look at the demo.
[19:05.410]

[19:06.030]Thanks.
[19:07.250]

[19:08.930]So first of all, we start the station reference implementation,
[19:15.890]

[19:18.430]which is waiting for connection.
[19:20.310]

[19:20.310]Then we start our sniffer module with option V2GTP,
[19:25.090]

[19:25.670]which decodes the TCP raw data to V2G transfer protocol packet.
[19:33.570]

[19:34.470]Then we start the EVCC module,
[19:37.690]

[19:37.690]which is connecting like the car is connecting to the station,
[19:40.770]

[19:40.770]and then you can see the message exchange.
[19:44.530]

[19:46.030]And this is the output of the sniffer module that you can see
[19:50.830]

[19:50.830]that there's the V2GTP header and V2GTP payload.
[19:54.470]

[19:54.470]These are the SDP requests and the response.
[19:57.290]

[19:58.150]The next slide, you can also see that
[20:01.390]

[20:03.570]our sniffer module can also decode the EXI data,
[20:07.270]

[20:07.270]which are this payload that it's decoded to the XML document.
[20:14.730]

[20:15.170]The next two modules are the messages and the station.
[20:18.910]

[20:19.190]Messages are responsible to creating the messages
[20:21.570]

[20:21.570]and the conversion between the EXI and XML.
[20:25.210]

[20:25.690]And the station module is our implementation of the SECC,
[20:31.150]

[20:31.150]which is the Supply Equipment Communication Controller.
[20:36.010]

[20:36.150]And the station module is the core for the security modules.
[20:40.470]

[20:42.690]Let's start with the modules that are dedicated to the security testing.
[20:47.430]

[20:47.430]First of all, we have the enumerator module,
[20:50.710]

[20:50.710]which can help to enumerate the EV.
[20:53.290]

[20:54.130]For example, if the TLS is required or not,
[20:57.250]

[20:57.250]what is the TLS version?
[20:58.890]

[20:58.890]What are the supported cipher suites?
[21:01.730]

[21:01.730]And what is the application protocol required by the EV?
[21:07.270]

[21:08.210]So here you can see the demo that we start our station in enumerate mode.
[21:15.230]

[21:15.230]We enumerate all of the possible information.
[21:17.850]

[21:17.850]Then we start the EVCC to connect to our station.
[21:21.490]

[21:21.490]And then you can see the outcome of the enumerator.
[21:27.230]

[21:27.250]Here you can see the result.
[21:29.270]

[21:29.270]As I said, you can see the supported protocols, the TLS version and ciphers.
[21:36.830]

[21:38.510]And the last module is the fuzzer module,
[21:40.750]

[21:40.750]which is the most important module for the security testing.
[21:44.670]

[21:44.670]And using the fuzzer module, we can test the resilience of the EV
[21:48.890]

[21:49.490]to the invalid or malformed parameter values in the V2G response messages.
[21:56.130]

[21:56.990]So basically the fuzzer is sending malicious and invalid values for the parameters
[22:02.230]

[22:02.230]and it aims to the process of decoding the EXI to XML.
[22:09.210]

[22:09.210]So let's have a look at the demo.
[22:10.990]

[22:15.190]We start the fuzzer and waiting again for the EVCC to connect.
[22:21.410]

[22:23.810]And after the EVCC connects, there is some message exchange
[22:27.970]

[22:27.970]and in some of the messages we supply the invalid data.
[22:32.830]

[22:33.110]Here you can see the invalid data of some parameters
[22:36.010]

[22:36.010]and the result is that we can cause some errors on the EVCC side.
[22:41.370]

[22:42.230]The fuzzer module also can fuzz only one message
[22:44.890]

[22:44.890]and the result is that we can cause some decoding error in the unmarshall binary,
[22:54.750]

[22:55.470]which has some handful unmarshall method that reads a source of the XML data
[23:00.350]

[23:00.350]and binds its values to a new instance of Java object.
[23:05.450]

[23:05.570]And as we know from some articles,
[23:07.270]

[23:07.270]the unmarshall can be vulnerable to XML external entity injection attacks.
[23:13.170]

[23:13.490]So there is the space to implement the exploitation modules and exploit this further.
[23:22.990]

[23:27.810]So let's finish.
[23:29.070]

[23:29.070]Basically, there are a lot of enhancements that we can do on the tool.
[23:32.970]

[23:32.970]We will not go through them.
[23:34.210]

[23:34.210]We don't have time.
[23:35.130]

[23:35.130]But to conclude, communication electric vehicle says it has some potential from our point of view
[23:41.250]

[23:41.250]with bigger needs in the future, more sensitive data will start to flow
[23:45.830]

[23:45.830]and subsequently passed by EVs and EVSCs.
[23:49.010]

[23:49.050]And there are no open source tools available to cover these emerging attack vectors.
[23:53.750]

[23:53.750]That's why we build this and we hope that you will start using it
[23:56.950]

[23:56.950]and you will start getting to research vehicles in this way that it's uncovered till now.
[24:02.250]

[24:02.730]We want our tool to act as an easy way for people to get introduced
[24:05.830]

[24:05.830]and start researching both EVs and chargers in an efficient and modular way.
[24:11.270]

[24:11.910]Thank you and our tool will be released after DEF CON 32.
[24:15.110]

