Copy keys (PATS II) from ABS to other

All other modules found in Ford cars
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Copy keys (PATS II) from ABS to other

Post by Go4IT »

Hi,

for a long while i've tried to change my ABS module to one that is capable of hill-assistant in order to retrofit ACC. Because my MK4 is facelift i can't use other tools, it needs to be done with IDS and Ford access.

But - i know there where people who knows how to replicate BCM to another one, which also contains the learned/programmed keys. I wonder if that could also be done with an ABS?

Maybe anybody knows how to download the data (assume it is in a EEPROM or Flash) and where the ieys are stored?
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: Copy keys (PATS II) from ABS to other

Post by Go4IT »

Gathering facts about the hardware

So, like anytime just begin from the start and do a teardown to see what we have. For my reverse engineering i took an old ABS of type "AG91-14C205-AA" which i could slaughter for this:
ag91-2c405-aa_label.jpg
After opening the lid (that could be done with force but also could be "baken"):
abs_lid_removed.jpg
The ABS mainboard
abs_pcb_top.png
abs_pcb_bottom.png
Here with parts marked:
abs_pcb_parts_top.png
(1) Texas Instruments TMS470R1VF478BGJZQ CPU (lasered "100013" and "59316936")
(2) Infineon ORION D2 VE905800M01
(3) ST 95040W EEPROM
(4) 5103Z1 TRWR06
(5) Looks like a debug-header
(7) Main plug to car harness

(1) Microcontroller (TI, Family "TMS470R1x")
TMS470R1VF478_picture.jpg
176-Pin Plastic Ball Grid Array ("GJZ")

Specs
- 16/32-Bit RISC Core (ARM7TDMI processor, means ARMv4T architecture)
– 24-MHz System Clock (60-MHz Pipeline)
– Built-In Debug Module (JTAG)
– Utilizes Big-Endian Format
288K-Byte Program Flash
16K-Byte Static RAM (SRAM)
– Core Supply Voltage (VCC): 1.81 V - 2.05 V
I/O Voltage (VCCIO): 3.3 V
– Two Serial Peripheral Interfaces (SPIs)
– Serial Communication Interface (SCI)
– High-End CAN Controller
– Standard Can Controller (SCC)
– 32 Programmable I/O Channels

Block-Diagram
TMS470R1VF478_block-diagram.png
(3) EEPROM ST 95040W
- SOP-8 package
- SPI interface
- IO-Voltage 1.8-5.5V
- 512 Bytes capacity

Firmware
The UDS-Address of the ABS in the Mondeo is 0x760
The firmware for this type could be AG91-14C036-AA (was just a guess as from the HW type number, and version of firmware "AA" should not matter). I added the VBF and the extracted binaries (two files).
You do not have the required permissions to view the files attached to this post.
DGAlexandru
Pro
Posts: 364
Joined: 04 Aug 2019, 22:47

Re: Copy keys (PATS II) from ABS to other

Post by DGAlexandru »

99,99% that the EEPROM contains also the PATS data.

I didn't expect to see a normal PCB with standard ICs in an ABS unit... usually there is a ceramic PCB with ICs with their die exposed and all of them protected by some gel-like thing.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: Copy keys (PATS II) from ABS to other

Post by Go4IT »

I agree, and it is easy to access the EEPROM. I've attached the readout als file.

Also, the 95040 is so small (only 512 Bytes) that i could also post the full content in readable format:

