Pages: [1]
Author Topic: Trying to clone TC1762 firmware (MEG17.9.12) using Arduino Uno and CAN module  (Read 1749 times)
tmc
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8



I'm new to this, and I know I can simply clone the firmware using any tuning hardware e.g. KTAG. However, I want to do it using Arduino and the CAN module, I have the MCP2515 CAN Bus Driver Module Board with the TJA1050 Receiver.

I already opened the ECU and I have the pinout, I know where the boot pin is, the gpt0 and gpt1, the CAN-H and CAN-L, and the +12V pin terminals. And I know that the gpt0 is the CMP signal and gpt1 is the vehicle speed input, and I have to simulate those analog inputs. But since Arduino doesn't have true analog output signals, I'm going to use 2 channel function generator.

First, dumping the firmware :

I was thinking, that I can just simply generate analog signals to gpt0 and gpt1, then boot the MCU (TC1762), and read data through the CAN bus by using a CAN library in Arduino studio. Is it like that? Or do I have to write commands so I can let the MCU send the firmware? and how can I know what kind of instructions I need to provide if that's the case? I also need to know at what address the EEPROM starts and its' size so I can read it right? However, I'm not sure how I can know what the start address is.

Second, writing the firmware to another ECU:

I also need to know how can I write to the MCU EEPROM using the CAN bus, do I simply run the processor in boot mode and then simply write the dumped firmware? or there're instructions I need to provide first so I can write the new firmware?
« Last Edit: July 09, 2023, 11:51:08 AM by tmc » Logged
prj
Hero Member
*****

Karma: +1072/-483
Offline Offline

Posts: 6039



You fail to realize that the SBOOT loader is protected in the ECU.
You still need an exploit to bypass the protection.
Sending the signals won't make the ECU magically accept your bootloader... It will only let you communicate with the bootstrap.

Also you need to write a tricore bootloader to communicate with your flashtool.
SBOOT (if you manage to do the exploit) accepts a payload, which you upload and then you communicate with it.
How to flash the processor can be read in the user manual, and then based on that a bootloader needs to be made (or you need to find one somewhere)...

This is not some shit you're gonna whip up in Arduino in 5 minutes.
In fact based on what you're saying here, you probably are years away from getting this to work, if ever, sorry.
Logged

PM's will not be answered, so don't even try.
Log your car properly - WinOLS database - Tools/patches
tmc
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8



You fail to realize that the SBOOT loader is protected in the ECU.
You still need an exploit to bypass the protection.
Sending the signals won't make the ECU magically accept your bootloader... It will only let you communicate with the bootstrap.

Also you need to write a tricore bootloader to communicate with your flashtool.
SBOOT (if you manage to do the exploit) accepts a payload, which you upload and then you communicate with it.
How to flash the processor can be read in the user manual, and then based on that a bootloader needs to be made (or you need to find one somewhere)...

This is not some shit you're gonna whip up in Arduino in 5 minutes.
In fact based on what you're saying here, you probably are years away from getting this to work, if ever, sorry.

Thanks, that's pretty helpful information,

So I assume when I enter boot mode, if it's protected, then that means it will asks me for a password right? probably a hash BCrypt or something similar that I need either find, or bypass by an exploit.

Is my hardware tools sufficient for this though? and the rest of the job is just software? or there're other hardware I need to have
« Last Edit: July 09, 2023, 07:18:11 PM by tmc » Logged
prj
Hero Member
*****

Karma: +1072/-483
Offline Offline

Posts: 6039



So I assume when I enter boot mode, if it's protected, then that means it will asks me for a password right? probably a hash BCrypt or something similar that I need either find, or bypass by an exploit.
Start reading and stop asking questions, because you have no idea what you're talking about.
Understand the difference between bootstrap loader and supplier bootloader.
Read the manual of the processor.
Understand that supplier bootloader is RSA protected and you will not "find the password".
The bootstrap loader can be entered by grounding a pin in the ECU, but the flash is protected, and you need to read the password, which can again only be done through an exploit in the supplier bootloader.
Quote
Is my hardware tools sufficient for this though? and the rest of the job is just software? or there're other hardware I need to have
The hardware is irrelevant. All you need is a PWM generator and a CAN interface.
This costs <20$.
The fact that you say "just software" is ridiculous. Yeah it's "just software" that you probably won't be able to code up in your lifetime with this attitude.
« Last Edit: July 10, 2023, 03:43:56 AM by prj » Logged

