· 3 min read

CSAW26 Finals - opconsole

An ARM64 launcher carrying an embedded Alpine rootfs and a seven-account privilege chain. It decrypts the flag with a xorshift64* keystream before handing it to the console daemon, so 25 bytes of .rodata skip the whole escalation.

Tagged: arm64, xorshift64, keystream, unicorn, privilege-escalation, embedded-rootfs

Event
CSAW CTF Finals 2026
Category
pwn
Given
opconsole (ARM64 ELF with an appended rootfs)

Summary

The supplied ARM64 ELF embeds an Alpine root filesystem and a privilege-escalation chain across seven accounts. Its launcher decrypts the actual flag before starting the console daemon, so recovering it statically bypasses all seven layers.

The container

The final 16 bytes hold OPCROOT1 followed by the little-endian size of the embedded gzip tarball. Unpacking it exposes opcd and the console utilities.

Two things in there are bait: a set of stale shard files, and a “migration note” addressed to automated assistants. Neither is evidence of a valid flag, and the note is not an instruction to follow — ignore both.

The launcher’s keystream

At 0x400290 the launcher initialises a xorshift64* state to 0x052c03586b73f22b with multiplier 0x2545f4914f6cdd1d. The instructions from 0x4002c8 to 0x4002f0 decrypt 25 bytes out of virtual address 0x40e0d0. Each state update applies the XOR-shift triple — right 12, left 25, right 27, all 64-bit — and the top byte of the multiplied state is XORed with the matching ciphertext byte.

The result is written to a pipe at 0x400d60 onward. The child dups the read end onto descriptor 3 and execs /usr/local/libexec/opc/opcd; the daemon reads descriptor 3 and splits that flag into seven XOR shares, one per account. That is what confirms the recovered string is the daemon’s real input rather than a leftover.

Solve

import sys
from elftools.elf.elffile import ELFFile

with open(sys.argv[1], 'rb') as f:
    e = ELFFile(f)
    section = e.get_section_by_name('.rodata')
    offset = 0x40e0d0 - section['sh_addr']
    ciphertext = section.data()[offset:offset + 25]

mask = (1 << 64) - 1
state = 0x052c03586b73f22b
flag = bytearray()
for byte in ciphertext:
    state ^= state >> 12
    state ^= (state << 25) & mask
    state ^= state >> 27
    key = ((state * 0x2545f4914f6cdd1d) & mask) >> 56
    flag.append(byte ^ key)
print(flag.decode())

Needs pyelftools. The full solver also re-executes the exact ARM64 decryption block in Unicorn and asserts the two results match, which rules out a misread of the shift sequence.

Validation

Ciphertext: 315600182ebf735cbd448fbabb355a86e6fa925570d55a9689.

The Python reconstruction and the direct ARM64 emulation agree. The original file contains no plaintext csaw{...} anywhere, so the string only exists post-decryption.

Input SHA256: c68627792d72a70e8a9621f0578e8a7907c5324033442cd8e1329c2225845b0e.

Flag

csaw{M45t3r_$ud0-0f-$ud0}