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-2026-23907 — Proof-of-concept exploit for Apache PDFBox path traversal vulnerability (CVE-2026-23907), demonstrating arbitrary file write via malicious PDFs with embedded files. | Kitploit
Tools/GitHubGitHub/joakimbulow/cve-2026-23907
Vulnerability AnalysisExploitationWeb Application ExploitationMalware AnalysisPenetration TestingBinary Analysis
GitHubjoakimbulow/cve-2026-23907

CVE-2026-23907

Proof-of-concept exploit for Apache PDFBox path traversal vulnerability (CVE-2026-23907), demonstrating arbitrary file write via malicious PDFs with embedded files.

View Repository
7 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

Apache PDFBox Path Traversal Vulnerability

Vulnerability Summary

Description

Apache PDFBox's ExtractEmbeddedFiles example code does not sanitize filenames when extracting embedded files from PDFs. An attacker can embed files with path traversal sequences (../) to write files to arbitrary filesystem locations.

Vulnerable Code

File: pdfbox/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java

root@kitploit:~
private static void extractFile(String filePath, String filename, PDEmbeddedFile embeddedFile)
        throws IOException
{
    String embeddedFilename = filePath + filename;  // NO SANITIZATION
    File file = new File(embeddedFilename);
    File parentDir = file.getParentFile();
    if (!parentDir.exists())
    {
        parentDir.mkdirs();  // Creates arbitrary directories
    }
    try (FileOutputStream fos = new FileOutputStream(file))
    {
        fos.write(embeddedFile.toByteArray());  // Writes to arbitrary location
    }
}

The filename parameter comes directly from the PDF without validation.

Impact

  • Arbitrary File Write: Write files anywhere the application has permissions
  • Privilege Escalation: Overwrite SSH keys, configuration files
  • Remote Code Execution: Overwrite executables, cron jobs, systemd services
  • Data Destruction: Overwrite critical system files

Attack Scenarios

  1. SSH Key Injection

    • Embedded filename: ../../.ssh/authorized_keys
    • Content: Attacker's public key
    • Result: SSH access
  2. Cron Job Injection

    • Embedded filename: ../../../etc/cron.d/malicious
    • Content: Malicious script
    • Result: Privilege escalation + persistence
  3. Configuration Overwrite

    • Embedded filename: ../../config/database.yml
    • Content: Malicious credentials
    • Result: Data exfiltration

Proof of Concept

Files Included

  • create_malicious_pdf.py - Generates malicious PDF with path traversal
  • TestPathTraversal.java - Demonstrates the vulnerability
  • test_path_traversal.sh - Automated test script
  • malicious_path_traversal.pdf - Pre-generated malicious PDF

Running the PoC

Quick Test

root@kitploit:~
./test_path_traversal.sh

Manual Test

root@kitploit:~
# 1. Generate malicious PDF
python3 create_malicious_pdf.py

# 2. Compile test (requires PDFBox JAR)
javac -cp pdfbox-app.jar TestPathTraversal.java

# 3. Run test
java -cp .:pdfbox-app.jar TestPathTraversal malicious_path_traversal.pdf

# 4. Verify path traversal
cat /tmp/path_traversal_poc

Expected Output

root@kitploit:~
PATH TRAVERSAL DETECTED!
Expected path prefix: /current/working/directory
Actual path: /tmp/path_traversal_poc

Affected Versions

  • Apache PDFBox 3.0.6 - Confirmed vulnerable

Affected Components

  • ExtractEmbeddedFiles.java example code
  • Applications using similar patterns
  • Any code calling PDComplexFileSpecification.getFilename() without sanitization
Download Tool