E90Post
 


The Tire Rack
 
BMW 3-Series (E90 E92) Forum > E90 / E92 / E93 3-series Powertrain and Drivetrain Discussions > NA Engine (non-turbo) / Drivetrain / Exhaust Modifications > I cloned my MSV70 DME



Reply
 
Thread Tools Search this Thread
      12-07-2016, 04:15 PM   #1123
rjahl
Colonel
rjahl's Avatar
996
Rep
2,287
Posts

Drives: Z4 35is
Join Date: Jun 2011
Location: Tampa

iTrader: (0)

Garage List
2012 Z4 35is  [0.00]
Quote:
Originally Posted by hassmaschine View Post
It works!

OK, so I'm a dumbass - and it was because I never corrected the checksum in the program space. Durrrrr. Anyway - it definitely worked to use the parameter RSA key & ranges. I set it as 2 segments and zero'd the rest.

Of course, I realized also that in my 0da test file, I neglected to correct the checksum there as well... so that one wouldn't work. I'll correct it and give it another go at flashing a modified 0da (which is the second step anyway).
Very cool!!!
Appreciate 0
      12-07-2016, 05:19 PM   #1124
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

Ok so I think the reason my modified 0da write didn't work is because I used the wrong file to build my 0pa - it had the RSA key mods but not the RSA delete. :|

it's a comedy of errors..
Appreciate 0
      12-07-2016, 06:04 PM   #1125
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Quote:
Originally Posted by hassmaschine View Post
Ok so I think the reason my modified 0da write didn't work is because I used the wrong file to build my 0pa - it had the RSA key mods but not the RSA delete. :|

it's a comedy of errors..
Haha, I've made the same sort of mistake several times myself. But so far it sounds like it should work. In which case we've completely circumvented the security.

Would be interesting to see if we could use a similar method for the MSx80/1 (and newer?). Have to be careful with boot sector mods there though since BDM isn't an option - could result in complete bricks.

Last edited by Terraphantm; 12-07-2016 at 06:16 PM..
Appreciate 0
      12-07-2016, 07:00 PM   #1126
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

I looked at it the other day and i think it will work there too.
Appreciate 0
      12-07-2016, 08:11 PM   #1127
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

MSS6x is probably feasible too. Public key is present in the 0PA.