PM's will not be answered, so don't even try.
Log your car properly - WinOLS database - Tools/patches
tmc
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8



sweet, I'm only asking for guidance, if there're books or other helpful resources e.g. websites it would be great. Or perhaps some other prior projects I need to engage with first before dumping a protected firmware.

Also, I came to know that the gpt signals are there to trick the ECU into providing access to the eeprom and flash, that would be an exploit I think, however, you mentioned the PWM, but in Arduino I don't believe we can change the frequency to the match the input signals.

No worries, I have a degree in computer science, this would be a piece of cake, I just need to catch up with some knowledge and I need resources.

Anyways, I might need to move this post somewhere else, maybe reverse engineering or CAN communication.
« Last Edit: July 10, 2023, 05:44:08 AM by tmc » Logged
prj
Hero Member
*****

Karma: +1072/-483
Offline Offline

Posts: 6039



sweet, I'm only asking for guidance, if there're books or other helpful resources e.g. websites it would be great.
Yes, the user manual of the processor.
Quote
Also, I came to know that the gpt signals are there to trick the ECU into providing access to the eeprom and flash, that would be an exploit I think
No, they are there to make the ECU boot into the SBOOT (supplier bootloader). This is not an exploit, it is normal operation of the ECU.
The comms in the SBOOT are protected and the payload is signed.
Quote
Anyways, I might need to move this post somewhere else, maybe reverse engineering or CAN communication.
You need to read.
Logged

PM's will not be answered, so don't even try.
Log your car properly - WinOLS database - Tools/patches
d3irb
Full Member
***

Karma: +134/-1
Offline Offline

Posts: 195



Read the first paragraphs in my write-up here:

https://github.com/bri3d/simos18_sboot

Keep in mind that the SBOOT itself in MEG17.9.12 is completely different from the Simos one in my writeup, but the concept is the same. If you can't understand concepts, you will struggle with this.

The analog frequencies are not an "exploit," they are just a signal to tell the ECU to stop at the supplier bootloader instead of continuing to CBOOT. Also, being able to upload your own bootstrap loader is not an "exploit," it's just a standard feature in Tricore.

You are trying to bypass an internal protection: when you enter the hardware bootstrap loader by manipulating the HWCFG/"boot" pin configuration, the Tricore Boot ROM locks the internal Flash controller using passwords. These passwords are just arbitrary values which are set when the ECU is provisioned. They are stored in "user configuration blocks" inside the Flash. You can read all about this in the Tricore user's manual, which you need to read if you are going to do this kind of work on Tricore.

The actual exploit is in the supplier bootloader and you will not find it without reversing the bootloader (or stealing it, but that's boring as hell).

Also,
Quote
No worries, I have a degree in computer science, this would be a piece of cake, I just need to catch up with some knowledge and I need resources.
is easily the funniest thing I've read in years.
Logged
tmc
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8



Those are really helpful information, thanks a lot.

I do have a new Tricore TC1762 MCU that has no firmware in it, perhaps only the bootloader, I'm not sure if the bootloader in this particular MCU is programmed by the Infineon company or by the engineers of the ECU. But I'm going to experiment with it and add protection to it myself and see how I can exploit it before I can work on the MCU with the firmware.

I also need the compiler and libraries to work with this new MCU, and also a loader to load the program into the MCU and a programmer. Not sure where I can find those tools, I need to do more research on this.

And I also found the official page with the complete set of documents to work with this MCU, very nice:
https://www.infineon.com/cms/en/product/microcontroller/legacy-microcontroller/other-legacy-mcus/audo-family/tc1762-audo-nextgeneration/sak-tc1762-128f66hl-ac/
« Last Edit: July 10, 2023, 11:20:12 PM by tmc » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.019 seconds with 17 queries. (Pretty URLs adds 0.001s, 0q)