$ cat writeup.md…
$ cat writeup.md…
sunshinectf2026
Task: a 140-byte BPS patch for a Super Mario World SNES ROM injects custom 65816 code hooked into a fire-flower routine. Solution: statically diff the BPS patch (no base ROM), disassemble the injected 65816 trampoline, and reverse a single-byte XOR-decrypt loop (key 0x5A, null-terminated) that writes the flag into WRAM.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
A weird copy of Super Mario World. The fire flower acts strange... Apply
ctf.bpswith Floating IPS (flips) onto a legally-acquired NTSC (US) SMW ROM. Hint: if you can't find what a modified byte does, check functions with a label containing "fire".
English summary: we are given only a 140-byte BPS patch (ctf.bps) meant to be applied
onto a stock NTSC Super Mario World ROM. The patch modifies the fire-flower behavior.
The goal is to recover the sun{...} flag hidden in the injected code. No emulator or
actual ROM is required — the delta patch alone is enough.
A BPS file is a delta patch format, so every byte it changes can be read directly without ever owning the base ROM.
BPS structure:
BPS1(length<<2) | command:
0 SourceRead, 1 TargetRead, 2 SourceCopy, 3 TargetCopyNote the BPS VLQ decoder is non-standard: it adds 1<<shift after each continuation
byte, so a naive LEB128 reader produces wrong sizes.
Parsing ctf.bps:
0x80000 (512 KB, stock SMW)0x100000 (1 MB) — the patch appends an entire new LoROM bank
(bank $10, mapped to SNES address $108000).The TargetRead actions expose the only real edits to the original ROM:
| File offset | Bytes | Meaning |
|---|---|---|
0x1c3 | 22 00 80 10 EA EA | JSL $108000 + NOP NOP (hook A, boot/early path) |
0xc5f9 | 22 36 80 10 EA | JSL $108036 + NOP (hook B, inside a fire-flower routine per the hint) |
0x7fd7 | 0A | one-byte tweak |
...
$ grep --similar