WEBVTT

00:00.000 --> 00:01.620
Thank you all for coming.

00:02.080 --> 00:04.100
Thanks DEF CON for having me up here.

00:04.360 --> 00:11.300
As Juris mentioned, I've been involved here in a lot of different ways, but this is the first time I've actually been up on the stage, so it means a lot.

00:11.560 --> 00:14.880
Do we have any car enthusiasts in the audience?

00:15.060 --> 00:16.180
Yeah, okay.

00:17.340 --> 00:20.880
Any of you ever had problems with your emissions testing?

00:21.300 --> 00:22.920
Yeah, we're going to have some fun.

00:23.960 --> 00:26.640
So I assume you all can see something.

00:26.640 --> 00:27.680
I can't see shit.

00:27.680 --> 00:33.560
But we're going to talk about the ODB2 systems in cars and what we can have fun with.

00:33.960 --> 00:36.880
So this is a car I bought about ten years ago.

00:36.880 --> 00:41.320
It's a fun go-kart of a car.

00:41.820 --> 00:44.220
It has a little quirk about it.

00:44.220 --> 00:45.800
Anybody know what this car is?

00:45.800 --> 00:46.480
Anybody?

00:47.160 --> 00:50.460
Yeah, so we've got the Wankel rotary motor in it.

00:50.880 --> 00:54.920
And specifically, these things love to kill catalytic converters.

00:57.200 --> 01:01.540
But at the time, I was living in Kansas City, and they don't do emissions testing.

01:01.800 --> 01:04.200
Oh, by the way, did he mention SetKC?

01:04.200 --> 01:06.740
Yeah, so we'll wrap around to that.

01:07.880 --> 01:09.960
So, you know, it's not there.

01:09.960 --> 01:10.940
We don't have to worry about it.

01:10.940 --> 01:14.600
So I enlisted my little helper, and we were like, fuck that, get it out of here.

01:15.320 --> 01:17.920
So life was good for about eight years.

01:18.480 --> 01:21.940
Then I decided, well, let's move to the West Coast.

01:22.020 --> 01:25.980
Turns out, they don't like that so much around here.

01:26.620 --> 01:31.960
However, as I was digging into the laws, they had this statute that got me kind of excited.

01:32.020 --> 01:37.800
It said for collectible vehicles, we don't do emissions testing.

01:37.800 --> 01:39.980
I'm thinking, well, this car is kind of unique.

01:39.980 --> 01:40.800
It's old.

01:40.800 --> 01:41.800
They don't make it anymore.

01:41.800 --> 01:43.940
It's the last time they made this type of motor.

01:44.840 --> 01:47.520
So I'm like, yeah, let's start digging into this.

01:47.520 --> 01:50.960
And then, you know, used infrequently, sign me up, right?

01:52.180 --> 01:53.780
This is how I'm going to get in.

01:53.780 --> 01:56.500
But then they had this last little thing at the end.

01:56.500 --> 02:03.860
It's like, every person must have, every person who's of a driving age in your house must also have another car.

02:04.980 --> 02:08.520
I've been working from home for like, ever.

02:08.680 --> 02:14.060
And I drive this car less than 5,000 miles a year, maybe once a week, right?

02:14.060 --> 02:23.920
So not only do I have to have this car that I never drive, but I have to have another car registered to me that I never drive, right?

02:23.920 --> 02:26.200
And motorcycles don't count.

02:26.320 --> 02:29.500
Lots of other fun little things don't count.

02:29.500 --> 02:36.700
You have to have a car that you can drive every single day, regardless of the fact that my wife works from home, I work from home, we take the kids to school.

02:36.700 --> 02:37.660
That's it, right?

02:37.660 --> 02:39.720
So we're like, well, glad.

02:39.880 --> 02:43.800
I'm kind of a hoarder, so I still have the catalytic converter and all that kind of crap.

02:43.800 --> 02:44.720
Put it back in.

02:45.640 --> 03:00.820
A thing about that, if you don't ever have to do emissions testing, and it's never a concern of yours, if you just put the stuff back in there and you go and try and get it tested, there's this thing that happens in the computer that they don't really ever tell you about unless you have to deal with it.

