Description
I've hidden a flag in this PowerPoint file. Can you retrieve it? Download 'Forensics is fun.pptm'.
Setup
Download 'Forensics is fun.pptm'.
wget '<url>/Forensics is fun.pptm'Solution
Walk me through it- Step 1Extract the PPTM as a ZIP archivePPTM files (like DOCX, XLSX, and all OOXML formats) are ZIP archives containing XML files, images, and other resources. Rename or use unzip directly on the file to extract its contents.bash
unzip "Forensics is fun.pptm" -d forensics_extractedbashls forensics_extracted/Learn more
Office Open XML (OOXML) is a ZIP-based format used by all modern Microsoft Office documents (.docx, .xlsx, .pptx, .pptm, etc.). The "m" suffix indicates macro-enabled files. Inside the ZIP you find XML files describing content, a
_rels/directory for relationships, and appt/(orword/) directory for the main content.Treating Office documents as ZIP archives is standard practice in forensics, malware analysis, and CTF challenges. Many attackers hide payloads or embed data in the less-examined subdirectories of these archives.
What to look for inside an OOXML archive: The
word/document.xml(orppt/slides/slide1.xml) file contains the main document content as XML. Macros in .docm/.pptm files are stored as VBA source code inword/vbaProject.bin- a compound binary format that you can extract witholevbafrom theoletoolssuite. The_rels/directories define relationships between parts (e.g., which image is embedded at which location). Any file present in the ZIP that does not correspond to a known OOXML component is worth inspecting.Security implications of macro-enabled Office files: The .pptm format is macro-enabled, which is why it is the most dangerous Office format variant. Malicious actors distribute .docm and .xlsm files containing VBA macros that download and execute malware when the user clicks "Enable Content." Microsoft's "Mark of the Web" (MotW) feature and the 2022 default-block policy for macros in files downloaded from the internet are direct responses to this attack vector. CTF challenges using macro-enabled files often have the actual payload in the XML structure or embedded files rather than the macros themselves.
- Step 2Find and decode the hidden fileInside the extracted archive, navigate to ppt/slideMasters/. There is an unusual file called 'hidden' containing a base64 string with spaces between each character. Remove the spaces with tr, then decode with base64.bash
cat forensics_extracted/ppt/slideMasters/hiddenbashtr -d ' ' < forensics_extracted/ppt/slideMasters/hidden | base64 -dLearn more
The
ppt/slideMasters/directory normally contains XML files defining slide master layouts. A file simply namedhidden(with no extension) is anomalous and immediately suspicious. The spaces between base64 characters are an obfuscation trick -tr -d ' 'strips all spaces before decoding.tr (translate) with the
-dflag deletes specified characters from the input stream.tr -d ' 'removes all space characters, leaving a clean base64 string forbase64 -dto decode.Alternative approach with Python: If shell piping feels uncomfortable, Python handles this in one line:
import base64; data = open('hidden').read().replace(' ', ''); print(base64.b64decode(data).decode()). Python'sbase64.b64decodeis also more forgiving of whitespace if you passvalidate=False, though it's good practice to clean the input explicitly so you know exactly what was decoded.Slide master forensics: In PowerPoint, slide masters define the default layout and appearance for all slides. They are frequently overlooked during manual review because their content does not appear on individual slides in the normal editing view. This makes them a favorite hiding place in CTF challenges - and in real malware, where attackers sometimes embed payload URLs or encoded scripts in master slide XML to evade document scanners that only inspect visible slide content.
Flag
picoCTF{...}
Office OOXML formats (.pptm, .docx, .xlsx) are renamed ZIP archives - always try extracting them with unzip to find hidden files.