<feed xmlns='http://www.w3.org/2005/Atom'>
<title>amd-psp-re.git/psp_emu/harness/tsu_parser_diff.py, branch main</title>
<subtitle>AMD PSP reverse engineering, emulator and vulnerability research</subtitle>
<id>https://git.sl0p.foo/amd-psp-re.git/atom/psp_emu/harness/tsu_parser_diff.py?h=main</id>
<link rel='self' href='https://git.sl0p.foo/amd-psp-re.git/atom/psp_emu/harness/tsu_parser_diff.py?h=main'/>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/'/>
<updated>2026-09-24T08:53:30Z</updated>
<entry>
<title>Demonstrate the pre-auth IFWI wrapping bug executing in the emulator</title>
<updated>2026-09-24T08:53:30Z</updated>
<author>
<name>user</name>
<email>user@clank</email>
</author>
<published>2026-09-24T08:53:30Z</published>
<link rel='alternate' type='text/html' href='https://git.sl0p.foo/amd-psp-re.git/commit/?id=2852fc16abeaf07d89d4fb147001e167d97cb625'/>
<id>urn:sha1:2852fc16abeaf07d89d4fb147001e167d97cb625</id>
<content type='text'>
The wrapping bounds checks in the pre-auth IFWI parser were established
statically in ANALYSIS-PSP-CODE-EXEC-AVENUES.md. They now execute under Unicorn
against real firmware -- no hardware, no flash, no card, so this stays inside
CONSTRAINTS.md. Harness: psp_emu/harness/tsu_parser_diff.py.

First, an address-set correction that anyone touching this subsystem needs. The
v53 symbol map's TSU/parser addresses do not match our sys_drv image. A
validated call-scan (1083 distinct BL targets) shows rom_parse_directory,
fw_tail_scan, ring_entry_validate and fw_tail_record_check all have ZERO callers
at their v53-map addresses and 2/1/2/1 callers at the ANALYSIS /
ifwi_parse_model addresses. I called the v53 address first and got a function
that is not the parser at all.

Controls: the firmware accepts the known-good flash image (returns 0) and
rejects a corrupted IFWI magic (0xffff0008), and ifwi_parse_model agrees on
both, so the entry point and the (ctx, img) -&gt; err convention are right.

The bug executes. Overwriting the slot-0 directory pointer at image+20:

    0xFFFFFFF0 -&gt; FAULT READ_UNMAPPED at 0x0FFFFFF0, pc 0xE0F984
    0xFFFFFFFC -&gt; FAULT READ_UNMAPPED at 0x0FFFFFFC, pc 0xE0F984
    0xFFFFF000 -&gt; 0, accepted
    0x7FFFFFFF -&gt; 0, accepted

pc 0xE0F984 is inside fw_tail_scan. The image sits at 0x10000000, so
0x10000000 + 0xFFFFFFF0 wraps to 0x0FFFFFF0 -- below the image base, exactly as
the static analysis predicted -- and the firmware dereferences it. The two
ACCEPTED cases matter as much as the faults: wrapped pointers landing in mapped
memory are read without complaint, which is the read-outside-the-image
behaviour rather than a crash.

Separately, ifwi_parse_model.py is shown NOT to be faithful: with the slot-0
pointer at 0x1FFFF0 the firmware accepts and the model rejects. The model was
written to be validated on a known-good image before crafting with it -- it
passes that control and still diverges on crafted input, which is the only case
it would ever be used for. Recorded that crafted images must be checked against
the firmware in this harness first.

Scope kept honest: this advances 4.1b only. The 4.1c disclosure needs execution
to reach tsu_write_active_slot and the erase/write state machine, which is
flash-side and stays dropped by CONSTRAINTS.md.
</content>
</entry>
</feed>