03:02.420 --> 03:05.220
I was like, what the fuck does it mean to not be ready?

03:05.400 --> 03:14.820
And you dig into it, and I pull up the service manual, and sure enough, after you reinstall these parts, and it turns out any time you reset the battery, you're going to have to go through the cycle.

03:15.040 --> 03:22.340
Drive the car up to a certain speed, let it idle for so long, and meanwhile you have to have the air conditioner off and all that stuff.

03:22.340 --> 03:24.240
Did I mention I live in the desert?

03:25.020 --> 03:30.560
Driving a car around for 40 minutes to do this with the air conditioner off is not fun.

03:30.580 --> 03:37.540
But I tried for months doing this thing while in the time that I don't actually drive this car.

03:38.180 --> 03:42.140
And I just can't get rid of these goddamn readiness monitors.

03:42.140 --> 03:44.920
And so I'm like, what the hell?

03:46.000 --> 03:48.360
So let's throw back to DEF CON 26.

03:48.460 --> 03:49.680
Mentioned I was tech Casey.

03:49.680 --> 03:51.340
Anybody heard of the badge pirates here?

03:52.320 --> 03:55.020
So this was their first badge they made.

03:55.260 --> 04:00.340
As part of a tech Casey kind of let's have fun, we're going to be part of badge life, blah, blah, blah.

04:01.280 --> 04:10.680
And as part of it, I made this little add-on to my badge and hooked it into the ECU and it could read the oil temperature and water temperature and stuff.

04:10.680 --> 04:12.600
So I was like, yeah, I've done this before.

04:12.600 --> 04:15.840
At the time it was a UART adapter, no problem.

04:16.360 --> 04:19.980
It's a little high-level, but really how hard can it be?

04:20.040 --> 04:23.580
So I start digging into the protocol.

04:23.580 --> 04:25.780
There's an authentication mechanism in the front.

04:25.780 --> 04:30.000
We're like, okay, I've got to bypass that at some point, right?

04:30.000 --> 04:31.680
There's something that's going to happen.

04:31.780 --> 04:36.500
Anybody who's familiar with Canvas right now is going, oh, yeah, okay, I know where this is going.

04:36.800 --> 04:40.020
A basic data frame.

04:41.060 --> 04:45.320
As I dug in to the next part, by the way, the references for all these are on there.

04:45.320 --> 04:46.000
I'm not going to go there.

04:46.000 --> 04:46.900
We only have 20 minutes.

04:46.900 --> 04:47.920
We're going to keep this moving.

04:48.660 --> 04:52.200
Zero to eight are the possible authentication IDs, okay?

04:52.200 --> 04:57.100
So when I saw that is the moment when I went, you know what, maybe I don't have to do this the right way.

04:57.100 --> 05:01.240
I can just kind of tell the computer to do what I want it to do.

05:01.840 --> 05:08.560
So I did what any sane person would do and put together a thread board that let me hook up a logic analyzer.

05:09.040 --> 05:10.680
That's kind of what it looks like.

05:10.680 --> 05:15.840
You can buy these things off of Amazon for a couple of bucks and you hook them up.

05:16.660 --> 05:33.420
But then you plug in a logic analyzer and anybody who is familiar with Canvas knows this part, but anybody who's just kind of getting into analyzing hardware signals, you'll notice that the signal never goes near zero.

05:33.420 --> 05:40.560
So you have it's plus 2.5 up or down over 1.7 volts, I believe.

05:41.260 --> 05:45.780
And it's inverted together to cancel noise and all that stuff.

05:45.780 --> 05:53.500
So if you want to be able to use like a Salia logic analyzer or any of the cheaper stuff, you need to do a little bit of messing around.

05:53.500 --> 05:57.420
So this is what we call a DC filter or an AC coupling.

05:57.420 --> 06:05.320
And you're essentially just removing that low level DC voltage from the signal so that you can get something like this.

06:05.560 --> 06:12.100
And also I added a cap in there that rounds off the top so you get a nice square wave, but square being relative.

06:12.940 --> 06:14.340
So now we see data, right?

06:14.340 --> 06:17.080
At the top of the screen we can see it's actually starting to parse data.

06:17.080 --> 06:24.360
We're not going to dig into it too much, but at least we can confirm what we read in the document is what we're seeing, right?

