![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
BMW Garage | BMW Meets | Register | Today's Posts | Search |
![]() |
![]() ![]() |
BMW 3-Series (E90 E92) Forum
>
I cloned my MSV70 DME
![]() |
![]() |
12-28-2016, 12:57 PM | #1233 |
Major General
![]() ![]() ![]() 3989
Rep 7,212
Posts |
yeah I wasn't sure about that either - I saw those patch/crack references.
MSD80 isn't that interesting to me ATM anyway - those guys have lots of support. It's MSV80 that has basically nothing.. |
Appreciate
0
|
12-28-2016, 12:58 PM | #1234 |
Major General
![]() ![]() ![]() 3989
Rep 7,212
Posts |
|
Appreciate
0
|
12-28-2016, 01:00 PM | #1235 |
New Member
0
Rep 12
Posts |
BBflash does msv80, msd80 and msd85, and from what I've been told, all use the same rsa
|
Appreciate
0
|
12-28-2016, 01:04 PM | #1236 | |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
Quote:
MSD80 and MSD81 have same key. MSV80 and MSV80.1 have the same key. MSD85 is unique (and for that matter, MSD85.1 and MSD85.2 have different keys). |
|
Appreciate
0
|
12-28-2016, 01:43 PM | #1240 |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
Sigh. This is one thing that's always sucked about the BMW community. Oh well, I feel less bad for disassembling it if they advertised the thing as open source.
Edit: Well using some .NET specific decompilers, I found this: Code:
public static byte[] MD5KeyMSD80 = new byte[] { 161,87,165,68,115,58,2,199,104,170,238,224,9,136,40,62, 101,111,55,16,135,182,192,2,165,185,9,94,124,0,111,216, 168,213,64,238,122,32,98,241,140,204,219,139,84,84,181,73, 182,101,94,27,177,255,150,63,40,68,156,18,94,225,198,24, 43,175,235,84,221,215,19,117,100,93,215,152,212,205,117,76, 197,200,158,108,24,103,31,78,21,73,193,3,241,42,240,1, 74,44,61,249,253,90,249,155,98,210,32,206,164,139,105,99, 10,249,180,0,31,152,67,147,231,111,162,168,201,82,143,39 }; Edit: I'm pretty sure they're patching out the RSA check. I'm not quite sure why the public key is there; maybe just to make sure you're starting from a stock binary. The only other large array is just a CRC32 table. Last edited by Terraphantm; 12-28-2016 at 03:08 PM.. |
Appreciate
0
|
12-29-2016, 12:20 AM | #1241 | |
New Member
0
Rep 28
Posts
Drives: BMW 130i Manual
Join Date: Dec 2016
Location: NZ
|
A similar approach on 512 bit factoring using Amazon cloud services link
Quote:
|
|
Appreciate
0
|
12-29-2016, 12:50 AM | #1242 | |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
Quote:
![]() |
|
Appreciate
0
|
12-29-2016, 12:57 AM | #1243 | |
Colonel
![]() 1035
Rep 2,113
Posts |
Quote:
As much as I can tell, they do patching (move chunks of bytes around update some bytes), but also calculate and I think write to the flash some checksum(s) based on a custom CRC32 table. It is in FlashModel.Flash.PrepareBinary method. |
|
Appreciate
0
|
12-29-2016, 01:03 AM | #1244 |
Colonel
![]() 1035
Rep 2,113
Posts |
And what is more interesting to me is those patch/crack code looks like is independent whether ECU is MSD80, MSD85 or MSV80; since I couldn't see any specific code for such checks in that method (or the ones it calls). But I may have missed. I looked over from curiosity, I don't intend to figure out exactly what they are doing.
|
Appreciate
0
|
12-29-2016, 02:41 AM | #1245 | |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
Quote:
They changed the parameter section RSA pointers to the program section RSA pointers. Very similar to the trick I described earlier for the MSV70. As long as the program section and boot sector are unmodified, that RSA check will always return a valid result. Edit: Actually maybe not. I can't get the pointers they used to generate the correct md5 (I am able to validate the stock signature). I think the patch is a red herring. The code in "LocateModifyCrack" seems to modify the bootsector with a branch that will bypass the RSA check (basically identical to the bootsector RSA bypass in the MSV70). The patch is probably a remnant from before they were able to modify the boot code. I suspect the DES stuff in "KeyExchange" is what's used to authorize the boot sector write Last edited by Terraphantm; 12-29-2016 at 03:32 AM.. |
|
Appreciate
0
|
12-29-2016, 09:28 AM | #1246 | |
Colonel
![]() 1035
Rep 2,113
Posts |
Quote:
I didn't think they add the patch in vain or it is left over. Code is not very straightforward to follow but not too bad either. They move more than one block and check if flash file had already been patched if so give error etc. I hadn't look well enough to determine but besides bypass I think they add Crc checks based on that custom crc table. If this is correct this may be what yours is missing. |
|
Appreciate
0
|
12-29-2016, 10:31 AM | #1247 |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
The patch doesn't work though. Even if it's added, it won't fix anything (there's even a typo in the patch).
The real magic is in the crack subroutine. It searches for a string of bytes which is in the RSA-verify part of the boot sector. Then after finding those bytes, it changes a nearby jump condition so that the RSA check always passes. It then changes a single byte in that string we found earlier - likely so the software can tell whether the patch was already made. CRC32 is likely to correct the DME's builtin checksums (In addition to RSA, the DME has CRC32s that it verifies every loop instead of only after a flash) My understanding is that these tricore CPUs have a "password" that allows boot sector writes. I think all the cable stuff is handled in the MicroCAN2.dll Last edited by Terraphantm; 12-29-2016 at 10:44 AM.. |
Appreciate
0
|
12-29-2016, 10:36 AM | #1249 |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
I think so. I don't know how else they would be writing to the boot sector without either the password or the RSA private key (and if they had the RSA private key, why patch the boot sector?)
Last edited by Terraphantm; 12-29-2016 at 10:44 AM.. |
Appreciate
0
|
12-29-2016, 11:16 AM | #1250 |
Major General
![]() ![]() ![]() 3989
Rep 7,212
Posts |
ok, so we have an idea of how the BB flash / BT cable works - they have the password for the boot sector, and are writing an RSA patch (which also means somebody disassembled MSV80, MSD80, and MSD85, or at least the boot sectors are the same). So how does the OFT do it? The OFT also works on MSV70. I'm guessing it's similar.
If we can extract the proper boot code patch it seems like it might be worth trying a similar attack on MSV80 as we have on MSV70. Not sure if WinKFP has the "password" for boot sector access - but maybe that's where BB flash and the OFT got it from. I just keep thinking MSV70 gets all the love because it's easier to hack, but most N52 powered cars are MSV80.. |
Appreciate
0
|
12-29-2016, 11:23 AM | #1251 |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
MSV80 and MSD80 and MSD85 don't have identical boot sectors, but they're similar enough that simply searching for the right string allows them to make an equivalent patch (basically makes the comparison of RSA_Delete_1 return a valid result and bypass the RSA check). It does appear that the password (or however they're allowing a boot sector write) is the same for the 3 DMEs.
Not sure what OFT does. If the MSV70 also allows a boot sector write with some sort of password, I don't know how to invoke that. They could very well just be successfully doing what we've been trying to do with the RSA pointer trick (since we're apparently not the first ones to think of it) Really wish the source code was available. Would not be super difficult to adapt the flash routines for the MSV70 and MS45. Granted ILSpy gets us pretty damn close to having the actual source. |
Appreciate
0
|
12-29-2016, 12:42 PM | #1252 | |
Private First Class
![]() ![]() 85
Rep 141
Posts |
Quote:
https://app.box.com/s/drrdhumw46vaystof2a9 .7z Link http://flashguy.blob.core.windows.ne...ash.1.0.0.5.7z |
|
Appreciate
2
Terraphantm254.00 CarAbuser493.50 |
12-29-2016, 01:07 PM | #1253 |
Captain
![]() ![]() ![]() ![]() 254
Rep 775
Posts |
Awesome. Let's see what they did.
Edit: Seems like the MSV80 and MSD85 stuff is largely leftover from a time when they had planned to implement it, but didn't. Maybe we can fix that. Still not seeing them doing anything crazy for the RSA bypass. Seems like they request security access (private key can likely be recovered from WinKFP -- if not 512-bit is easy to factor), and then just write the boot sector. If BMW allowed the boot sector to be written before the RSA check is done, that's sort of a fail on their part. Last edited by Terraphantm; 12-29-2016 at 01:23 PM.. |
Appreciate
0
|
12-29-2016, 02:37 PM | #1254 |
Colonel
![]() 1035
Rep 2,113
Posts |
Take a look at the flash.txt file at the root of the solution of source code linked. It gives insight to what was done . Msv80 was never finished but could be. And that key exchange is not for the cable looks like , it is to get into "programming mode". This probably allows to write any section. But then during execution rsa md5 signature and certain checksums are checked, so the "crack" is to by pass this. Google shows This software is a result of *********** forum work you can probably get deeper info there in the threads or even contact flash guy user if still active there.
Edit: correct file name BMWflash.txt Last edited by PhaseP; 12-29-2016 at 02:43 PM.. |
Appreciate
0
|
![]() |
Bookmarks |
|
|