Title: ME7.9.10 immo function Post by: woj on August 19, 2018, 02:28:07 PM I am in progress of dissecting this one, still not there yet, but already know some things that might be enough to get some feedback from you to speed up things. The line from EEPROM (has an identical copy in the next row) relevant for immo is:
The first two bytes are some status / configuration bytes (and here it is probably where one manipulates it to virginise / disable it). The next six are the immo code data (they stay fixed), and the remaining six get updated every key on (most of them). In the first six bytes the decimal recovery code is encoded as follows: CA BF F1 -> 1BFCA -> 12631 (when the nibble is >=10 subtract 9). That's all I know for now, if it looks familiar to anyone don't be shy. Title: Re: ME7.9.10 immo function Post by: woj on August 20, 2018, 01:50:54 PM Some more insights from looking at the code. When the first two bytes read from EEPROM are not 01 01 then the whole EEPROM row is overwritten with a "canonical" (?) one from flash:
bytes #2-#7 in decimal happen to be 11 22 33 44 55 66. The last 5 are also clearly some default initialisation. The remaining 01 at #8 is a flag that so far I know is 00 on initialised ECUs, on uninitialised 01 together with a check on flash byte named DFPMEEPWFSINDEPENDEND in the definition when 00 they skip whole bunch of EEPROM cleaning up (mostly DTC area from what I understand). This byte could be the virgin state of the immo, but (1) I am not sure yet, (2) I have no means of checking it in practice. Yet another thing is, IIRC, I have once seen some ebay immo off program resetting the whole row to FF-s. Title: Re: ME7.9.10 immo function Post by: woj on August 21, 2018, 12:26:53 PM Run some tests, the first two bytes in this row changed from 01 01 to something else do not cause the immo data to be overwritten with the canonical one. What does happen though, if I clean the whole EEPROM to FF-s, then the whole EEPROM gets written with the canonical image from the flash.
But more importantly, I played a bit more with all these bytes in the EEPROM row and was observing what happens with the IMMO unlock requests sent out to the code box. Long story short, if byte #8 is equal to 00, then a proper unlock code is sent of this form:
32 times, because I do not have a code box on the bench. Then a protocol termination of 0010A001 [7] 15 00 00 00 00 00 00. When I change the byte #8 to 01, irrespective of other changes, the immo request message becomes:
which means I have hit the nerve. I can only presume this is the virgin byte, but to test it further I'd need a code box on my bench. 32 attempts here are terminated with 81 00 00 00 00 00 00. It would also be interesting to know how this code request is calculated. The program code that does this traverses some data back and forth, does some xoring and adding, a bit tedious to sort out (though my wild guess is that the last two bytes are a seed of some sort). One thing I know for sure, it is different each time, and different even after I reset the EEPROM contents to the same value it seems. The constantly changing second part of this EEPROM row somehow reflects this I guess. Title: Re: ME7.9.10 immo function Post by: woj on August 22, 2018, 06:53:33 AM Not sure who do I write this for, but never mind ;) I figured out how the challenge response protocol works. The challenge recalculation for the next round is still a mystery (but it seems irrelevant anyhow, what counts is the challenge that one gets), but on the surface this is what happens. The ECU sends:
05 [4 bytes of challenge] [2 bytes of ECU CS] Code box replies: AB [2 bytes of code box CS] 00 00 00 00 The calculation of both CS values is done following the C code I reconstructed (the immo key is fake, but I verified this with the data from my car):
The ECU CS proves the possession of the right immo code to the code box, the expected CS proves to the ECU the possession of the right code by the code box. If anyone cares. I am yet to test if I can actually unlock the immo on my bench ECU this way. The next step is to reverse engineer the virgin reset code. Title: Re: ME7.9.10 immo function Post by: IamwhoIam on August 22, 2018, 11:17:08 AM Nice work!!!
Title: Re: ME7.9.10 immo function Post by: woj on August 22, 2018, 12:30:11 PM It gets better :) I did unlock the bench ECU with a crafted message according to my C program. Better still, I changed the virgin bit to 1 and managed to reset the code to my own with this protocol:
This entered the immo code DDCCEFBEADDE (simply reversed order) into EEPROM and reset the virgin flag. And then after key cycle I could unlock it again. But I think there is something wrong still with this protocol. 84 is clearly the protocol termination (nothing on this ID is sent later), but I find the repetition of the code sending weird. Though I have to check the ECU code, I vaguely remember some comparison there to match two instances, maybe something like password confirm routine. What do you think? Title: Re: ME7.9.10 immo function Post by: woj on August 23, 2018, 01:10:43 PM So this immo reset protocol is actually correct, the ECU expects the request code 0xAA to be sent twice, first it stores it in temporary place, on the second one compares the two and resets the code to the new one.
There is also a request code 0x99, all I can see is that it flips a protocol state bit of some sort back and forth and otherwise does nothing, depending on the bit the reply is then 0x86 or 0x87. This bit enables / disables some things in further protocol (and I had problems sending some messages after getting 0x87 here), but I do not see what it is yet. Then there is also a message with code 0x10 to which the ECU replies with code 0x81, but it is not yet clear what it's for and when it can/should be used. But, I am not sure I care anymore, I know how to unlock the immo knowing the key, and I know how to reset it when in virgin state. That pretty much covers me for whatever whenever I want to do with it. Title: Re: ME7.9.10 immo function Post by: IamwhoIam on August 25, 2018, 01:07:31 PM Immo off setting might be interesting?
Title: Re: ME7.9.10 immo function Post by: woj on August 25, 2018, 01:29:16 PM It does not look like this ECU has immo off option through EEPROM. There is only one flag in the immo data in EEPROM and that is the virgin flag (setting it on does not allow to start the engine, perhaps not a surprise for you Bosch savvy guys, on old MM systems it was different). The immo can be globally disabled though by flipping one condition in the Flash, a development left over of the kind:
if(0) { // unlock immo }else{ // do immo stuff } Title: Re: ME7.9.10 immo function Post by: 370rx on October 05, 2018, 12:43:01 AM +
|