06:24.360 --> 06:25.300
It's good.

06:25.400 --> 06:30.200
But what I really wanted to do was, hey, how can I respond to this thing in a programmatic way?

06:30.560 --> 06:33.900
So these things now, they don't even bother to separate them.

06:35.040 --> 06:36.840
I can't fucking see the screen.

06:38.560 --> 06:39.360
Sorry.

06:40.560 --> 06:42.840
You pay six bucks for six of these.

06:42.840 --> 06:43.680
They don't split them up.

06:43.680 --> 06:44.820
You just pop them off or whatever.

06:44.820 --> 06:46.820
But these are your transceivers.

06:46.820 --> 06:49.680
I have ESP32s laying around the house.

06:49.680 --> 06:52.360
Anybody who plays with these kind of things have them, right?

06:52.380 --> 06:56.220
It has a built-in CAN bus controller, but it doesn't have a transceiver.

06:56.220 --> 06:57.300
So you need one of these.

06:57.300 --> 06:58.260
They're a couple of bucks.

06:58.260 --> 07:01.640
You get them off of Amazon, plug it in, and then you can start seeing this kind of stuff.

07:01.640 --> 07:08.080
It's actually acknowledging packets instead of just being able to listen to it.

07:08.820 --> 07:14.100
So as we dig in a little bit deeper, we see there's the identifier field, but just fixed, by the way.

07:14.100 --> 07:17.840
The zero is the ECU, so you just tell it you're the ECU.

07:17.860 --> 07:20.580
You tell it this is the received packet from the scanner.

07:20.580 --> 07:23.280
It's saying, well, there's a link, there's a service, there's a PID.

07:23.320 --> 07:37.000
Turns out there's this handy little thing called Wikipedia that you go in and you look it up, and it tells you exactly what it's looking for, and then you go back to the other page where they have this little decoder tool that says, oh, I can't, you know,

07:37.000 --> 07:41.240
if you receive this message, this is how you want to respond and construct the frame.

07:41.660 --> 07:44.780
So we have a response , right?

07:44.780 --> 07:46.820
So now you can see it's being sent on both.

07:46.820 --> 07:51.280
It's a response on both sides when you send a message.

07:51.280 --> 07:53.980
So echo, I believe is what we call it.

07:53.980 --> 08:01.100
But then we have this error that happens right after we respond to the goddamn thing, and this is what happens.

08:01.100 --> 08:10.240
So this is a little cheap scanner you can buy anywhere that I just use for clearing messages and stuff, but the goal at first was, like, can I even fool this thing?

08:11.340 --> 08:14.580
That screen I looked at for probably two months.

08:15.360 --> 08:18.660
Turns out these kinds of things are pretty complicated.

08:18.660 --> 08:21.220
It's just so many different layers that you're worried about.

08:25.100 --> 08:29.080
Yeah, you just got to make sure you're keeping track of every little piece.

08:29.260 --> 08:37.380
And it didn't help that at this time I had lots of friends on Twitter going, AI coding agents are awesome, you should really look into these, blah, blah, blah.

08:37.380 --> 08:44.620
I'm thinking, great, I'm in this really, really complicated project, now's a great time for me to start exploring AI coding tools.

08:47.100 --> 08:54.400
Malicious ignorance is about the best word or phrase I can come up with to describe that experience.

08:55.660 --> 08:57.920
Something it's really, really good at.

08:58.140 --> 09:05.520
The, like, writing registers, reading back registers, debugging information, all that kind of crap it was really, really great at.

09:05.520 --> 09:15.600
It thinks about hardware like a high school level kid who just read a book on hardware thinks, right?

09:15.600 --> 09:20.500
It had convinced me that I knew nothing about hardware at all.

09:20.680 --> 09:25.580
And the protocols were just garbage and everything that I thought I knew was just terrible.

09:26.120 --> 09:27.480
Don't listen to it, right?

09:28.140 --> 09:31.140
Half of what we're going to do with these things is figure out how to teach them.

09:31.140 --> 09:50.020
But in the process, I ended up actually abandoning the entire design of the original one, digging in a little bit deeper, I learned the canvas controller on this thing is actually kind of a pseudo copy of whatever the SDA 1000 proper one was, and there's some details that they don't expose that you really need to know when you're figuring out all the timing and all that kind of crap.

