Announcement

Collapse
No announcement yet.

Flashing the MK60 with ZCP software

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by liam821 View Post

    The rumor mill says your zcp mk60 supports flashing, but the non-m does not. Have you tried to do ccp against your zcp module? Dunno if this is a hardware limitation or software…
    I have, yes. The results are the same between both, unfortunately.
    2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

    2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

    Comment


      Well, I tested my tooling on my E82 and, unfortunately, it works great.

      E5 auth/KWP scan probe:

      Code:
      Full capability scan: auth levels, then every service space at each level.
      Entered session 0x87. Scanning SecurityAccess: requestSeed (27 <odd>) at 01,03,..FF - a 67 reply with a non-zero seed means that level exists.
      27 03: SEED 0x2719 -> grants level 0x02.
      27 07: SEED 0x2715 -> grants level 0x04.
      27 FB: SEED 0x2601 -> grants level 0x7E.
      27 FD: SEED 0x261F -> grants level 0x7F.​
      
      ...
      
      1A (ReadECUIdentification) sweep 00..FF:
        1A 80: 7F 1A 78 - EXISTS.
        1A 81: 7F 1A 78 - EXISTS.
        1A 82: 7F 1A 78 - EXISTS.
        1A 83: 5A positive - WORKS.
        1A 87: 7F 1A 78 - EXISTS.
        1A 88: 7F 1A 78 - EXISTS.
        1A 89: 7F 1A 78 - EXISTS.
        1A 8A: 5A positive - WORKS.
        1A 90: 7F 1A 78 - EXISTS.
        1A 91: 7F 1A 78 - EXISTS.
        1A 92: 7F 1A 78 - EXISTS.
        1A 93: 7F 1A 78 - EXISTS.
        1A 94: 5A positive - WORKS.
        1A 95: 5A positive - WORKS.
        1A 98: 7F 1A 78 - EXISTS.
        1A 99: 5A positive - WORKS.
        1A 9A: 7F 1A 78 - EXISTS.
        1A 9B: 5A positive - WORKS.
        1A 9C: 7F 1A 78 - EXISTS.
        1A 9D: 5A positive - WORKS.
        1A 9E: 7F 1A 78 - EXISTS.
        1A 9F: 5A positive - WORKS.
        1A A0: 7F 1A 78 - EXISTS.
        1A A1: 7F 1A 78 - EXISTS.
        1A A2: 5A positive - WORKS.​
      
      ...
      
      31 (RoutineControl, 00 control byte) sweep 00..FF:
        31 00: [7F, 30, 22] (unexpected).
        31 09: 71 positive - WORKS.
        31 21: 7F 31 22 - EXISTS.
        31 22: 7F 31 22 - EXISTS.
        31 23: 7F 31 22 - EXISTS.
        31 24: 7F 31 22 - EXISTS.
        31 25: 7F 31 22 - EXISTS.
        31 26: 7F 31 22 - EXISTS.
        31 27: 7F 31 22 - EXISTS.
        31 28: 7F 31 22 - EXISTS.
        31 29: 7F 31 22 - EXISTS.
        31 2A: 7F 31 22 - EXISTS.
        31 31: 7F 31 22 - EXISTS.
        31 32: 7F 31 22 - EXISTS.​
      Note that `1A 89` and `31 31` are both there, while they were absent on the E46. I think `31 07` and `31 08` are missing because I only probed at auth level 0x00. The car really didn't like me running these tests with live modules everywhere 🙃

      I say this is unfortunate cause that means all my E46 testing has been valid and not a tooling issue. Will keep poking around.
      2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

      2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

      Comment


        Hmm, sounds like we might need to figure out an invasive way of extracting the contents of the flash to really poke around in these. Wonder how practical it'd be to interface a debugger to one of these things. CPU is probably similar to a variant of this? https://www.nxp.com/docs/en/data-sheet/MMC2107.pdf

        Also I have a Z4M MK60e5 I could try poking at if you think that has relevance

        Comment


          I don't know if it is helpful but I will likely have an E90 Non-M MK60 available in a few weeks if you need to do some testing that might be destructive.
          '09 HP2S, '12 R12GSA, '00 Black 323iT, '02 Alpine 325iT (Track Wagon), '02 Alpine 330iT
          Instagram @HillPerformanceBimmers
          Email to [email protected]

          Comment


            Originally posted by terra View Post
            Hmm, sounds like we might need to figure out an invasive way of extracting the contents of the flash to really poke around in these. Wonder how practical it'd be to interface a debugger to one of these things. CPU is probably similar to a variant of this? https://www.nxp.com/docs/en/data-sheet/MMC2107.pdf

            Also I have a Z4M MK60e5 I could try poking at if you think that has relevance
            Yep, JTAG is looking more and more like the path forward. Although I'm not sure if we'll run into issues with the onboard security module. Also no clue where to connect the debugger, there's no obvious header on the board.

            Can you try getting a dump from your Z4M module just cause? I don't expect the FW to be notably different to the E5 FW available from BMW, but might be worth poking around to see what BMW did and didn't compile in to that one. I'd expect that module to need CCP to be enabled over K line.

            Originally posted by George Hill View Post
            I don't know if it is helpful but I will likely have an E90 Non-M MK60 available in a few weeks if you need to do some testing that might be destructive.
            Thanks George! That should be an E5, which we have FW for already, but it might be useful for validating the tooling (e.g. for nailing down the timing of the manufacturing test protocol). I'll let you know.
            2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

            2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

            Comment


              I doubt there is a JTAG debugger pins/pads on the board, that would be the dream though. You’ll most likely have to use exposed copper traces, vias, or the chip's package pins. And you’re right, the contents of the flash might very well be encrypted - probably is. You’ll still be able to access the boot loader though which should give you some clues.
              Phoenix Yellow e46m3 Build Thread
              Orient Blue E46 330i ZHP k24/dct/turbo Build Thread

              Comment


                Originally posted by heinzboehmer View Post
                Can you try getting a dump from your Z4M module just cause? I don't expect the FW to be notably different to the E5 FW available from BMW, but might be worth poking around to see what BMW did and didn't compile in to that one. I'd expect that module to need CCP to be enabled over K line.
                Do have an easy way to dump these just yet? I guess similar commands to the DMEs etc assuming they're implemented? From what I remember way back in the day this thing behaved pretty similarly to the E46 MK60, but that was when we knew far less than you know now. I could probably start with experiments similar to what you did above

                Comment


                  Originally posted by liam821 View Post
                  I doubt there is a JTAG debugger pins/pads on the board, that would be the dream though. You’ll most likely have to use exposed copper traces, vias, or the chip's package pins. And you’re right, the contents of the flash might very well be encrypted - probably is. You’ll still be able to access the boot loader though which should give you some clues.
                  That's a good point about the bootloader. Having access to it would be awesome.

                  Originally posted by terra View Post
                  Do have an easy way to dump these just yet? I guess similar commands to the DMEs etc assuming they're implemented? From what I remember way back in the day this thing behaved pretty similarly to the E46 MK60, but that was when we knew far less than you know now. I could probably start with experiments similar to what you did above
                  Only way I know of dumping them is via CCP, so maybe just start by checking if it responds to the `1A 89` and `31 31` KWP commands.

                  The steps to enable CCP should be the same as the E5 disassembly steps I posted some posts back. After that it's just standard CCP commands over CAN, as far as I can tell. The UPLOAD command is probably what you want.

                  Not at my computer right now, but these are all good resources:

                  - https://github.com/heinzboehmer/MK60...wp_dispatch.md
                  - https://github.com/vesrah/MK60E5-Z4-...ce-tool/ccp.py

                  Can also PM you the slop tool I've been using to test with, but you'll need a Gauge.S (or similar ESP32-S3 based board with CAN and K line chips).
                  2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

                  2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

                  Comment


                    Cool, I'll work on that a little this weekend. I might hit you up for the slop tool if I'm not making any progress. Don't have that device, but perhaps can adapt it to what I do have.

                    Comment


                      So this is what I get when I try sending 1A 89 and 31 31 (using tool32 mostly out of laziness)


                      Code:
                       JOB_STATUS = ERROR_ECU_SUBFUNCTION_NOT_SUPPORTED__INVALID_FORMA T
                      
                      _TEL_AUFTRAG = 6 Bytes
                      
                      0000 : B8 29 F1 02 1A 89 ¸)ñ..?
                      
                      _TEL_ANTWORT = 8 Bytes
                      
                      0000 : B8 F1 29 03 7F 1A 12 14 ¸ñ)....
                      
                        JOB_STATUS                      = ERROR_ECU_SUBFUNCTION_NOT_SUPPORTED__INVALID_FORMAT
                      
                        _TEL_AUFTRAG                    = 6 Bytes
                      
                          0000 : B8 29 F1 02 31 31                                  ¸)ñ.11
                      
                        _TEL_ANTWORT                    = 8 Bytes
                      
                          0000 : B8 F1 29 03 7F 31 12 3F                            ¸ñ).1.?  
                      ​
                      Seems like failures on both counts?

                      Seeds 27 03, 27 07, 27 FB, 27 FD do appear to be available on this module. 27 04 and 27 FE might exist (gives response code 22 instead of 12).

                      Edit:
                      Supposedly enabling CCP via this tool does work however - https://vesrah.github.io/MK60E5-Z4-GT3-ABS-Tools/

                      I'll have to see if I can adapt their CAN code to work with a candlelight device

                      Code:
                      [10:08:35 PM] port open for Z4 GT3 (serial); keys: none
                      [10:08:35 PM] part number ZB 6769162
                      [10:08:35 PM] software id AN_RAE00026
                      [10:08:35 PM] key constants from ident: CCP key 0x3BF0 coding key 0x2444
                      [10:08:35 PM] Z4 GT3 is answering
                      [10:08:39 PM] CCP enabled: 10 87 + level 0x7e seed 0x476b key 0x3304 + 31 31 01​
                      Attempting the same on my M3 non-ZCP module:
                      Code:
                      [10:14:00 PM] port open for Z4 GT3 (serial); keys: none
                      [10:14:00 PM] part number ZB 2282250
                      [10:14:00 PM] software id AUPY3482.9C3
                      [10:14:00 PM] key constants from ident: CCP key 0x1103 coding key 0x0E0D
                      [10:14:00 PM] Z4 GT3 is answering
                      [10:14:07 PM] enable CCP: NRC 0x33 securityAccessDenied​
                      Will try to head to my actual car (which has a ZCP module) and see what that reports

                      And basically same result with ZCP module
                      Code:
                      [10:20:37 PM] port open for Z4 GT3 (serial); keys: none
                      [10:20:37 PM] part number ZB 2282420
                      [10:20:38 PM] software id AWPY3381.ZC4
                      [10:20:38 PM] key constants from ident: CCP key 0x0D03 coding key 0x0B14
                      [10:20:38 PM] Z4 GT3 is answering
                      [10:20:46 PM] enable CCP: NRC 0x33 securityAccessDenied​
                      Which I guess is because the E46 modules don't report 0x7e is available (but perhaps if CCP does exist on these, they use one of the other modes to get in? Or maybe doesn't even have to be enabled like on e5?)

                      Comment


                        Originally posted by terra View Post
                        So this is what I get when I try sending 1A 89 and 31 31 (using tool32 mostly out of laziness)


                        Code:
                         JOB_STATUS = ERROR_ECU_SUBFUNCTION_NOT_SUPPORTED__INVALID_FORMA T
                        
                        _TEL_AUFTRAG = 6 Bytes
                        
                        0000 : B8 29 F1 02 1A 89 ¸)ñ..?
                        
                        _TEL_ANTWORT = 8 Bytes
                        
                        0000 : B8 F1 29 03 7F 1A 12 14 ¸ñ)....
                        
                        JOB_STATUS = ERROR_ECU_SUBFUNCTION_NOT_SUPPORTED__INVALID_FORMAT
                        
                        _TEL_AUFTRAG = 6 Bytes
                        
                        0000 : B8 29 F1 02 31 31 ¸)ñ.11
                        
                        _TEL_ANTWORT = 8 Bytes
                        
                        0000 : B8 F1 29 03 7F 31 12 3F ¸ñ).1.?
                        ​
                        Seems like failures on both counts?

                        Seeds 27 03, 27 07, 27 FB, 27 FD do appear to be available on this module. 27 04 and 27 FE might exist (gives response code 22 instead of 12).

                        Edit:
                        Supposedly enabling CCP via this tool does work however - https://vesrah.github.io/MK60E5-Z4-GT3-ABS-Tools/

                        I'll have to see if I can adapt their CAN code to work with a candlelight device

                        Code:
                        [10:08:35 PM] port open for Z4 GT3 (serial); keys: none
                        [10:08:35 PM] part number ZB 6769162
                        [10:08:35 PM] software id AN_RAE00026
                        [10:08:35 PM] key constants from ident: CCP key 0x3BF0 coding key 0x2444
                        [10:08:35 PM] Z4 GT3 is answering
                        [10:08:39 PM] CCP enabled: 10 87 + level 0x7e seed 0x476b key 0x3304 + 31 31 01​
                        Attempting the same on my M3 non-ZCP module:
                        Code:
                        [10:14:00 PM] port open for Z4 GT3 (serial); keys: none
                        [10:14:00 PM] part number ZB 2282250
                        [10:14:00 PM] software id AUPY3482.9C3
                        [10:14:00 PM] key constants from ident: CCP key 0x1103 coding key 0x0E0D
                        [10:14:00 PM] Z4 GT3 is answering
                        [10:14:07 PM] enable CCP: NRC 0x33 securityAccessDenied​
                        Will try to head to my actual car (which has a ZCP module) and see what that reports

                        And basically same result with ZCP module
                        Code:
                        [10:20:37 PM] port open for Z4 GT3 (serial); keys: none
                        [10:20:37 PM] part number ZB 2282420
                        [10:20:38 PM] software id AWPY3381.ZC4
                        [10:20:38 PM] key constants from ident: CCP key 0x0D03 coding key 0x0B14
                        [10:20:38 PM] Z4 GT3 is answering
                        [10:20:46 PM] enable CCP: NRC 0x33 securityAccessDenied​
                        Which I guess is because the E46 modules don't report 0x7e is available (but perhaps if CCP does exist on these, they use one of the other modes to get in? Or maybe doesn't even have to be enabled like on e5?)
                        Very cool!

                        Just to make sure I got the order of everything right, Z4M module does have CCP, non-ZCP and ZCP both don't authenticate to level 0x7E?

                        Also, am reading through that tool's code again and it looks like the module specific keys are in different spots than on the E5? Specifically, what I called `unit_key` above seems to come from `1A 94`, not `1A 89`. I'll need to go retest this on my bench module (and double check my disassembly).

                        I'm hoping the FW key is the same on all modules, cause that one is much, much harder to brute force.

                        Edit: Wait, I've been getting the CCP enable path and the programming mode path mixed up in my past few posts. `1A 89` is needed for the programming path, `1A 94` seems to be a shortcut for the CCP enable key, so no need to brute force it. I'll fix my other posts in a bit.
                        Last edited by heinzboehmer; Today, 09:53 PM.
                        2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

                        2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

                        Comment


                          Originally posted by heinzboehmer View Post
                          Just to make sure I got the order of everything right, Z4M module does have CCP, non-ZCP and ZCP both don't authenticate to level 0x7E?
                          Correct. Haven't actually tried doing stuff with CCP yet. But at the very least does seem to take the 31 31 01 command and report a success?

                          Originally posted by heinzboehmer View Post
                          Also, am reading through that tool's code again and it looks like the module specific keys are in different spots than on the E5? Specifically, what I called `unit_key` above seems to come from `1A 94`, not `1A 89`. I'll need to go retest this on my bench module (and double check my disassembly).

                          I'm hoping the FW key is the same on all modules, cause that one is much, much harder to brute force.
                          For whatever it's worth, 1A 94 seems to correspond to the 'ident_teves_ecu_sw_nr' job in tool32

                          Looking back to how the DME flashing works (which is what I think how all officially programmable BMW modules of the E6x / E9x generation works), 1A 89 is used to grab the 'serial number' of the module, which is combined with a random seed and a 'user ID' (which can be anything) hashed/signed and compared to what the module computes. That seems similar to what you found, except just the hash being compared instead of the RSA signed product? In this case since we'd potentially be using non-BMW flashing routines, I guess perhaps not something we need to worry about (and may well just not be present in these E46 / E85 variants)

                          On the DMEs, flashing via CCP appears to bypass all of the signature validation stuff altogether, which is what I'm hoping we can achieve.

                          Comment


                            Originally posted by terra View Post
                            Correct. Haven't actually tried doing stuff with CCP yet. But at the very least does seem to take the 31 31 01 command and report a success?
                            Hell yeah! That's pretty awesome.

                            Originally posted by terra View Post
                            For whatever it's worth, 1A 94 seems to correspond to the 'ident_teves_ecu_sw_nr' job in tool32

                            Looking back to how the DME flashing works (which is what I think how all officially programmable BMW modules of the E6x / E9x generation works), 1A 89 is used to grab the 'serial number' of the module, which is combined with a random seed and a 'user ID' (which can be anything) hashed/signed and compared to what the module computes. That seems similar to what you found, except just the hash being compared instead of the RSA signed product? In this case since we'd potentially be using non-BMW flashing routines, I guess perhaps not something we need to worry about (and may well just not be present in these E46 / E85 variants)

                            On the DMEs, flashing via CCP appears to bypass all of the signature validation stuff altogether, which is what I'm hoping we can achieve.
                            That's good to know. Seems to line up with what both the disassembly and that repo say.​ If I'm not mistaken, the `10 85` job is what WinKFP uses to flash the E5, so I think it should all be BMW routines.

                            But yes, CCP would be awesome to find on the E46 module. So much faster than K line and no auth stuff to worry about.
                            2002 Topasblau M3 - Coupe - 6MT - Karbonius CSL Airbox - SSV1 - HJS - Mullet Tune - MK60 Swap - E86 Front Triangulation - ZCP Rack - Nogaros - AutoSolutions - 996 Brembos - Slon - CMP - VinceBar - Koni - Eibach - BlueBus - Journal

                            2012 Alpinweiss 128i - Coupe - 6AT - Slicktop - Manual Seats - Daily - Journal

                            Comment

                            Working...
                            X