$ cat writeup.md…
$ cat writeup.md…
tjctf
Task: 638KB PDF polyglot file with hidden text, appended ZIP archive, and swirl-distorted PNG image. Solution: extract hidden password via pdftotext, carve ZIP from PDF trailing data, decrypt archive, reverse ImageMagick swirl distortion to read flag.
$ cat /etc/rate-limit
Rate limit reached (20 reads/hour per IP). Showing preview only — full content returns at the next hour roll-over.
Check out this cool PDF I found... I wonder if there's anything hidden inside!
A 638KB PDF file (chall.pdf) is provided. The goal is to find a hidden flag. The file is suspiciously large for a 2-page text-only document, hinting at embedded data.
The PDF has 2 pages, created with "Skia/PDF m149 Google Docs Renderer". Key observations:
pdfimages -list returns nothingpdfdetach -list shows 0 embedded filespdftotext extracts text not visible in the PDF viewer, including a poem about CTFs and crucially a passwordpdftotext chall.pdf -
The extracted text includes:
DBf8nEBgwRhZThe PDF structure ends at ~31KB with the %%EOF marker, but the file continues for another ~607KB. Examining the trailing bytes reveals a PK (ZIP) magic header immediately after EOF:
with open('chall.pdf', 'rb') as f: data = f.read() # Find the last %%EOF marker eof_pos = data.rfind(b'%%EOF') trailing = data[eof_pos + 6:] # skip %%EOF\n # Write the trailing ZIP data with open('hidden.zip', 'wb') as f: f.write(trailing)
The carved ZIP archive is 606KB and contains a single password-protected file: original_distorted.png.
Using the password discovered in the PDF hidden text:
unzip -P "DBf8nEBgwRhZ" hidden.zip
This extracts original_distorted.png — a 1920×1080 RGB PNG image.
...
$ grep --similar