Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsStudyTraining
ProjectsChecklistsAI RankingsNewsletterStatusTagsAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Study
Training
Projects
Checklists
AI Rankings
Newsletter
Status
Tags
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

962+ Articles
124+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Security
  3. CVE-2026-40281: Gotenberg PDF API — ExifTool Metadata Command Injection (CVSS 10)
CVE-2026-40281: Gotenberg PDF API — ExifTool Metadata Command Injection (CVSS 10)

Critical Security Alert

This vulnerability is actively being exploited. Immediate action is recommended.

SECURITYCRITICALCVE-2026-40281

CVE-2026-40281: Gotenberg PDF API — ExifTool Metadata Command Injection (CVSS 10)

Gotenberg, a widely used Docker-powered stateless PDF API, contains a critical CVSS 10 command injection vulnerability in versions 8.30.1 and earlier. Unsanitized metadata values in the write endpoint allow attackers to split ExifTool stdin arguments via embedded newlines, achieving arbitrary code execution on the host.

Dylan H.

Security Team

May 7, 2026
6 min read

Affected Products

  • Gotenberg versions 8.30.1 and earlier

Executive Summary

CVE-2026-40281 is a critical (CVSS 10.0) command injection vulnerability in Gotenberg — a Docker-powered stateless API widely used to generate, convert, and manipulate PDF files in CI/CD pipelines, document automation workflows, and microservice architectures. The flaw resides in the metadata write endpoint, which sanitizes metadata keys for control characters but leaves metadata values entirely unsanitized.

An attacker can embed a newline character (\n) inside a metadata value, which splits the ExifTool stdin argument stream into two separate commands, allowing arbitrary ExifTool arguments — and through ExifTool's feature set, arbitrary OS command execution — to be injected.

Given Gotenberg's prevalence in containerized document processing workflows and its typical deployment with access to file systems and downstream services, successful exploitation can result in full container compromise and potential host escape depending on container security configuration.


Vulnerability Overview

AttributeValue
CVE IDCVE-2026-40281
CVSS Score10.0 (Critical)
Affected ProductGotenberg
Affected Versions8.30.1 and earlier
Vulnerability TypeImproper Input Neutralization / Command Injection
Attack VectorNetwork
Authentication RequiredDepends on deployment (often none — public API)
User InteractionNone
ImpactRemote Code Execution via ExifTool argument injection
Fixed In8.31.0+

Affected Products

ProductAffected VersionsRemediation
Gotenberg Docker API≤ 8.30.1Upgrade to 8.31.0 or later

Technical Analysis

Background: Gotenberg and ExifTool

Gotenberg is a stateless, containerized REST API that wraps tools like Chromium, LibreOffice, and ExifTool to provide document conversion and processing services. Its metadata write endpoint allows API callers to embed metadata (author, title, subject, keywords, etc.) into generated or converted PDF files.

ExifTool — the underlying metadata manipulation tool — accepts its operation parameters via stdin when Gotenberg passes them programmatically. Each metadata key-value pair is transmitted as a separate line in stdin, with ExifTool parsing each line as a distinct argument.

Root Cause: Unsanitized Metadata Values

The Gotenberg metadata write endpoint validates keys for control characters (such as newlines), preventing key-level injection. However, the corresponding value sanitization is absent — values are passed to ExifTool's stdin without stripping or escaping control characters.

Vulnerable input:
  metadata_key = "Author"
  metadata_value = "Attacker\n-execute=<payload>"

ExifTool stdin (split by newline):
  Line 1: -Author=Attacker
  Line 2: -execute=<payload>    ← injected ExifTool argument

The -execute option in ExifTool allows arbitrary Perl code execution, effectively enabling OS command execution in the container environment.

Exploit Path

1. Attacker sends POST request to Gotenberg metadata write endpoint
2. Metadata value contains embedded \n followed by -execute=<perl_payload>
3. Gotenberg passes unsanitized value to ExifTool via stdin
4. ExifTool receives two stdin lines: the legitimate metadata argument and the injected -execute argument
5. ExifTool executes the injected Perl payload
6. Arbitrary code runs in the Gotenberg container context

Exploitation Complexity

Because many Gotenberg deployments are internal microservices without authentication, exploitation may require no credentials at all — only network access to the Gotenberg API port (default: 3000). This drives the CVSS score to 10.0.

In environments where Gotenberg is exposed via an internet-facing API gateway or ingress controller without authentication, the attack surface is public.