Code: Select all

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00000000  42 9C FF FF 68 FF FF FF FF 78 FF 20 09 11 12 A6  Bœÿÿhÿÿÿÿxÿ ...¦
00000010  24 95 C9 DC FF FF FF FF FF FF 41 41 DC FF 59 FF  $•ÉÜÿÿÿÿÿÿAAÜÿYÿ
00000020  FF FF FF FF 56 FF 41 42 DD FF FF FF FF 56 42 9C  ÿÿÿÿVÿABÝÿÿÿÿVBœ
00000030  1B 01 D3 49 70 02 4F 1B F0 00 00 00 00 00 00 00  ..ÓIp.O.ð.......
00000040  00 00 00 00 00 00 00 00 00 10 D5 00 04 80 00 00  ..........Õ..€..
00000050  00 00 B3 41 9B 39 93 FF 06 60 31 8B 01 5B FF 59  ..³A›9“ÿ.`1‹.[ÿY
00000060  FF 59 03 5D 13 6D 02 5C 02 5C FF 59 FF 59 04 5E  ÿY.].m.\.\ÿYÿY.^
00000070  00 0F 23 91 1D 00 5A FF FF FF FF FF FF FF FF FF  ..#‘..Zÿÿÿÿÿÿÿÿÿ
00000080  FF FF FF FF FF FF FF FF FF 49 00 00 00 5A 01 5B  ÿÿÿÿÿÿÿÿÿI...Z.[
00000090  01 C3 1E FF 02 40 9C FF 00 45 9F FF 00 00 5A FF  .Ã.ÿ.@œÿ.EŸÿ..Zÿ
000000A0  00 01 5B FF 00 00 5A FF 00 00 5A FF 5F 11 CA FF  ..[ÿ..Zÿ..Zÿ_.Êÿ
000000B0  75 30 75 30 75 30 75 30 EE FF FF FF FF FF FF FF  u0u0u0u0îÿÿÿÿÿÿÿ
000000C0  FF 52 40 40 40 40 40 40 40 40 40 40 41 41 5C FF  ÿR@@@@@@@@@@AA\ÿ
000000D0  A5 00 00 0F FF 78 00 85 A8 00 00 0F FF 78 00 88  ¥...ÿx.…¨...ÿx.ˆ
000000E0  91 00 00 0F FF 78 00 71 90 00 00 0F FF 78 00 70  ‘...ÿx.q....ÿx.p
000000F0  93 00 00 0F FF 78 00 73 97 00 00 0F FF 78 00 77  “...ÿx.s—...ÿx.w
00000100  95 00 00 0F FF 78 00 75 8B 00 00 00 00 00 00 E5  •...ÿx.u‹......å
00000110  03 00 00 0F FF 78 00 E3 02 00 00 0F FF 78 00 E2  ....ÿx.ã....ÿx.â
00000120  FF FF FF 57 FF FF FF FF FF FF FF FF FF FF FF FF  ÿÿÿWÿÿÿÿÿÿÿÿÿÿÿÿ
00000130  FF FF FF FF FF FF FF FF 46 FF FF FF FF FF FF FF  ÿÿÿÿÿÿÿÿFÿÿÿÿÿÿÿ
00000140  FF 5A FF AB FF FF FF FF FF FF FF FF FF FF 50 FF  ÿZÿ«ÿÿÿÿÿÿÿÿÿÿPÿ
00000150  FF FF 00 06 03 61 00 00 FF EE 04 4B FF FF FF FF  ÿÿ...a..ÿî.Kÿÿÿÿ
00000160  FF FF FF FF FF 51 00 F9 04 00 57 FF FF FF FF FF  ÿÿÿÿÿQ.ù..Wÿÿÿÿÿ
00000170  FF FF FF FF 52 1E 78 FF 24 24 25 25 EC 07 AD 0E  ÿÿÿÿR.xÿ$$%%ì...
00000180  00 00 00 60 00 00 5A 01 5B 00 00 00 00 00 00 5A  ...`..Z.[......Z
00000190  FF FF FF FF FF FF FF FF FF FF FF FF FF FF 41 9B  ÿÿÿÿÿÿÿÿÿÿÿÿÿÿA›
000001A0  A5 00 00 0F FF 78 00 85 A8 00 00 0F FF 78 00 88  ¥...ÿx.…¨...ÿx.ˆ
000001B0  91 00 00 0F FF 78 00 71 90 00 00 0F FF 78 00 70  ‘...ÿx.q....ÿx.p
000001C0  93 00 00 0F FF 78 00 73 97 00 00 0F FF 78 00 77  “...ÿx.s—...ÿx.w
000001D0  FF FF FF 57 FF FF 00 06 03 61 00 00 FF EE 04 4B  ÿÿÿWÿÿ...a..ÿî.K
000001E0  FF FF FF FF FF FF FF FF FF 51 00 F9 04 00 57 FF  ÿÿÿÿÿÿÿÿÿQ.ù..Wÿ
000001F0  FF FF FF FF FF FF FF 5A FF AB FF 01 5B FF FF FF  ÿÿÿÿÿÿÿZÿ«ÿ.[ÿÿÿ
I see those jobs to do now:
1.) Now, it could be that the content is encrypted/obfuscated.
2.) Who knows how Ford PATS-2 keys are look like in digital form and could something be found in the dump that looks like this?
3.) Find out how to get UDS secure access to the ABS directly to use the direct Read/Write procedures
4.) Most often Microcontrollers maps periphals to IO addresses which would make it easier to access, once we could UDS access the ABS. Need to find out the memory address it might be mapped.
5.) Reverse engineer the firmware to find answers to the above questions
You do not have the required permissions to view the files attached to this post.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: Copy keys (PATS II) from ABS to other

Post by Go4IT »

Handle Job #5) Reverse engineering of the firmware

I've exported the VBF contents with the VBF-Editor into Intel Hex format (which is able to store data at specific addresses and not only as pure stream). Then i load that into IDA Pro using generic "ARMB" (Big Endian) als processor type. In the "Processor options" i selected the ARMv4T architecture and then let IDA do it's job... it could disassemble most of the firmware itself. Good :-)

As always i do not expect the reset-vectors and bootloader to be part of firmware-files from Ford. So we might find a way to get them by JTAG, once i found out where the signals are routed to the header pads on the left of the pcb.

Memory map of the TMS470
memory-map.png
I2C EEPROM Functions

