Skip to content
Adam Omar Saleh

PINK CTF placeholder badge (unofficial)PINK CTFMisc

PINK OS

The ZIP contains a complete hobby operating system, QWERTZ OS ("PINK+ CTF edition").

Competition
PINK CTF placeholder badge (unofficial)PINK CTF
Category
MiscMedium · estimated
Source status
Source-documented · not platform-verified
Document
PDF edition5 min read

Brief

The challenge

Category
sus
Points
100
Author
QWERTZ
File
PINK_OS.zip (uefi_disk.img, data.img)

Well well well, a whole functional operating system! Truly something outstanding for a CTF!

Challenge page
Challenge page

TL;DR

The ZIP contains a complete hobby operating system, QWERTZ OS ("PINK+ CTF edition"). Its X11 desktop wallpaper shows the first half of the flag one character at a time, and stops before the closing brace. The second half isn't anywhere on the disks. It's served by the CTF's own website, https://ctf.pink.bayern/, but only to clients that send the User-Agent of the OS's built-in browser, PINK-OS-CTF/1.0.

Text
X11WALL.QWE glyph cards  -> PINK{W0w,_P1nk+_0S_1sctf.pink.bayern + UA "PINK-OS-CTF/1.0" -> _b3tt3r_th4n_W1ND0WS_4nd_L1NUX}

01

Recon

PINK_OS.zip contains two raw disk images:

ImageContent
uefi_disk.img (64 MB, FAT)EFI/BOOT/BOOTX64.EFI (custom loader), KERNEL.BIN, DISK.IMG (ramdisk)
data.img (512 MB, FAT16, label PINKDATA)the OS's data disk: apps (*.qwe ELF64), Xvfb, JWM, CPython, Tcl/Tk, fonts, docs

The OS boots under QEMU with OVMF. The loader brings up a 1280×800 GOP framebuffer, loads the kernel, and starts an X11 session: Xvfb mirrored to the framebuffer, the JWM window manager, a terminal (X11TERM.QWE), and a wallpaper program (X11WALL.QWE).

Shell
qemu-system-x86_64 -accel kvm -m 2048 -bios OVMF.fd \  -drive file=uefi_disk.img,format=raw,if=ide,index=0 \  -drive file=data.img,format=raw,if=ide,index=1 \  -netdev user,id=n0 -device rtl8139,netdev=n0 -vga std

The FAT timestamps show which files the author added on top of the base OS. Everything from the OS build is dated 29–31 Oct. The challenge files were written on 4 Nov: X11WALL.QWE, X11TERM.QWE, JWMRC, APPS/pinkbrowser.py, APPS/pinkassets/*.png, README.TXT, DOCS/diagnostics.txt and WORK/old-session.txt.

02

The wallpaper: first half

The desktop shows a pink card with one big pixel-art character and a row of 21 progress dots. Every 4 seconds it moves on to the next character.

PINK OS desktop
PINK OS desktop

Disassembling X11WALL.QWE (a static ELF with base 0x8000000000) shows a very small program:

  • 0x800006c1e0: 16 glyphs, 7 bytes each. Each byte is one row of a 5×7 bitmap, and only the low 5 bits are drawn.

  • 0x800006c250: 21 glyph indices: 00 01 02 03 04 05 06 07 08 09 00 0a 0b 0c 0d 09 06 0e 09 0a 0f. The string 127.0.0.1:0 (the X display) follows immediately after them.

  • The card function (0x260) draws glyph index[i] as 14 px squares, followed by 21 dots with dot i in white.

  • The main loop (0xf50) does draw(i); sleep(4); i = (i + 1) % 21 forever, with no event handling and no other code paths.

Decoding the 21 cards:

The 21 wallpaper cards
The 21 wallpaper cards
Text
PINK{W0w,_P1nk+_0S_1s

There is no } glyph in the table, so the flag is deliberately cut off and the rest has to come from somewhere else.

03

Ruling out the disks

I searched the rest of the system thoroughly before looking off-disk:

  • Deleted and free space: deleted files, FAT slack and orphan clusters in both images, plus carved PNG fragments of older browser icons. These held only development leftovers: test scripts, a deleted P-256 _UBLIC.TXT dated 29 Oct, keyboard tests, and an older copy of the same diagnostics text.

  • The running system: a full 2 GB RAM dump of the booted VM had no PINK{ or flag fragments. Recovery-console commands and hotkeys revealed nothing, and the native kernel desktop was empty.

  • Hidden pixels: this author hid the flag of another "sus" challenge (flashback) as faint channel offsets. Here, the desktop, the terminal and all cached images were clean under neighbor-difference and bit-plane checks. The cached PNGs are pixel-identical to the website's originals.

  • The flavor text (DOCS/diagnostics.txt with its "Pink/Blue channel calibrated" note, and WORK/old-session.txt) turned out to be decoration.

So the second half isn't stored in the OS at all.

04

The browser: second half

The other 4 Nov program is the built-in browser, APPS/pinkbrowser.py:

Python
USER_AGENT = "PINK-OS-CTF/1.0"HOME = "https://pink.bayern/"...request = Request(address, headers={"User-Agent": USER_AGENT})

The home page is the team's website, which links to the CTF platform at https://ctf.pink.bayern/. Fetching that platform with the browser's User-Agent gives a completely different response from the normal 201 KB HTML page: 31 bytes of plain text.

User-Agent dependent response
User-Agent dependent response
Text
$ curl -A 'PINK-OS-CTF/1.0' https://ctf.pink.bayern/_b3tt3r_th4n_W1ND0WS_4nd_L1NUX}

Inside the VM, that's what you'd see by opening the PINK Browser and clicking the CTF link on the home page. My QEMU guest couldn't complete the TLS handshake, so I reproduced the request from the host with the same header.

05

Putting it together

Text
PINK{W0w,_P1nk+_0S_1s  +  _b3tt3r_th4n_W1ND0WS_4nd_L1NUX}

The joined flag reads "Wow, Pink+ OS is better than Windows and Linux".

Solve script

solve.py decodes the cards from X11WALL.QWE and fetches the second half:

Python
elf = ELFFile(open("dump_data/X11WALL.QWE", "rb"))rodata = elf.get_section_by_name(".rodata")data, base = rodata.data(), rodata["sh_addr"]order = data[0x800006C250 - base:0x800006C250 - base + 21]half1 = "".join("PINK{W0w,_1nk+Ss"[i] for i in order)​req = Request("https://ctf.pink.bayern/", headers={"User-Agent": "PINK-OS-CTF/1.0"})half2 = urlopen(req, timeout=15).read().decode()print(half1 + half2)
Text
wallpaper : PINK{W0w,_P1nk+_0S_1sctf site  : _b3tt3r_th4n_W1ND0WS_4nd_L1NUX}flag      : PINK{W0w,_P1nk+_0S_1s_b3tt3r_th4n_W1ND0WS_4nd_L1NUX}

render_images.py regenerates the images in images/.

Flag

Flag

PINK{W0w,_P1nk+_0S_1s_b3tt3r_th4n_W1ND0WS_4nd_L1NUX}

Source-documented · not platform-verified

Takeaways

  • A flag that stops before its closing brace is a deliberate cliffhanger. Look for where the rest is delivered instead of grinding on the same file.

  • FAT timestamps separate the author's additions from the base system, which cuts down a huge disk image to a handful of relevant files.

  • Hard-coded client identity, such as a custom User-Agent, is a hint: the server may answer that client differently.

PDF edition

Writeup PDF

Formatted edition of this walkthrough, built from my source notes · 7 pages.