$ cat writeup.md…
$ cat writeup.md…
Hack.lu2026
Task: root service gives a one-bit XOR write to two arbitrary files at attacker-chosen offsets, then execve's socat system:echo. Solution: flip the 'c' of glibc do_system's "-c" to 's' to force sh -s (stdin shell over the socket), then flip pam_rootok je->jne so su authenticates non-root, and read /flag.txt as root.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Remote service
nc doppelflip.flu.xxx 1337(PoW: string starting with a given prefix whose sha256 starts with a given hex). Provided zip hasdoppelflip.c,Dockerfile,compose.yml,flag.txt. The Dockerfile builds/doppelflip(mode 700 root) from source using a pinnedubuntuimage, copiesflag.txtas0400 root, and CMD is:["/doppelflip", "/usr/bin/socat", "stdio", "system:echo hello flux"]. So the container runs/doppelflipas root, which thenexecves socat, runningsh -c "echo hello flux", after dropping to uid/gid 1000.
English summary: the service is a tiny privileged helper. It takes two "bit flips" from the attacker — path, byte offset, bit index — opens each file while still root, XORs one bit at that offset, drops to uid/gid 1000, and finally writes the (already-open) file descriptors and execves /usr/bin/socat stdio system:echo hello flux. The goal is to read /flag.txt, which is 0400 root and therefore unreadable by the dropped uid.
Reading doppelflip.c shows the exact primitive:
*fd = open(file_path, O_RDWR | O_CLOEXEC); // opens WHILE STILL ROOT lseek(*fd, byte_offset, SEEK_SET); read(*fd, byte, 1); lseek(*fd, -1, SEEK_CUR); *byte ^= (1 << bit_offset); // toggle exactly one bit
main() calls prepare_flip() twice (global fd1/byte1, fd2/byte2), then does
setgroups(0,NULL), setresgid(1000,1000,1000), setresuid(1000,1000,1000), and only
after dropping privileges runs:
write(fd1, &byte1, 1); write(fd2, &byte2, 1); close(fd1); close(fd2); execve(argv[1], &argv[1], empty_env); // /usr/bin/socat stdio system:echo hello flux
So we get a root-privileged single-bit write to two attacker-chosen files (the fds were
opened before the privilege drop; the writes land later on the already-open fds). The two flips
are fully controllable: path (%255s), 64-bit signed offset (%lld), bit 0-7.
/proc/self/mem + fd2 address (recorded for future reference)...
$ grep --similar