Impact Assessment

Impact AreaDescription
RCE in ContainerArbitrary Perl/OS code execution in Gotenberg container
File System AccessAccess to all files mounted or accessible within the container
Network Lateral MovementContainer network allows access to backend services
Container Escape RiskDepends on container security posture (privileged mode, host mounts)
CI/CD Pipeline CompromiseGotenberg commonly integrated in document automation pipelines
Credential ExposureEnvironment variables, mounted secrets, service account tokens accessible

Immediate Remediation

Step 1: Upgrade Gotenberg

# Pull the patched image
docker pull gotenberg/gotenberg:8.31.0
 
# Update docker-compose.yml
services:
  gotenberg:
    image: gotenberg/gotenberg:8.31.0  # was 8.30.1 or earlier
    ...
 
# Redeploy
docker compose up -d gotenberg

Step 2: Verify Current Version

# Check running Gotenberg version
docker inspect gotenberg/gotenberg:latest | grep -i version
 
# Or check via health endpoint
curl http://localhost:3000/health

Step 3: Restrict API Access While Patching

If immediate upgrade is not possible, restrict Gotenberg API access to trusted internal callers only:

# Nginx example: restrict Gotenberg to internal subnets
location /forms/pdfengines/metadata {
    allow 10.0.0.0/8;
    allow 172.16.0.0/12;
    deny all;
}

Step 4: Review Container Security Posture

# Ensure Gotenberg is NOT running in privileged mode
docker inspect <gotenberg-container> | grep -i privileged
 
# Verify no unnecessary host mounts
docker inspect <gotenberg-container> | grep -A 5 '"Mounts"'
 
# Check container user — should not be root
docker exec <gotenberg-container> whoami

Step 5: Audit API Logs for Exploitation Indicators

# Look for metadata values containing newline-encoded sequences
grep -E "(%0a|%0A|\\\\n)" /var/log/nginx/gotenberg-access.log
 
# Check Gotenberg container logs for anomalous ExifTool invocations
docker logs gotenberg 2>&1 | grep -i "exiftool"

Detection Indicators

IndicatorDescription
Metadata value requests containing %0a, %0A, or literal newlinesExploitation attempt
Unexpected outbound network connections from Gotenberg containerPost-exploitation C2
Unusual file creation or modification within container filesystemPost-exploitation activity
Gotenberg container processes spawning unexpected child processesCode execution indicator
API requests to metadata endpoint from unusual source IPsScanning or exploitation
Container environment variable enumeration commands in logsCredential harvesting

Post-Remediation Checklist

  1. Upgrade Gotenberg to version 8.31.0 or later
  2. Audit API access controls — ensure Gotenberg is not internet-accessible without authentication
  3. Implement API authentication — add an API gateway with authentication in front of Gotenberg
  4. Review container security — disable privileged mode, minimize host mounts, run as non-root
  5. Scan historical API logs for exploitation artifacts (newline-encoded metadata values)
  6. Check downstream systems — if exploitation occurred, treat all services accessible from the Gotenberg container as potentially compromised
  7. Rotate secrets — refresh all environment variables and mounted secrets accessible to the container
  8. Consider network policies — Kubernetes NetworkPolicy or equivalent to restrict egress from Gotenberg pods

References

  • NVD — CVE-2026-40281
  • Gotenberg GitHub Repository
  • ExifTool Documentation — -execute option
  • OWASP — Command Injection
#CVE-2026-40281#Gotenberg#ExifTool#Command Injection#RCE#Docker#PDF#CVSS 10#Supply Chain

Related Articles

CVE-2026-30352: Remote Code Execution in leonvanzyl Autocoder via /devserver/start Command Injection (CVSS 9.8)

A critical remote code execution vulnerability in the /devserver/start endpoint of the leonvanzyl autocoder AI coding tool allows unauthenticated...

6 min read

CVE-2026-6951: simple-git RCE via --config Option Bypass (CVSS 9.8)

A critical remote code execution vulnerability in the simple-git npm package allows attackers to inject arbitrary git config options via the --config...

6 min read

Apache MINA Incomplete Deserialization Patch Leaves 2.1.X and 2.2.X Branches Vulnerable

Apache MINA versions 2.1.X and 2.2.X remain vulnerable to unauthenticated remote code execution because the fix for CVE-2026-41409 was never backported,...

6 min read
Back to all Security Alerts