Tesla Model 3 Rear Drive Unit Closed Source CAN Hacking

Topics concerning the Tesla front and rear drive unit drop-in board
P.S.Mangelsdorf
Posts: 1083
Joined: Tue Sep 17, 2019 8:33 pm
Location: Raleigh, NC, USA
Has thanked: 236 times
Been thanked: 278 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by P.S.Mangelsdorf »

AMP3R wrote: Wed Sep 25, 2024 1:54 pm The funny thing is that there is no info anywhere on google that anyone has even tried to run this motor as is, without messing with inverter, and in fact there is no one to even ask.
I met someone on Drag Week (a spectator) who said he had a build using one of the Canadian Model 3 controllers (I think it was Ingenext). It sounded like the drive units were unmodified.

From what I've seen it's only those of you here on OI trying to get these running without a commercial controller. It does look like those commercial controllers might reprogram something, but not clear what.
If at first you don't succeed, buy a bigger hammer.

1940 Chevrolet w/ Tesla LDU - "Shocking Chevy" - Completed Hot Rod Drag Week 2023 and 2024

https://www.youtube.com/@MangelsdorfSpeed
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

After playing with the motor for a while, I realized why the inverter doesn't switch into STANDBY mode.

Active errors: DIR_a144_configMismatch, DIR_a062_systemLimpMode, DIR_a092_bmsMIA.
Screenshot from 2024-09-28 02-10-25.png
Screenshot from 2024-09-28 02-10-53.png
Screenshot from 2024-09-28 02-10-01.png
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

I noticed that DIR_a144_configMismatch is triggered by two messages 0×392 (info about battery) and 0×7FF (car config)

We can say that this is a fundamental error and because of it the motor will not spin.
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

I figured out the 0×392 BMS_packConfig message, which triggers the DIR_a144_configMismatch error.
Just corrected the maximum voltage to 387 and the error disappeared.
Screenshot from 2024-10-07 15-21-17.png
Screenshot from 2024-10-07 15-21-41.png
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

The first frame from the multiplexed message 0×7FF about the car config is ready. It turned out that all bits can be empty except bit 56
mux1.png
The second frame can be completely empty.
mux2.png
The third needs information about GTW_perfomancePackage, GTW_chassisType and GTW_packEnergy. Everything else can be zero.
mux3.png
The fourth can be completely empty.
mux4.png
The fifth can be completely empty.
mux5.png
The sixth is also empty.
mux6.png
DIR_a144_configMismatch goodbye
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

The main system errors have disappeared, but the inverter does not switch to STANDBY mode yet. Any ideas?
Screenshot from 2024-10-09 21-45-08.png
Screenshot from 2024-10-09 21-45-29.png
Screenshot from 2024-10-09 21-45-40.png
davefiddes
Posts: 293
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 75 times
Been thanked: 95 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

You look like you have a lot of happy systems there to my uneducated eyes. Have you got a capture of a working Tesla of a similar vintage to compared against?
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

davefiddes wrote: Wed Oct 09, 2024 8:59 pm You look like you have a lot of happy systems there to my uneducated eyes. Have you got a capture of a working Tesla of a similar vintage to compared against?
Please look.
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

vehicle can park.csv
(889.77 KiB) Downloaded 574 times
davefiddes
Posts: 293
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 75 times
Been thanked: 95 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by davefiddes »

I'll have a peek though I'm not sure there's much I can make of it. I guess I was more asking as to whether you had access to enough in the way of captures. Just looked at the price of second hand Model 3s and they're really quite affordable...hoping that someone with one and a sense of adventure would be able to help you out with on-going CAN captures.
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

Ok
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

Can anyone tell what DI_limitVBatHigh, DIR_ssmState, DIR_usmState and DIR_fluxState are?
Screenshot from 2024-10-12 17-47-09.png
Screenshot from 2024-10-12 17-47-41.png
Screenshot from 2024-10-12 17-48-09.png
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

My drive unit probably has last one active error DIR_a155_vcfrontMIA (The DI ECU is not receiving the expected CAN communication from the VCFRONT, and considers it irrational or MIA)

I assume that this is due to the message 0×3A1. Who knows, does it definitely come from VCFront?
Screenshot from 2024-12-19 01-06-32.png
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

A few days ago I had an idea to take another close look what the inverter sends to the vehicle CAN and after poking around found something interesting. It turns out that there are many more ids with alerts and errors than I thought. By simple calculations edited the dbc file and when turned on the drive unit I was stunned.

Of course, nothing will work, because the DI_a174_notOkToStartDrive alert is active. The logic lacks 12 volts, which I supply from a regular ATX power supply. If this turns out to be the cause, it will be very funny. But it is too early to rejoice.
Screenshot from 2025-02-02 21-54-41.png
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

It's interesting to look how the immobilizer works.
Screenshot from 2025-02-17 21-00-20.png
As soon as the inverter recieved the 0×221 (VCFRONT_LVPowerState) message, it shoots 0×276 to the CAN vehicle for a split of second. This is a challenge for the VCSEC.

