Document Metadata
The documents an organization publishes (PDFs, Word, Excel, PowerPoint, images) carry hidden metadata: who created them, with what software, on which machine, sometimes internal paths, usernames, printers, and even GPS coordinates in photos. Collecting a company’s public documents and extracting their metadata reveals internal users, naming conventions, software in use, and network structure —all useful for the attack phase.
What metadata reveals
Section titled “What metadata reveals”Each field is a clue about the inside of the organization:
- Author / last editor → internal usernames (
jdoe,a.perez). - Software and version → which office suite and OS they use (concrete vectors and exploits).
- Machine name → internal hostname convention.
- File paths → folder structure and network drives.
- Printers / servers → internal infrastructure.
- Dates → activity and reused templates.
- GPS (EXIF in photos) → physical locations.
The extracted usernames directly feed password spraying (see Password Spraying), phishing, and email enumeration.
Collect the documents
Section titled “Collect the documents”The first step is to locate and download the public documents, usually via file-type dorking with site:target.com filetype:pdf (and the same for docx, xlsx, pptx); see Google Dorking.
Extract metadata
Section titled “Extract metadata”exiftool extracts metadata from almost any file; metagoofil automates downloading and extraction from a domain:
metagoofil -d target.com -t pdf,docx,xlsx -o ./docsexiftool document.pdfexiftool -r ./docs/ | grep -iE 'author|creator|producer|company'exiftool photo.jpg | grep -i gps # coordinates in imagesOn Windows, FOCA is the classic tool: it downloads a domain’s documents and extracts and correlates their metadata visually.
From metadata to attack
Section titled “From metadata to attack”- Author names → list of internal users → deduce emails (see Email Enumeration).
- Software and versions → look for CVEs of that office suite or OS.
- Paths and hostnames → understand the internal network (useful in post-exploitation).
- GPS in photos → physical locations (physical red team).
Clean your own metadata (OPSEC)
Section titled “Clean your own metadata (OPSEC)”Just as you extract others’, don’t leak yours in reports or deliverables:
exiftool -all= photo.jpg # images: rewrites and strips EXIF/GPS# PDF caveat: exiftool appends a REVERSIBLE incremental update; the original stays in the file.# To truly sanitize, rewrite the PDF (drop old objects) then clean:qpdf --linearize dirty.pdf tmp.pdf && exiftool -all= tmp.pdfCommon mistakes
Section titled “Common mistakes”- Looking only at PDFs and forgetting images (EXIF/GPS) and old Office files (very metadata-rich).
- Stopping at one document: the value is in correlating dozens to see user and software patterns.
- Not cross-referencing author names with the employee list from People OSINT.
- Delivering your report with your own metadata inside (real name, paths, machine).
Defensive note
Section titled “Defensive note”Prevention: strip metadata before publishing any document (sanitization tools, Office’s “document inspector”), configure the office suite not to embed author or paths, train on what files reveal, and periodically audit which public documents leak metadata (run FOCA or metagoofil against your own domain).
Testing checklist
Section titled “Testing checklist”- Public documents collected (file-type dorking).
- Metadata extracted (exiftool / metagoofil / FOCA).
- Author names → list of internal users.
- Software and versions → look for CVE.
- Internal paths and hostnames noted.
- GPS in images (if applicable).
- Users cross-referenced with recon-email / ad-spray.
- My own documents stripped of metadata.