4 Critical Lessons from the Apache Tika Bug That Scored a Perfect
Apache Tika's core XML parser resolved external entities when parsing XFA content embedded in PDFs, so a crafted PDF could trigger XXE. An attacker could then read server files, make the server issue requests to internal or cloud metadata endpoints, crash the service, and possibly chain to remote code execution.
Published on medium.com
In countless businesses, every day, systems automatically process a flood of documents like PDFs for indexing, searching, or compliance checks. This is a mundane, essential task, often handled by tools so deeply embedded that they’re practically invisible.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the XML parser in tika-core was left with external entity resolution enabled by default, so untrusted XFA content inside a PDF was parsed with implicit trust.
Impact
An attacker could read sensitive server files, force the server to query internal and cloud metadata endpoints, crash the service through resource exhaustion, and possibly chain to remote code execution; the text says no special configuration or application code is needed.
What the attacker needed
Ability to submit a PDF to Tika; no authentication needed; no user interaction needed
The fix
The vulnerable component should be upgraded: tika-core to 3.2.2 or later, and the legacy 1.x tika-parsers module also needs attention.
How it was found
- Craft a PDF that embeds a specially designed XFA form.
- Submit or upload that PDF so Apache Tika processes it.
- Tika automatically extracts text and metadata and parses the embedded XFA with its core XML parser.
- The parser resolves the external entities, triggering the XXE effects.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Apache Tika is a background tool that reads documents such as PDFs so other software can search them. Its XML parser was set up to fetch outside references written inside a document, so a booby-trapped PDF could make the server fetch things it should not. That let an attacker read files or reach internal services the server can talk to.
What is XXE?
An XML parser resolves entities the attacker defines, reading local files or making the server send requests.