Looks to be the case in the MSD8x too (can't verify it's the public key without disassembling, but it's declared pretty much in the same format as all the other DMEs and the MD5/SHA1 table follows immediately after... so probably public key)

Last edited by Terraphantm; 12-07-2016 at 08:22 PM..
Appreciate 0
      12-07-2016, 08:49 PM   #1128
rjahl
Colonel
rjahl's Avatar
996
Rep
2,287
Posts

Drives: Z4 35is
Join Date: Jun 2011
Location: Tampa

iTrader: (0)

Garage List
2012 Z4 35is  [0.00]
Quote:
Originally Posted by Terraphantm View Post
MSS6x is probably feasible too. Public key is present in the 0PA.

Looks to be the case in the MSD8x too (can't verify it's the public key without disassembling, but it's declared pretty much in the same format as all the other DMEs and the MD5/SHA1 table follows immediately after... so probably public key)
No, no, next hat trick needs to be the ZF TCU.
Appreciate 0
      12-07-2016, 09:16 PM   #1129
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Well I picked a random GKE 0PA, and also found what appears to be a public key near MD5 tables.

Looks like pretty much all of the contemporary BMW units may have the same flaw. Ironically, the MS45, which was one of their first DMEs with RSA, is also more secure (ignoring the small keys) since the boot sector isn't writeable over OBD.

My next project will probably be to try and figure out how to generate a signature myself (512-bit keys which are in the early stuff are crackable with today's consumer hardware in 1-2 weeks)
Appreciate 0
      12-07-2016, 10:01 PM   #1130
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

On another note, I've been taking a closer look at those values that I've been calling "keys", and I don't think they're keys directly. A good RSA key is a factor of 2 primes of about the same size. But I've just been doing some factoring, and nearly all of them have at least a few small factors (some are also even numbers, which means one factor is 2 by definition).

I don't think it is an endianness issue since I get bad keys when going to little endian too

What I do know is that changing even a single bit in those values does break the signature validation. So they're definitely related to RSA. But I suspect they're manipulated in some fashion before being used for decryption.

Last edited by Terraphantm; 12-07-2016 at 10:06 PM..
Appreciate 0
      12-08-2016, 06:55 AM   #1131
rjahl
Colonel
rjahl's Avatar
996
Rep
2,287
Posts

Drives: Z4 35is
Join Date: Jun 2011
Location: Tampa

iTrader: (0)

Garage List
2012 Z4 35is  [0.00]
Damm. Who has a spare megatronics unit from a first generation 6 speed ZF auto that they can donate for a good cause?

ZF 6HP19.

Don't need a functioning valve body just the ECU.
Appreciate 0
      12-08-2016, 07:13 AM   #1132
dstrickland
Banned
329
Rep
325
Posts

Drives: BMW 06 325I
Join Date: Mar 2016
Location: Atlanta, Ga, USA

iTrader: (0)

Quote:
Originally Posted by rjahl View Post
Damm. Who has a spare megatronics unit from a first generation 6 speed ZF auto that they can donate for a good cause?

ZF 6HP19.

Don't need a functioning valve body just the ECU.
I'm donating a 2nd gen to Hass when I get back in January. I've got a few EGS laying in a box, but I think their all 5hp from some older e53's.
Appreciate 1
rjahl996.00
      12-08-2016, 08:39 AM   #1133
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

yeah, I thought that too. The trick is if there are 2 "keys" (or hashes, or whatever) that we can use to trick the security routine. I'm not sure if the EGS has a seperate parameter/program space like the DMEs do.

I have an OBD read I tried to disassemble but I'm not confident that it's a good file. Either that or there's way, way less code in an EGS than there is inside a DME (a good possibility).

Not out of the woods yet. Still need to have a successful 0pa write (done a few times now), followed by a modified 0da write. So far, I've only been able to write a modified 0da after flashing the RSA delete over BDM.

Also, I seem to have problems getting it to flash even after a clean write back to a stock file. I have to restart the DME/WinKFP several times before it will flash. I know immediately if it's going to work by how the DCAN cable lights blink (short flashes = sucess, long flashes = fail).

It's really frustrating because it will fail several times in a row, and then suddenly it will start - it's not at the end either, it's right at the beginning before it's even sent anything to the DME. Both 0pa and 0da files, stock and modified..

Last edited by hassmaschine; 12-08-2016 at 08:44 AM..
Appreciate 0
      12-08-2016, 09:26 AM   #1134
rjahl
Colonel
rjahl's Avatar
996
Rep
2,287
Posts

Drives: Z4 35is
Join Date: Jun 2011
Location: Tampa

iTrader: (0)

Garage List
2012 Z4 35is  [0.00]
Quote:
Originally Posted by hassmaschine View Post
yeah, I thought that too. The trick is if there are 2 "keys" (or hashes, or whatever) that we can use to trick the security routine. I'm not sure if the EGS has a seperate parameter/program space like the DMEs do.

I have an OBD read I tried to disassemble but I'm not confident that it's a good file. Either that or there's way, way less code in an EGS than there is inside a DME (a good possibility).

Not out of the woods yet. Still need to have a successful 0pa write (done a few times now), followed by a modified 0da write. So far, I've only been able to write a modified 0da after flashing the RSA delete over BDM.

Also, I seem to have problems getting it to flash even after a clean write back to a stock file. I have to restart the DME/WinKFP several times before it will flash. I know immediately if it's going to work by how the DCAN cable lights blink (short flashes = sucess, long flashes = fail).

It's really frustrating because it will fail several times in a row, and then suddenly it will start - it's not at the end either, it's right at the beginning before it's even sent anything to the DME. Both 0pa and 0da files, stock and modified..
Are you pulling power from the DME between flashes? Flash voltage?
Appreciate 0
      12-08-2016, 10:02 AM   #1135
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

Typically yes, but it doesn't seem to matter (actually, I have better luck if I don't reset it). I have plenty of power - about 15v.

It's not like it starts flashing and then fails - it never begins at all. WinKFP does its file check, then it spends a few seconds trying to talk to the DME, and then it errors out.
Appreciate 0
      12-08-2016, 11:54 AM   #1136
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Quote:
Originally Posted by hassmaschine View Post
Typically yes, but it doesn't seem to matter (actually, I have better luck if I don't reset it). I have plenty of power - about 15v.

It's not like it starts flashing and then fails - it never begins at all. WinKFP does its file check, then it spends a few seconds trying to talk to the DME, and then it errors out.
What's the latency of your cable set to? And are you using CAN or K-line for comms?
Appreciate 0
      12-08-2016, 12:22 PM   #1137
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

I never looked at it TBH. It's probably the issue.

Honestly, I don't know if it's using Kline or DCAN. it's a DCAN cable - but I have both hooked up to the OBD port so I can use PAsoft to make RAM dumps.
Appreciate 0
      12-08-2016, 01:15 PM   #1138
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Quote:
Originally Posted by hassmaschine View Post
yeah, I thought that too. The trick is if there are 2 "keys" (or hashes, or whatever) that we can use to trick the security routine. I'm not sure if the EGS has a seperate parameter/program space like the DMEs do.
I think they do since they have 0PAs and 0DA files. Things like the alpina tune are equivalent to changing the parameter space.
Appreciate 0
      12-08-2016, 02:10 PM   #1139
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

Latency is already 1. Other ideas?
Appreciate 0
      12-08-2016, 02:13 PM   #1140
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Quote:
Originally Posted by hassmaschine View Post
Latency is already 1. Other ideas?
I would try temporarily disconnecting either the CAN lines or the K-line. And if you decide to use CAN, make sure the bus resistance is correct.
Appreciate 0
      12-08-2016, 03:07 PM   #1141
hassmaschine
Major General
United_States
3965
Rep
7,215
Posts

Drives: "NBO" 330i
Join Date: Jun 2014
Location: earth

iTrader: (0)

I think that was my problem. I unplugged the K-line pin and it flashes every time.

Still haven't successfully flashed a modified 0da after the modified 0pa. I think I need to make sure I reboot the DME first - it looks like it doesn't move any of the data from the 0x60000 - 0x7FFFF block until after a reboot. Or at least, after my 0da write failed, I pulled a read with BDM and the RSA routine and boot sections were still unmodified.

However, flashing the modified file via BDM, it will take a modified 0da every time. So I'm close.

Edit: It isn't copying anything from 0x60000 - 0x7FFFF to the boot sector for some reason. I rebooted it several times and the original boot code is still there.

Last edited by hassmaschine; 12-08-2016 at 03:41 PM..
Appreciate 0
      12-08-2016, 07:57 PM   #1142
rjahl
Colonel
rjahl's Avatar
996
Rep
2,287
Posts

Drives: Z4 35is
Join Date: Jun 2011
Location: Tampa

iTrader: (0)

Garage List
2012 Z4 35is  [0.00]
Quote:
Originally Posted by hassmaschine View Post
I think that was my problem. I unplugged the K-line pin and it flashes every time.

Still haven't successfully flashed a modified 0da after the modified 0pa. I think I need to make sure I reboot the DME first - it looks like it doesn't move any of the data from the 0x60000 - 0x7FFFF block until after a reboot. Or at least, after my 0da write failed, I pulled a read with BDM and the RSA routine and boot sections were still unmodified.

However, flashing the modified file via BDM, it will take a modified 0da every time. So I'm close.

Edit: It isn't copying anything from 0x60000 - 0x7FFFF to the boot sector for some reason. I rebooted it several times and the original boot code is still there.
If you want more confusion, I posted another file in the Dropbox link I sent the other day. This time, I pulled the plug on the galletto ODB when it had finished about 90% of the write routine. A quick look at the bin tells me that a lot more then just the 0x60000 through 0,X7FFFFF is moved at the end of the flash.
Appreciate 0
      12-08-2016, 07:59 PM   #1143
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Quote:
Originally Posted by hassmaschine View Post
I think that was my problem. I unplugged the K-line pin and it flashes every time.

Still haven't successfully flashed a modified 0da after the modified 0pa. I think I need to make sure I reboot the DME first - it looks like it doesn't move any of the data from the 0x60000 - 0x7FFFF block until after a reboot. Or at least, after my 0da write failed, I pulled a read with BDM and the RSA routine and boot sections were still unmodified.

However, flashing the modified file via BDM, it will take a modified 0da every time. So I'm close.

Edit: It isn't copying anything from 0x60000 - 0x7FFFF to the boot sector for some reason. I rebooted it several times and the original boot code is still there.
Spitballing, but think that could be related to not having the BSU update in WinKFP enabled?

Edit: My MSV70 came in early. Just took a BDM read of it, and now I'll play around with RSA.

Edit 2: Well I got about as far as you. Can flash an arbitrary 0PA without tripping the signature check, but boot3 doesn't appear to actually be copied to 0x20000. Activating Boot Sector Update in WinKFP made no difference.

Maybe there's some sort of version check? If the new boot3 is newer than what's present, it'll copy it, otherwise it won't?

Last edited by Terraphantm; 12-08-2016 at 11:26 PM..
Appreciate 0
      12-09-2016, 12:16 AM   #1144
Terraphantm
Captain
253
Rep
775
Posts

Drives: E46 M3 Coupe
Join Date: Apr 2009
Location: N/A

iTrader: (1)

Well here's an interesting one.

Operating under the assumption that there's a version string that dictates whether or not the boot sector actually gets copied, I went hunting for an 0PA with a different boot sector. There are in fact 3:

4496915A.0pa
4490559A.0pa
7546990A.0pa

I made the mistake of trying to flash a ZB# corresponding to 4496915A.0pa. The program section flashed (including boot sector), but then the signature check failed on the next step. Tried flashing back to stock, and signature check kept failing.

Turns out, that 0PA has a different public key, though apparently the signatures were generated for the real public key (hence why it copied that boot sector over in the first place). The other two appear to have the correct public key. So I'll have to recover via BDM and try again with a different 0PA.

Edit: Okay, after a lot of testing, I'm convinced there's an additional layer of verification somewhere. Flashed one of those old 0PA/0DA combos, then flashed to my modified one. Flash succeeds, but it doesn't copy over the boot sector. The real BMW boot sectors do copy over. Will have to look at it later.

Last edited by Terraphantm; 12-09-2016 at 01:18 AM..
Appreciate 0
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 10:57 AM.




e90post
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
1Addicts.com, BIMMERPOST.com, E90Post.com, F30Post.com, M3Post.com, ZPost.com, 5Post.com, 6Post.com, 7Post.com, XBimmers.com logo and trademark are properties of BIMMERPOST