start	end	text
1180	3000	Hello DEF CON!
3000	4200	Hi!
10500	14140	I hope you enjoy your time here, we definitely do.
14140	16860	It's actually our first time here at DEF CON
16860	21900	and thus we are very proud and excited to present to you our talk
22700	26670	Redefining V2G, how to use your vehicle as a game controller.
27760	32240	So, why do we need to redefine the acronym V2G?
37370	39870	Well, let me tell you a story.
39870	45430	Once upon a time, our professor told us we should do some research about V2G.
46010	51310	And what he means by that is that we look at vehicle-to-grid communication,
51310	54990	the communication between the car and the charge point,
54990	61750	and also the back-end and even the power grid for bi-directional charging, for example.
62250	65310	Well, that's actually a pretty cool research topic,
65310	68250	but do you know what's even cooler?
69570	72090	Using your car as a game controller.
72090	77690	So, that's why we developed this little project called Vehicle-to-Game.
78270	82870	But before we get started with that, a short introduction of ourselves.
82870	88590	My name is Tim, I'm a PhD student at Darmstadt University of Applied Sciences in Germany,
88590	92430	and I mainly do automotive security,
92430	94650	so also a lot of theoretical stuff.
94650	99990	I look at protocols and standards and do a formal analysis of these standards
99990	105610	to see if they meet certain security goals.
105730	108050	Yeah, hello from my side too.
108050	113210	I'm Janis, I'm also a PhD student at our small automotive research group
113210	118550	called ACSD, Automotive Cyber Security Darmstadt.
118550	120810	It's located in Germany.
120810	125090	I finished my master's at the end of the last year,
125090	129930	and now I'm a PhD student about resilience in the automotive topic,
129930	132630	but also for IoT systems.
132630	138710	It means what happens if an ECU in a car breaks or is going to be compromised,
138710	141810	how you can migrate functionality to another ECU
141810	147850	and strengthen the safety inside the car by such a resilient concept.
148830	153350	Our research group is also very focused on teaching.
153350	156150	We have a lecture called Automotive Security,
156150	159850	and therefore we have to motivate students, of course,
159850	164810	and that's why we have created this motivating and beginner-friendly talk
165650	172190	and our project V2G to get students excited and motivated
172190	174910	about the topic of automotive research.
175730	180290	Maybe the most important member of our research group is our research car.
180290	184010	It's a Volkswagen ID.3. It's an electric vehicle.
184290	188210	And since, of course, we are Germans, we have to do research on the Volkswagen.
193740	198020	Usually, the initial step of the automotive research,
198020	203300	but also other security research, is considering attack vectors.
203300	206620	And that's what we have to do also for the automotive context.
206620	212320	You can see there are various attack... it's a huge attack surface.
212320	215200	First of all, you have long-range attacks, you have short-range attacks,
215200	218700	but you have also physical attack possibilities.
218720	222100	For the long-range attacks, for example, the cellular communication
222100	226960	between the car and the back-end of the OEM,
226960	229220	for example, for over-the-air updates.
229560	235000	In newly upcoming cars, you have also the V2X communication,
235000	239400	cars communicating to each other about their location, about their speed.
239400	242180	You have cars communicating with road signs
242860	249900	to get a status about allowed speed, for example, of this street section.
250420	254920	You have short-range attacks, that's more or less classical cyber security,
254920	258780	considering Bluetooth, Wi-Fi connection for your infotainment system
260020	264000	between the smartphone, for example, for playing via Apple CarPlay,
264000	267180	for example, the music on your car.
267860	272720	And the maybe most interesting and car-specific attack vectors
272720	279140	are these physical attacks, that's the bus systems inside the car,
279140	283540	there are several of them, but we want to focus on two,
283540	287040	and we go into them a little bit later in detail,
287040	289760	because we need them for our V2G project,
289760	294640	for getting all information required for our game controller out of this car.
297960	302180	So, here you can see our two main research cars.
302180	306920	We are focused on electric vehicles, so on the left side you can see our Volkswagen ID.3,
306920	309900	on the right side you can see the Tesla Model 3.
311000	314140	We use them for practical research,
314440	317080	Tim also introduced them as theoretical research,
317080	319140	I'm also more theoretical part,
319140	322020	but you cannot do the whole time theoretical research,
322020	326740	so you have to do tinkering around with the car, it's also good for the motivation.
327260	330860	There's a lot of information you just get when you look at the actual car,
330860	332860	because the manufacturers won't tell you,
332860	339480	and also for students it's quite cool to do research on the actual cars and projects.
340880	346820	So, we have equipped our cars with lots of techniques to get information about them,
346820	351560	and we show you in the following how we have done this.
351860	354420	That's the back of the Volkswagen ID.3,
354420	357320	we've equipped this with lots of measurement techniques,
357320	360540	on the right you can see so-called vector boxes,
360540	363000	they're from a German company called Vector,
363000	365180	that's why we call them vector boxes,
365180	369740	they're for capturing different buses inside the car,
369740	374880	and we have equipped the car in a way that we can get a holistic view
374880	378200	of all relevant buses in this car.
378380	382960	On the left side you can also see some interesting parts,
382960	384900	more for the electrical engineers,
384900	388860	we have equipped the car with so-called LEM sensors,
388860	391580	they are current measuring sensors via induction,
391580	398220	you can clip them on the high voltage system wires to measure the current.
398220	405360	The idea behind this holistic view between physical and messages inside the car
405360	414800	is that we can compare those data and get correlations between the actual physical measurements
414800	420120	and the recorded, for example, canvas data.
422260	426300	As I've already introduced, from a theoretical way,
426300	429120	there's also a practical attack surface, of course.
429120	436120	On the left side you can see classical key fob attacks using an SDR,
437060	439740	maybe all of you have heard about the roll jam attack,
439740	444940	you jam the signal of the key fob because it's using a rolling code,
444940	448160	and the owner of the car will press a second time,
448160	452200	and you have recorded both signals,
452200	456600	and you re-send the older one because the car hasn't heard this already,
456600	459500	and so you have a newer one for the car,
459500	463500	unlocking this in the future without the owner getting any notice about this.
464340	469620	In the middle you can see, for automotive and classical attack surfaces also,
469620	474600	unsoldering the chips where the firmware is located on,
474600	476400	because you have physical access to your car.
476400	480400	If you own the car, you can do anything you like with it, more or less.
481080	485080	So that's why we have unsoldered the EMMC chip,
485080	488760	to get in contact with the firmware.
489220	492700	That's the same we've done with the key fob,
492700	496080	you can see here there was the memory chip.
496920	503520	And maybe another interesting part is that you can directly connect,
503520	505620	here you can see such a vector box,
505620	507840	to the internal buses of the car.
507840	511220	Here you can see one such an ECU,
511220	517160	and we have connected this box with the CAN bus of the ECU,
517160	518980	controlling messages.
519680	523400	But before we go there for a little bit in detail,
523400	525500	how these messages look like,
525500	529080	first we have to understand what this CAN bus actually is,
529080	533150	how can we talk to those cars.
533150	540730	For a game controller, we require, as I've already mentioned,
540730	545010	information about specific actuators of the car,
545010	546230	for example the steering wheel.
546230	549570	We later want to transfer the angle of the steering wheel,
549570	551610	to our virtual game controller.
551610	554810	So we have to get this information out of the car.
554830	558210	And this information is transferred via the CAN bus.
562050	567250	The topology of such a car looks like follows,
567250	569570	it's a very condensed view,
569570	572930	it's a very simplified view of our Volkswagen ID.3,
572930	576450	where you can see there's a main gateway ECU,
576450	579350	and several domains.
579450	583470	Each domain consists of several other ECUs,
583470	586390	and each of those domains is separated in a way,
587210	591270	based on criticality of those functionality and the ECUs.
591270	593890	For example, in the middle domain you can see,
593890	595410	in the drive domain you can see,
595410	598930	there's located the engine ECU, but also the brake ECU,
598930	600350	they're all safety relevant,
600350	603490	so they're very critical for the safety behavior of the car.
603490	606550	On the left side you can see a separated domain,
606550	609450	with less criticality for, for example,
609450	612490	the light controlling inside the car.
613990	617750	The special thing in this topology is,
617750	620330	that those domains are separated,
621150	623490	based on this gateway ECU.
623490	626450	The gateway ECU is responsible for,
628410	632510	for shielding the inside of the car against the outside,
632510	637690	because, you know, maybe you know this from combustion engine,
637690	641330	the outside of the car is connected with so-called OBD2 port.
641330	645290	It's for diagnosis, if you bring your car to a garage,
645290	646890	they will plug there in.
646890	650090	And you want to prevent that via the OBD2 port,
650090	652710	everyone can read everything of the car.
652710	657770	So that's why such a gateway ECU is introduced into this topology.
657970	661630	But this strongly depends on the actual car you want to consider.
661630	663890	That's just for the Volkswagen ID.3
663890	667410	and the group of vehicles from Volkswagen.
671230	674570	Now we get a little bit into detail about this CAN bus.
674570	677770	The CAN bus was developed by Bosch in 1986.
678070	681090	It's a dual wire twisted pair cable,
681090	683870	and as I said before, it's a bus topology.
683870	686210	What does it mean?
686210	691130	A bus topology means that the ECUs are connected to the same wire,
691130	693690	or wire pair,
693690	699010	and all ECUs get the same state of information in the respective time frame.
699010	701710	We have a frequency in this CAN bus,
701710	705890	and all this information is distributed in this time frame
705890	711310	to all ECUs connected to this CAN bus.
711310	713690	It's also a multi-master protocol.
713690	718540	It means that all ECUs can send and receive on demand,
718950	722710	and there's no master required to control them.
726570	730590	Now we have the foundations how this CAN bus works.
730590	735790	Now we get to gain access to this physical CAN bus inside the car.
736510	739950	Maybe the most convenient way is to find just a repair manual
739950	742090	or a wiring diagram of the car.
742090	744830	They're usually available for garages.
744850	747310	For Volkswagen, you can get them online.
747310	751370	If you claim you have a garage, then you can buy it.
752790	755030	Otherwise, you have to find it out by yourself,
755030	757370	but this can become very, very hard.
757370	760810	So we recommend having such a wiring diagram.
761270	762890	Based on this wiring diagram,
762890	768370	you can find a good exposed position of an interesting CAN bus
769090	771190	where you can connect to.
771190	774370	For example, here you can see the Tesla Model 3,
774370	777270	which is in the mid console of the car.
777530	779950	There's one of three CAN buses,
779950	786330	which you can easily open and connect to ready-to-buy adapter.
786330	789590	You can buy those adapters easily on eBay, for example.
789810	793650	And then you can gain access to this CAN bus.
794270	798250	If you don't want to destroy your car or altering this,
798250	801170	there are also less intrusive techniques.
801170	804050	These are called contactless CAN readers.
804050	808390	They read CAN messages based on induction of the signal.
808850	811290	And that's more or less... it looks like a crocodile.
811290	814170	That's why some products are called CAN crocodile.
814170	819210	You clamp the CAN wires high and low, those dual wires,
819210	824310	between the clamp of the contactless CAN reader,
824310	826690	and you can read those messages.
827430	831090	So, you have gained access to the physical layer,
831090	835790	you have read those physical signals of the CAN bus.
835790	838930	Now you have to transfer them into software,
838930	841170	and therefore you need such...
841690	845110	for the Raspberry Pi, for example, a CAN head,
845110	848010	where those physical CAN signals are interpreted
848010	851970	and transferred to the kernel of the Raspberry Pi.
852190	854710	There are also other options available,
854710	858390	which can conveniently be used,
858390	862630	where you can connect your CAN bus directly via USB to your PC.
862630	863870	This also works for Windows,
863870	866850	so maybe it's for part of you interesting.
867330	869670	So, now we have transferred the message
869670	872910	to the software part of our project,
872910	875290	and that's where Tim continues.
875290	878730	Alright, so very conveniently in the Linux kernel,
878730	881350	there's already a CAN driver built in.
881350	883770	And if you want to work with that,
883770	888690	there's CANutils, which has all the basic tools to use that.
888890	892270	Also, if you want to do more advanced stuff for scripting,
892270	895590	you can use, for example, PythonCAN as a really good library.
895590	897350	That's what we use for our project.
897830	901050	There's also CANtools for more advanced command-line tools.
901350	903630	If you're into GUIs, there's SavvyCAN,
903630	906670	which is a really good open-source GUI tool.
907110	909430	And, of course, there are a lot of commercial tools.
909430	911790	We talked about all this vector stuff before.
912750	914830	But let's stick with the very basics.
914830	920070	So you install CANutils, and then there's this CANdump command,
920070	923710	which will just print out all of the CAN messages on the bus.
923710	926730	It looks somehow like this, but probably a lot faster
926730	928170	if you're on a real car.
928810	931370	For Tesla, for example, it might be on one bus,
931370	934450	I think, like 3,000 messages a second,
934450	936430	so it can be quite a lot.
937070	940490	One step back, even, if you connect to this,
942310	947270	for Linux, the CAN interface is like any other network interface
947270	951410	if your adapter is compatible with SocketCAN.
952410	956390	The only difference is that you don't have a network manager
956390	961190	to directly get your interface up and running,
961190	963510	and you also need a bitrate.
963890	969740	So you have to tell the computer how fast the bus operates.
969740	974260	You can measure that by using an oscilloscope, of course.
974800	978880	Luckily for automotive, it's usually 500 kilobits per second,
978880	980780	so you can also try that.
980900	982860	And just as a disclaimer,
982860	989920	there are also more modern standards,
989920	991460	like improvements on the CAN standards,
991460	993960	for example, CAN FD,
993960	997680	and there you will also need to have the data rate, for example.
998280	1001320	But let's assume standard CAN for now.
1001880	1004540	And then we've already seen the candab command.
1004660	1009040	I just want to walk very quickly through what you can see here.
1009040	1011900	That's one single message picked out.
1011900	1015140	You see the interface in the front,
1015140	1018920	if you have multiple CAN interfaces connected,
1018920	1019860	that's important.
1019860	1024620	Then the CAN ID, and the data length, and the data.
1024620	1027700	The thing is, this CAN ID,
1027700	1031300	if you're used to IP, you're usually used to having a source
1031300	1034560	and a destination address.
1034640	1037300	The CAN ID is actually neither.
1037300	1040040	Think of it more like a publish-subscribe topic.
1040040	1042600	So it will tell you how to define
1042600	1048500	or how to interpret the bits in the data part.
1049040	1051180	Also, it's the priority of the message.
1051180	1053560	So the lower the ID, the higher the priority.
1055240	1060940	And this data, it can be really arbitrarily defined.
1060980	1063840	The information in there is called signals,
1063840	1066220	and it can be like 1-bit, it can be 5-bit,
1066220	1069160	it can be all 8-bytes.
1069820	1073400	So that's up to the manufacturer to define that,
1073400	1077040	and that's why we usually need some reverse engineering
1077040	1079700	to make sense of this information.
1080680	1086500	Okay, so you might want to get started,
1086500	1089920	but maybe you do not want to remove all the plating of your car.
1090100	1096520	It sounds like a lot of work to figure out all the wiring and stuff.
1097480	1100000	So that's actually how we started,
1100000	1101780	but if you don't want to do that,
1101780	1104600	there's also the way the garages do that.
1104600	1107420	So Janice already spoilered it,
1107420	1110520	that you have this OBD2 connector,
1110520	1113080	and for vehicle diagnostics.
1113720	1117000	And this connector is usually very conveniently located
1117000	1120940	somewhere in the driver area of your vehicle in front,
1120940	1125540	and you can just plug in a diagnostic connector there.
1125540	1127680	It's usually an OBD2 dongle,
1127680	1130980	which connects via Bluetooth to a diagnostic device,
1130980	1134640	and will read out data like that.
1134740	1136920	And the protocol to do this is called UDS,
1136920	1139140	Unified Diagnostic Services,
1139140	1142540	and it's basically a request-response protocol.
1142760	1145340	The diagnostic tester will, for example,
1145340	1147460	in our case, we want the steering wheel angle,
1147460	1150680	so it will ask, is you responsible for that?
1150680	1152320	Can you give me the steering wheel angle?
1152320	1154620	And it will respond with the correct value.
1155000	1159300	So that's on top of the CAN protocol.
1159300	1163680	It can also be IP, but usually CAN, or both.
1163700	1166980	And in between, there's actually another protocol,
1166980	1168760	which is called ISOTP,
1168760	1171460	and which allows to basically combine multiple CAN measures.
1171460	1174140	They are limited to 8-byte,
1174140	1176740	to one message in UDS,
1176740	1179700	so you can send longer data.
1181040	1186520	But that comes with the difference that now we also...
1186520	1191000	I told you before that this is not like source and destination address to CAN ID,
1191000	1194980	but for UDS, it's actually the destination address now.
1195100	1197360	So there's also, if you want to read data,
1197360	1199200	there's also a data identifier,
1199200	1201780	which identifies which data it is.
1201780	1206080	So you can have now multiple different interpretations for data
1206080	1207560	with the same CAN ID,
1207560	1210620	and data can be split over multiple CAN frames.
1210620	1211980	Just watch out for that.
1211980	1216860	All right, and with that, I think we should have everything ready to go.
1216960	1219460	Yeah, I think so. We have considered the physical layer,
1219460	1222600	we have considered the transfer to the software,
1222600	1226040	we have considered how we can interpret those CAN messages,
1226040	1228920	so we have all together to create our game.
1229120	1232780	And as a small in-between motivation,
1232780	1234360	that's the actual result.
1234360	1237920	Here you can see Tim sitting in our Volkswagen ID.3.
1238020	1240060	In front, we have placed a big monitor,
1240060	1243760	playing Need for Speed Most Wanted from 2008,
1243760	1245440	with the actual car.
1248690	1249790	Thank you.
1254690	1258630	Here you can see a little bit more of our V2G experience.
1258630	1260830	On the left side, you can see our setup,
1261010	1263770	a laptop where the game is actually running.
1263770	1265790	In front of the car, we have placed a huge monitor
1265790	1269070	for a very immersive experience for the driver,
1269070	1272210	but also for all other people inside the car.
1272210	1275290	On the right side, you can see me playing, again,
1275290	1276870	Need for Speed Most Wanted.
1276930	1279930	And you can see I'm very focused on this game.
1279930	1282110	So, as I said, it's very immersive,
1282110	1286210	and it's a very cool experience sitting in such an equipped car.
1288290	1294770	But how can we now connect the laptop, the game, with the car?
1294770	1297410	You can see on the right, the topology again.
1298050	1300130	Therefore, we have several possibilities
1300130	1302490	to connect the car.
1302490	1304490	First, we can use wires.
1304490	1309690	We can use the USB-based P-CAN Pro, for example,
1309690	1315030	connecting, as one possibility, to the internal CAN bus.
1315230	1316570	Therefore, we have to figure out
1316570	1320310	which CAN bus relevant messages are located on.
1320630	1324010	We have to find the relevant messages,
1324010	1330110	figuring out the relevant signals of the CAN messages,
1330110	1333430	and there's an overwhelming number of CAN messages
1333430	1335070	on this internal bus.
1335070	1338330	As Tim said, several thousands per second.
1338330	1342590	So it's quite difficult to figure this stuff out.
1342730	1345890	Also, the whole breakout box stuff we've shown to you
1345890	1349370	is required to get access to those internal buses,
1349370	1351230	so the more convenient solution
1351230	1354370	is connecting directly to the OBD2 port
1354370	1359050	and use the diagnostic services for pulling those informations
1359050	1363790	and getting conveniently just the requested information.
1364210	1366650	But since we live in 2024,
1366650	1368470	wires are a little bit outdated.
1368470	1370750	We have created a Raspberry Pi head,
1370750	1377810	which allows us to emulate an Xbox 360 controller
1377810	1379650	with a Raspberry Pi Zero,
1379650	1382650	connecting directly to the OBD2 port of the car.
1382650	1387250	And this Raspberry Pi connects via Bluetooth to the laptop,
1387250	1388770	emulates this controller,
1388770	1390490	and the laptop can stand outside the car
1390490	1392990	and runs the game.
1393470	1396650	For this setup, we use UDS.
1398650	1403790	Now, a little bit into detail of the actual hardware we use for it.
1404190	1406530	The lower layer of this,
1406530	1408850	you can see it's a classical Raspberry Pi Zero
1408850	1410490	with no modifications.
1410490	1415750	Above that, we have located the Raspberry Pi CAN head,
1415750	1419710	which is responsible for converting those physical CAN signals
1419710	1423230	to a software-readable CAN message.
1423370	1425130	And the top layer,
1425130	1429030	we have created a self-designed PCB
1429030	1437370	for connecting to this OBD2 port of the car.
1437370	1440750	From this OBD2 port,
1440750	1443090	we only use four connections.
1443090	1445150	The 12V, the ground,
1445150	1447670	the CAN high and CAN low connection.
1447910	1449270	The CAN high and CAN low connection
1449270	1451130	is directly transferred via this PCB
1451130	1455750	to the lower CAN head,
1455750	1458690	which converts this message.
1459050	1461730	But the more interesting part of this PCB
1461730	1464710	is the 12V, 5V DC-DC conversion.
1464710	1469450	So we can very conveniently connect this dongle to our car
1469450	1471710	without the requirement for a power bank
1471710	1473970	and power supply of the Raspberry Pi.
1474430	1475450	As a short disclaimer,
1475450	1477770	we are no electrical engineers,
1477770	1480190	so if you have any recommendation about this,
1480190	1482150	feel free to contact us.
1482150	1485550	We are quite happy about recommendations.
1485570	1489430	This circuit for 12V, 5V DC-DC conversion
1489430	1493510	is just taken out of the datasheet of the used IC.
1494870	1498850	Feel free to come offstage to us and discuss it with me.
1501990	1505570	We have also added the possibility to add status LEDs,
1505570	1507110	but that's to be done.
1509370	1513270	They are connected to the GPIO pins of the Raspberry Pi,
1513270	1515250	so if you want to extend the project,
1515250	1517490	you can use them for your own purpose.
1518350	1520030	So, we have the hardware.
1520570	1522150	Now, the software.
1523110	1527970	I'm just going very briefly over the software architecture of our tool.
1527970	1530750	So, if you want to use it in the Bluetooth mode,
1530750	1532790	as a Bluetooth controller,
1532790	1534310	there's an install script for that.
1534310	1538250	You just run it on your pre-imaged Raspberry Pi
1538250	1542010	and it will set up everything which is required.
1542670	1544310	If you don't want to do it,
1544310	1545810	then just run it on your own laptop.
1545810	1548130	There's a run script for Linux.
1548130	1551370	For Windows, you just directly run the Python protocol.
1552910	1558090	The run script actually will also set up some interfaces and stuff,
1558090	1560690	but you can do this beforehand
1560690	1563430	if you do not want to execute it with pseudo-privileges,
1563430	1566190	because that's required for interface management.
1566810	1569630	Then, for emulating the game controller,
1569630	1573230	for the Bluetooth version, we used the HitPi project
1574810	1577170	to emulate a Bluetooth device,
1577170	1579310	and if you run it on your own laptop,
1579310	1581710	we used the VGamePad library,
1581710	1585530	which is also cross-platform, so it also runs on Windows.
1587330	1589590	You can also use that.
1589830	1593290	For the Bluetooth one, it doesn't really work on Windows so far,
1593290	1595570	so if you have any recommendations on that,
1595570	1597490	and are an expert on Hit devices,
1598690	1601110	also pull requests are welcome.
1602730	1609390	So, now to our actual domain components.
1609390	1610570	We have a car detector.
1610570	1612090	If you have multiple vehicles,
1612090	1614190	as we have the ID3 and the Tesla,
1614190	1616590	you can give it basically a list of CAN IDs,
1616590	1618510	and it will figure out which car it is,
1618510	1622150	and then use the according configuration.
1622470	1625410	The heart of our project is the car connector,
1625410	1629670	which will convert all the CAN signals
1629670	1634750	in the messages to triggers for the Xbox emulation.
1635290	1637770	And then there is the vehicle configuration,
1637770	1641330	which has all the vehicle-specific stuff in there.
1641330	1645150	And I'll just have a more detailed look on that.
1648490	1652110	You can configure a name for your vehicle to reference it.
1652510	1654830	Then you have to specify which operation mode,
1654830	1657590	if you want to use the internal mode or the UDS mode.
1657590	1660010	Sometimes, if you have an older car,
1660010	1662450	where there is no gateway in between the internal buses
1662450	1665250	and the OBD2 connector,
1665250	1667890	you can also use the internal mode for that.
1668390	1674790	Or if you install the OBD2 adapter for the Tesla.
1676350	1678470	Otherwise, for the UDS mode,
1678470	1681590	you will also have what you can see on the right side,
1681590	1683870	and you will have to send those polling messages
1683870	1685470	I talked about earlier.
1685470	1687250	Basically, you can just paste them in here,
1687250	1691390	and it will periodically send them to get the data.
1691390	1693870	There is also an update interval.
1694510	1696310	Usually, we have a higher interval
1696310	1699250	for the steering angle and brakes.
1699250	1701950	And for the buttons, we use a lower update interval,
1701950	1705430	because there is a limit how fast the ECUs will respond.
1706170	1707310	Also, we have some...
1707310	1710430	You can see the auto-detect IDs I mentioned before.
1710430	1714730	And also, we have some high-level configuration stuff.
1714730	1717510	For example, we limit the steering,
1717510	1718950	because if you play a racing game,
1718950	1721570	and you have to two times turn the wheel
1721570	1725290	for the maximum steering, it's just too slow, right?
1725630	1729410	And also, there is the steering dead zone,
1729410	1733110	which basically, you have a bit more space
1733110	1737490	to set your steering wheel to zero.
1737490	1740670	Because otherwise, if it's like 0.01 degrees,
1740670	1742570	and it will always go left in the menus,
1742570	1745830	or you just cannot drive straight,
1745830	1748450	it's actually pretty hard to get your steering wheel
1748450	1750310	to exactly zero degrees.
1750510	1752070	So, that's pretty handy.
1752990	1757210	I'll go a bit into detail on the signal configuration later.
1757870	1762550	But for now, let's look at how it works out.
1762550	1764230	Yeah, we are ready to play.
1764230	1767090	Unfortunately, we are not allowed to bring our car with us,
1767090	1769930	so we have brought some videos of the gaming experience.
1769930	1773710	You can see me here driving with first-person view,
1773710	1775850	playing SuperTux Kart.
1779740	1782780	You can see I control the racing car
1782780	1785700	with the steering wheel, left and right.
1785700	1787860	And now I've paused, because you can see
1787860	1790740	I put my foot on the brake.
1790880	1792860	Let's see what happens next.
1795290	1799530	As expected, the racing car slows down,
1799530	1801270	and I was overtaken.
1802450	1809690	Now, you can see I've started the indicator.
1809710	1812210	We've mapped the indicator function for left
1812210	1815590	to throwing items in this game.
1815590	1818130	You can do this for your own purpose, for your own game,
1818130	1820130	but we've mapped it like this.
1820450	1824190	So you can see here, I'm throwing this exploding muffin
1824190	1829290	to the racing car in front of me,
1829290	1831010	so it will explode.
1831010	1836790	Unfortunately, because PowerPoint is a little bit annoying,
1836790	1839230	sometimes, usually you should see
1839230	1844690	that I've turned on the full beam flash, full beam 2,
1844690	1849390	so we've mapped the full beam trigger
1849390	1853130	to the nitro activation in the game.
1853590	1856590	So it's very cool, driving in the night, igniting,
1856590	1858710	and the car speeds up.
1859930	1861050	See what happens?
1861050	1864410	You can see the nitrogen.
1864490	1869450	Now, you can see it's a little bit difficult to drive,
1869450	1872410	especially with just one hand,
1872410	1875470	but it is possible to race,
1875470	1879210	it is possible to overtake enemies in this game,
1879210	1883050	and it is also possible for you to get the right items,
1883050	1886110	in this example, an acceleration one,
1886110	1888270	to win racing games.
1893120	1895300	And it's actually a lot of fun.
1896000	1898860	You see, we're very excited about this.
1900580	1903880	So, maybe, over to Tim.
1903880	1908540	So, the question all of you probably have in your mind,
1908540	1912420	how do you support your own car to use this?
1912420	1915240	Well, before you get started on that,
1915240	1920580	just make sure you keep in mind the safety.
1920640	1924180	So, make sure you cannot accidentally drive into a wall.
1924180	1927360	Why? Because if you're in your garage,
1927360	1929300	and you're really into your game,
1929300	1932840	and by accident you switch to drive mode,
1932840	1934720	you don't want to do that.
1935500	1938660	You're probably out on the gas, right?
1938660	1941320	So, make sure you cannot do that.
1941320	1945240	Of course, there's less of a problem on combustion engine vehicles,
1945240	1949140	where you do not have to turn on the engine,
1949140	1953260	but then make sure not to drain your 12-volt battery,
1953260	1954720	like playing all night.
1956020	1961160	It's probably not good if you do not have a charger connected.
1962120	1963700	So, what do you need?
1963700	1966060	I think we talked about everything of that.
1967040	1972060	You can also use just an OBD2 open-ended cable,
1972060	1976820	if you do not want to solder your own OBD2 head.
1977220	1981100	So, that all should be less than 50 bucks, I think, to get started.
1981560	1984180	If you use the diagnostic mode,
1984180	1987900	and you have to get a diagnostic tester to reverse-engineer that,
1987900	1990020	that really depends on the car, probably.
1990020	1992400	There are sometimes some very cheap ones,
1992400	1995520	and if you have to get a garage-level one,
1995520	1997100	it's pretty expensive.
1997100	2000580	So, yeah, probably too much.
2001060	2004140	Okay, and then you can start reverse-engineering.
2004260	2007540	So, here you can see the UDS tester setup, basically.
2008540	2012080	The actuator, we are looking at a steering wheel angle, as before.
2012440	2016880	Here we have a tablet with the diagnostic tool,
2016880	2018880	which reads out the steering angle.
2018880	2023100	And here we have my laptop, which runs CanSniffer,
2023100	2024420	which is a very convenient tool
2024420	2027620	to show you the differences in car messages.
2028120	2032240	And what we'll do next is turn the steering wheel
2032240	2034420	to see where the information is.
2035300	2040460	And actually, I turn it one time completely to the left,
2040460	2043480	and one time to the right to get the min and maximum value,
2043480	2044820	which is possible for the signal,
2044820	2047300	but you have seen where it is located.
2048720	2051400	And, yeah, sometimes you're lucky,
2051400	2056340	and you will find already complete CAN database files,
2056340	2059520	those called DBC files, online for your car.
2059520	2062360	Then you can also try to get this information out of there
2062360	2064680	and use that.
2064680	2067540	But otherwise, reverse-engineering of this data is quite good
2067540	2071440	because it's like you can easily turn the steering wheel
2071440	2074040	to see where the data is, right?
2074040	2075840	It's just if there are 3,000 messages,
2075840	2079220	it might take you some time to find the right one.
2079220	2082460	Then for configuring it,
2082460	2085340	you basically add all this information, the CAN ID,
2085340	2089280	the position in the signal, and the length of the data.
2089460	2092080	And then that's why we use Python for the configuration.
2092080	2098000	You can just use a function to specify the signal mapping.
2098220	2103720	In this case, we have the first byte turning to the left,
2103720	2104940	the second to the right,
2104940	2106860	and then we specify the min and maximum value
2106860	2111180	and map this to a range of minus 1.0 to 1.0.
2112800	2118360	All right, that's what you need to configure for your own car.
2119420	2124120	In conclusion of this talk, if anybody asks you,
2124120	2126020	especially our professor,
2126020	2129760	now you definitely know that V2G stands for Vehicle-to-Game.
2131580	2134320	Car hacking can be really fun.
2134320	2136920	And I think our project is a great entry point
2136920	2138180	if you want to get into that
2138180	2143860	or just want to be able to say
2143860	2147240	that you have a very expensive game controller at home.
2148240	2150680	Always be careful if you do that stuff.
2150680	2152380	Do not drive into walls.
2153520	2156240	We actually use it, as Janis said before,
2156240	2159420	as a demonstrator to motivate students to show it to visitors.
2159420	2163340	It's always a good icebreaker to get started
2163340	2166080	about talking about automotive security.
2166620	2169840	And so the only question that remains is,
2169840	2171680	what are you going to use it for?
2178810	2180690	Feel free to contact us.
2180690	2183190	Do any contributions to our project.
2183190	2185770	Write us an email. Here you can see the QR code.
2185770	2187490	The Git repository is public,
2187490	2192850	so you can make an issue or do a pull request.
2192850	2197050	Feel free. We're happy if we can keep in contact with you.
2198610	2202890	And I think we have eight minutes left for questions, if there are any.
2202890	2206730	Otherwise, we can also take further questions offstage.
2210520	2215020	Have you thought about playing with heads-up display?
2215020	2216700	You know, you can get these things now.
2216700	2219660	You just put it on the dash and it'll actually just reflect
2219660	2225700	your iPad or anything up onto the windscreen.
2225700	2229280	And it looks like a heads-up display kind of a thing.
2229280	2230520	Have you thought about that?
2230520	2235960	Just for a way to project onto the screen.
2237520	2238760	Where's the question?
2238760	2241540	Oh yeah, so the question was if we have thought about
2241540	2247720	projecting the game, basically, onto the screen of the car.
2247720	2250680	So we've thought about that. We haven't done it.
2250680	2254620	We also thought about it because the ID3 actually has a heads-up display.
2256540	2262860	Yeah, so I think there are adapters to the protocol they use there.
2262860	2268040	And then you can use it as an HDMI interface, basically, if you plug in there.
2268040	2270660	So we have some plans, maybe, for the future.
2270660	2274400	But we actually haven't done that or tested it.
2274400	2281200	Just putting a projector in the back of the car is probably quite good.
2281200	2283120	It's not a security-related problem.
2283120	2287200	It's just throwing money on it via such a converter.
2287240	2291100	And then you can easily connect your laptop with those internal screens of the car.
2291100	2293900	That's expensive but easily doable.
2295900	2299680	Yeah, but come up with your own setup.
2299680	2302600	I think there's a lot of possibility, right?
2303140	2304100	Yeah.
2307050	2312210	The question was how if we build up a flight simulator out of this.
2312210	2315590	If you have a real airplane, maybe you can transfer this.
2317030	2318010	I don't know.
2318010	2321330	Maybe you can use also your car for this. It should be possible.
2321330	2323390	It's just an Xbox controller.
2323810	2326290	You can map it to anything you want.
2328250	2330610	Okay, any further questions? No?
2330610	2331070	No.
2331070	2331850	Alright.
2331950	2333730	Okay, thank you.
2333730	2335750	Thanks for listening and have a nice day.
2335750	2337070	Enjoy the last day of DEF CON.