The µC has two SPI interfaces to talk with the EEPROM:
SPI1 registers are based at 0xFFF7_F800 - 0xFFF7_F8FF
SPI2 at 0xFFF7_D400 - 0xFFF7_D4FF

CAN Functions

The TMS470R1 has two CAN controllers on board, a "Standard CAN Controller" called "SCC" and an "High Performance CAN Controller" called "HECC":
tms470r1_block_can.png
The base-addresses of both are:
memory-map_can.png
SCC memory addresses are 0xFFF7_E000 - 0xFFF7_E0FF for registers and 0xFFF7_DC00 - 0xFFF7_DCFF reflecting the message buffer RAM
HECC memory addresses are 0xFFF7_E800 - 0xFFF7_E9FF for register and 0xFFF7_E400 - 0xFFF7_E5FF reflecting the message buffer RAM

A simple value lookup for 0xFFF7_E000 did not turn out any references in the firmware, whereas 0xFFF7_E800 and 0xFFF7_E400 could be found at least at one place in the code at 0x0005_75EC, which looks like a class instance where a pointer points to the place in memory where the address is positioned:

Code: Select all

seg000:000575E8 unk_575E8       DCB    0                ; DATA XREF: sub_738FC:loc_73904↓r
seg000:000575E8                                         ; sub_738FC+C↓r ...
seg000:000575E9                 DCB 0x20, 0, 0x20
seg000:000575EC                 DCD unk_7F1D8
seg000:000575F0                 DCD sub_4EED0+1
...
seg000:0007F1D8 unk_7F1D8       DCB    1                ; DATA XREF: seg000:000575EC↑o
seg000:0007F1D9                 DCB 5, 0, 0
seg000:0007F1DC                 DCD [color=#FFFF00]0xFFF7E800[/color], [color=#FFFF00]0xFFF7E400[/color], 0x7F308, 0x20014C, 0x7F3C8
seg000:0007F1DC                 DCD 0x10273
The instance 0x575E8 is referenced from 738FC, 79704 and 7A3F4.
You do not have the required permissions to view the files attached to this post.
DGAlexandru
Pro
Posts: 364
Joined: 04 Aug 2019, 22:47

Re: Copy keys (PATS II) from ABS to other

Post by DGAlexandru »

Go4IT wrote: 01 Apr 2023, 11:11 I see those jobs to do now:
1.) Now, it could be that the content is encrypted/obfuscated.
2.) Who knows how Ford PATS-2 keys are look like in digital form and could something be found in the dump that looks like this?
In Mondeo 4 PCM, BCM or RKE's EEPROM it isn't encrypted, nor in FF2 (PCM, IC, RKE) or FF3 (PCM, RKE).
Ford PATS-2 is the same, only the INCODE/OUTCODE was changed.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: Copy keys (PATS II) from ABS to other

Post by Go4IT »

Handle Job #2) Identify key-data in dump

We know that Mondeo MK4 (2007-) uses PATS-II immobilizer (Ford call it "SecuriLock"). With that system a maximum of 8 keys could be trained.
What we do not know right now:
- how many bytes are used for a key-ID?
- where are they located in the EEPROM?
- are they encrypted/obfuscated in the EEPROM data somehow?
You do not have the required permissions to view the files attached to this post.
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: Copy keys (PATS II) from ABS to other

Post by Go4IT »

Getting JTAG access to the TMS470

From the datasheet we know that TMS470 has a JTAG interface:
TMS470R1VF478_jtag.png
And also which pins those are:
jtag.png
jtag_pins.png
I think this header also contains the JTAG pins:
jtag_header.png
Unfortunately the package of the TMS470 does not allow to simply shortcut-measure the wire from the µC to the pads:
TMS470R1VF478_picture.jpg
You do not have the required permissions to view the files attached to this post.
DGAlexandru
Pro
Posts: 364
Joined: 04 Aug 2019, 22:47

Re: Copy keys (PATS II) from ABS to other

Post by DGAlexandru »

Pats from Mondeo 4 PreFl is the same as the one on FF2. In FF2 you can read the key code with ELM327 for example. That code is present in that "clear" form in IC's EEPROM.
Over HS CAN you can see the exchange of the IDs between IC and PCM. The same IDs can be found in IC's EEPROM. This ID exchange moves between RKE and PCM when you add RKE to FF2, case in which you need to configure the IC with the Keyless Start PATS Type in order for it not to send and answer on that CAN IDs that now are used by RKE.
Unfortunately I didn't sniff for this when I did conversions for Mondeo 4, but I'm pretty sure it's doing the same (but instead of IPC you have BCM).
Go4IT
Pro
Posts: 967
Joined: 08 Feb 2019, 12:25

Re: Copy keys (PATS II) from ABS to other

Post by Go4IT »

But great, another thing that's clearified! So there is no encryption involved, at least on the CAN and the EEPROM level!
Do you know how the key code data on FF2 looks like? I'm shure they are the same on FM4.
And we can learn a lot if looking at FF2. There are potentially much more information to find than for FM4...
Post Reply