09:50.020 --> 09:59.720
So I went with an external spy controlled one, which has the secondary benefit of later on, I actually wanted to proxy on the same board without having to, like, chain two ESPs together.

09:59.720 --> 10:02.300
So I'm like, I know I can run multiple spy buses.

10:02.380 --> 10:04.720
I'm sorry if I'm high leveling some of this stuff.

10:04.960 --> 10:06.500
You're just going to have to look it up later.

10:06.500 --> 10:07.700
We only have 20 minutes.

10:09.620 --> 10:12.840
But, yeah, faster, faster, faster.

10:12.840 --> 10:19.120
So we've gone through, we have it working, and sure enough, we have a working response to the scanner.

10:19.140 --> 10:25.920
This is very, very phase one, gone through all this, but within the end of the day, we have this thing reading out exactly what we want.

10:25.920 --> 10:31.040
So these are the same screens that we saw earlier where I was like, god damn, I just can't get it to do what I want.

10:31.040 --> 10:38.780
Now I've proven this concept of, like, okay, we can actually show that we can convince this little crappy scanner to do what we want.

10:39.000 --> 10:47.280
So, you know , I have an emulator working, and I had some working knowledge of the AI thing, and I forked it off and said, hey, turn it into a proxy for me, let's see what happens.

10:47.280 --> 10:48.460
It can't hurt, right?

10:48.560 --> 10:52.040
So it turns out, it actually didn't do a real bad job.

10:53.180 --> 11:06.160
But the ultimate incarnation of this thing is you've got the two breakout boards, one goes to your scanner side, one goes to your ECU side, and installed, it looks like this.

11:06.160 --> 11:13.180
I mean, it looks, if you've ever crawled under the dashboard and looked at your ODB2 plug, you've got a legit-looking thing.

11:13.180 --> 11:14.180
That's part of the thing.

11:14.600 --> 11:30.580
And I should mention, too, in the state where I live, which I haven't said what it is, but the rule is, it doesn't matter, as long as there's no check engine light and they can plug the thing in and it reads what it wants to read and it gets an okay, then it says,

11:30.580 --> 11:31.560
yeah, it's going to work.

11:32.720 --> 11:36.100
So we have a video.

11:41.510 --> 11:45.390
So it starts off just, you've got to start the motor when you get up there.

11:46.090 --> 11:51.710
It gets it running, make sure the, come on, move it a little faster.

11:53.330 --> 11:59.150
So we can see the DAS is running, we have RPMs, it's all working the way you would expect it to.

11:59.430 --> 12:03.230
Then we get our ODB2 tester out.

12:04.330 --> 12:05.970
That one, we plug it in.

12:05.970 --> 12:07.990
This is your factory configuration.

12:12.150 --> 12:20.670
I know it feels like an eternity when I've been talking this fast, but really, it just, so you can see, it run the scan, it can't really see with the lights, huh ?

12:20.670 --> 12:27.070
But it's showing, like, there are two incomplete, or actually more than that in this case, because I had reset the motor.

12:27.070 --> 12:28.990
Running through them, doesn't work.

12:30.270 --> 12:42.550
So I reach under there and just kind of move the, pull that cable out, plug in the adapter and then tuck it back under the dashboard and I'll just skip forward in the video a second.

12:47.670 --> 12:48.770
There we are.

12:48.990 --> 12:56.190
It took about two minutes total to do this, if you can see the time stamp, but I'm impatient, so come on.

12:56.530 --> 12:57.250
Okay, there we are.

12:57.250 --> 13:07.030
We have it plugged in with the photo that you saw before and we can see we have zero codes, monitors, zero incomplete and 11 ready.

13:07.190 --> 13:10.050
So that's, we have it working.

13:12.630 --> 13:19.810
I chose specifically not to include any kind of active testing in this presentation.

13:19.870 --> 13:23.070
You can extrapolate from that what you want.

13:23.410 --> 13:30.530
But you can go to this website as of right after this talk and download the code for this and all the instructions on how to build it.

13:30.730 --> 13:32.030
So have fun.

