$ cat writeup.md…
$ cat writeup.md…
Hack.lu 2026
Task: pwn a CHIP-8 emulator whose FX55/FX65 opcodes index memory with an unbounded uint16 I, giving OOB read/write over main's stack. Solution: leak main's saved return address into libc via FX65 + the custom FX41 print opcode, compute the ROP target addresses byte-by-byte with CHIP-8 add-with-carry, OOB-write a pop rdi;ret / /bin/sh / ret / system chain with FX55, then break the loop to return into it.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
CHIP — Hack.lu 2026 (pwn)
Corporate Hyperlocal Impact Processor. We move everything to the cloud. Don't worry, we kept the display, so all mission-critical tasks can resume as expected.
Remote:
socat tcp-l:1024,fork EXEC:/chal/user/chip, flag at/flag.txt.
English summary: the provided CHIP.zip contains a CHIP-8 emulator (chip ELF, src/chip.c, src/display.c), the exact libc.so.6 used on the target (glibc 2.41-12+deb13u3), a demo ROM fluxlogo.ch8, and a Dockerfile that runs socat tcp-l:1024,fork EXEC:/chal/user/chip. The service first reads exactly 3584 bytes of CHIP-8 bytecode from stdin into memory[0x200..0xFFF], then executes it. Goal: hijack control and read /flag.txt.
x86-64 PIE ELF, no stack canary, NX enabled, Partial RELRO, not stripped, built with -std=c11 -pedantic -g -Og.
struct program_state { uint16_t stack[48]; // offset 0x000 uint8_t memory[4096]; // offset 0x060 uint16_t I; // offset 0x1060 uint16_t PC; // offset 0x1062 uint8_t V[16]; // offset 0x1064 uint8_t delay_timer; // offset 0x1074 uint8_t sound_timer; // offset 0x1075 int stack_pointer; // offset 0x1078 };
main declares struct program_state main_state = { 0 }; as a stack local, so the emulator's entire address space sits on the process stack — including the saved registers of main itself, just past the end of the struct. The -Og build makes the frame predictable:
main: push rbp ; push rbx ; sub $0x1088, %rsp
At main entry rsp = R holds the return address; the struct base is R - 0x1098 and memory base is struct + 0x60, i.e. R - 0x1038. So memory[0x1038] is main's saved return address — confirmed empirically by leaking it.
...
$ grep --similar