
A POC for the CVE-2025-66516 Apache Tika Vulnerability for educational purposes only
Educational/Authorized Testing Only | License | Security Policy
This repository contains a proof-of-concept (POC) exploit for CVE-2025-66516, an XML External Entity (XXE) injection vulnerability in Apache Tika versions prior to 3.2.2. The vulnerability affects the XFA (XML Forms Architecture) parser in the tika-parser-pdf-module component, allowing attackers to read local files and exfiltrate sensitive data through maliciously crafted PDF documents.
CVE-2025-66516 is a critical security vulnerability in Apache Tika's PDF parsing functionality. When processing PDF files with embedded XFA forms, Tika versions before 3.2.2 fail to properly restrict external entity processing in XML parsers. This allows attackers to:
This repository includes:
Apache Tika XXE, CVE-2025-66516 exploit, Tika security vulnerability, XML External Entity attack, PDF XXE injection, Tika 3.2.1 vulnerability, out-of-band XXE, OOB XXE, security research, penetration testing, POC exploit, vulnerability disclosure, XFA parser vulnerability, tika-parser-pdf-module, file disclosure vulnerability, data exfiltration, SSRF attack, secure coding, vulnerability analysis, security testing, ethical hacking, infosec, cybersecurity research, Apache Tika exploit code, XXE payload, PDF security, document parser vulnerability
Note: This POC has been tested and verified on:
First, create a dedicated directory for the POC to keep all files organized.
mkdir apache_tika_poc
cd apache_tika_poc
Before proceeding with the POC, verify your environment has the required dependencies. These commands will display your Java compiler/runtime versions and OS details, which are important for reproducing the vulnerability.
# Check Java version
java -version
javac -version
# Check OS version
lsb_release -a
Expected Output: You should see Java version information (e.g., OpenJDK 17.x.x) and Ubuntu version details (24.04.3 LTS).
Download both the vulnerable (3.2.1) and patched (3.2.2) versions of Apache Tika. We need both versions to demonstrate that the XXE vulnerability exists in 3.2.1 and is fixed in 3.2.2. The tika-app JAR is an all-in-one executable that includes all Tika parsers and dependencies.
# Download vulnerable Tika version
wget https://repo1.maven.org/maven2/org/apache/tika/tika-app/3.2.1/tika-app-3.2.1.jar
# Download patched Tika version
wget https://repo1.maven.org/maven2/org/apache/tika/tika-app/3.2.2/tika-app-3.2.2.jar
Expected Output: Two JAR files will be downloaded - tika-app-3.2.1.jar (~75MB) and tika-app-3.2.2.jar (~75MB).
Verify the exact versions by inspecting the JAR manifest files. This confirms we have the correct vulnerable and patched versions before testing.
# Check vulnerable version manifest
unzip -p tika-app-3.2.1.jar META-INF/MANIFEST.MF
# Check patched version manifest
unzip -p tika-app-3.2.2.jar META-INF/MANIFEST.MF
Expected Output: Manifest files showing Implementation-Version: 3.2.1 and 3.2.2 respectively, along with build timestamps and other metadata.
If we look at the Project Object Models (Maven's POM properties define a project's dependencies, build configuration, and metadata.), we see there are no separate tika-parsers as mentioned in the security advisories - could be a version related thing and the assumption is in versions 3.2.1 and 3.2.2, which are part of the POC, the tika-parsers module were replaced by individual parser modules.
# List all component pom.properties files for both versions
unzip -l tika-app-3.2.1.jar | grep pom.properties | grep tika
unzip -l tika-app-3.2.2.jar | grep pom.properties | grep tika
Expected Output: A list of all Tika component modules including tika-core, tika-parser-pdf-module, tika-xmp, etc. You'll notice individual parser modules rather than a single tika-parsers module.
Extract and display the version information for core Tika components. This helps us understand the internal module structure and confirm that both the core library and PDF parser module are at the expected versions.
# Check tika-core, tika-parser-pdf-module, and tika-app versions for 3.2.1
unzip -p tika-app-3.2.1.jar META-INF/maven/org.apache.tika/tika-core/pom.properties && echo "---" && unzip -p tika-app-3.2.1.jar META-INF/maven/org.apache.tika/tika-parser-pdf-module/pom.properties && echo "---" && unzip -p tika-app-3.2.1.jar META-INF/maven/org.apache.tika/tika-app/pom.properties
# Check tika-core, tika-parser-pdf-module, and tika-app versions for 3.2.2
unzip -p tika-app-3.2.2.jar META-INF/maven/org.apache.tika/tika-core/pom.properties && echo "---" && unzip -p tika-app-3.2.2.jar META-INF/maven/org.apache.tika/tika-parser-pdf-module/pom.properties && echo "---" && unzip -p tika-app-3.2.2.jar META-INF/maven/org.apache.tika/tika-app/pom.properties
Expected Output: POM properties showing version=3.2.1 or version=3.2.2 for each component, separated by ---. All three components (tika-core, tika-parser-pdf-module, tika-app) should match the overall version.
Create a fake secrets file that will be the target of our XXE attack. This file simulates sensitive data (like API keys or credentials) that an attacker might try to exfiltrate through the XXE vulnerability.
# Create target secret file
echo "INTERNAL_SERVER_KEY=EXPOSED" > fake-secrets.txt