Meanwhile, the VCSEC is already ready and when you put the key card, it responds with the 0×3D9. That's it - the immo is unlocked.

The 0×276 challenge message is always new every time the inverter is restarted. After looking on its structure, I dare to assume that it has 65536 possible combinations.

The 0×276 and 0×3D9 messages are tightly linked. To verify this, I generated static challenge for my VCSEC several times in a row and the response at 0×3D9 was the same. During the experiment, the inverter was turned off.

In short how it works:

1. The motor sends a challenge.
2. VCSEC responds with a value calculated using a one-way hash function based on the challenge and the secret.
3. The motor checks the response using its own calculation of the expected hash value. If the values ​​match, authentication is confirmed.

For fun, it's possible to record the entire range of challenge/response pairs (65536), make look up table and try to replay these answers to the drive unit.
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

Keyless driving enabled. This means that you can run the motor without a key card, but with the VCSEC connected.
photo_2025-02-22_17-23-10.jpg
User avatar
jetpax
Posts: 50
Joined: Wed Jan 01, 2020 12:33 am
Has thanked: 20 times
Been thanked: 23 times
Contact:

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by jetpax »

AMP3R wrote: Mon Feb 17, 2025 6:56 pm While my bench power supply is on its way from China, I wanted to look how the immobilizer works.

Screenshot from 2025-02-17 21-00-20.png

As soon as the inverter logic has power and VCFRONT transmits the 0×221 (VCFRONT_LVPowerState) message, it (inverter) shoots the 0×276 message to the CAN vehicle for literally a split second. This is a challenge for the VCSEC.

Meanwhile, the VCSEC is already ready and when you put the key card, it responds with the 0×3D9 message for about one second. That's it - the immobilizer is unlocked.

The 0×276 challenge message is new every time the inverter is restarted. After looking on its structure, I dare to assume that it has 65536 possible combinations.

The 0×276 and 0×3D9 messages are tightly linked. To verify this, I generated the same challenge for my VCSEC several times in a row and the response in 0×3D9 was the same. During the experiment, the inverter was turned off.

In short, for those who did not understand how it works:

1. The motor sends a challenge.
2. VCSEC responds with a value calculated using a one-way hash function based on the challenge and the secret.
3. The motor checks the response using its own calculation of the expected hash value. If the values ​​match, authentication is confirmed.

What secret is stored in VCSEC, a big big secret.

For fun, you can record the entire range of challenge/response pairs (65536) This will take about 18 and a half hours. But in fact, this method is of little use, since it will only work on a specific motor.
Great job!

So are you saying that if i record these 65536 challenge responses for a paired motor/VCSEC, then i could dump the motor firmware and flash it into another motor and the new motor should authenticate?
“Take the best that exists and make it better”
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

:)
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

:)
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

jetpax wrote: Sat Feb 22, 2025 3:14 pm Great job!

So are you saying that if i record these 65536 challenge responses for a paired motor/VCSEC, then i could dump the motor firmware and flash it into another motor and the new motor should authenticate?
A small update for you. It's impossible to dump the inverter flash via CAN, because Tesla disabled UDS service 0×35 Request data upload.
Refasol123
Posts: 1
Joined: Sat Mar 15, 2025 10:15 am

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by Refasol123 »

Hi everyone,
First of all congratulations for the amazing work that you've done here.

I am an electronics student and I want to use the inverter of a m3 front du just to measure some parameters (efficiency, temperature...) as part of a project. I would greatly appreciate it if someone could guide me a bit on how to get started with the purpose of enabling the inverter and controlling some parameters.
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

AMP3R wrote: Sun Feb 02, 2025 9:18 pm A few days ago I had an idea to take another close look what the inverter sends to the vehicle CAN and after poking around found something interesting. It turns out that there are many more ids with alerts and errors than I thought. By simple calculations edited the dbc file and when turned on the drive unit I was stunned.

Of course, nothing will work, because the DI_a174_notOkToStartDrive alert is active. The logic lacks 12 volts, which I supply from a regular ATX power supply. If this turns out to be the cause, it will be very funny. But it is too early to rejoice.
Screenshot from 2025-02-02 21-54-41.png
The new power supply didn't help, which means the problem is somewhere in the can messages.
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

It works. Switches to D and R, but for some reason immediately returns to P. Also, a new alert DI_a125_noBatteryPower appeared.
Screenshot from 2025-03-30 16-11-04.png
Screenshot from 2025-03-30 16-11-21.png
20250330_163059.jpg
RadioKot
Posts: 9
Joined: Sun Jul 28, 2024 4:02 am
Has thanked: 4 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by RadioKot »

Congratulations on your success! You’ve done a great job, and the results speak for themselves. It’s clear that you know what you’re doing and are moving in the right direction. Keep it up!
AMP3R
Posts: 125
Joined: Sun Oct 09, 2022 8:32 pm
Has thanked: 2 times
Been thanked: 53 times

Re: Tesla Model 3 Rear Drive Unit Hacking

Post by AMP3R »

Post Reply