C:\CTF\K17\P_EQUALS_NP.EXE _□X

P=NP

forensics first blood

Challenge

A "redacted" PDF, in the same family as gaslightCTF's blackout — but this time the flag is an image rather than a live text layer sitting under the redaction boxes, so pulling the text out isn't enough.

Solution

Rather than trust what's visibly drawn on the page, walk every page's embedded XObject images directly via pypdf and dump each one out to disk:

reader = PdfReader(pdf_path)
for page_num, page in enumerate(reader.pages):
    for img in page.images:
        img.image.save(f"{prefix}_p{page_num}_{img.name}.png")

The redaction box only covers the image visually in the rendered page; the full, unredacted image is still embedded in the PDF underneath it. Opening the extracted PNG shows the flag directly.