/

CVE-2026-40893

Severity:

HIGH RISK

(8.2)

Improper File System Access Control in Gotenberg PDF API

CVE-2026-40893

Analyzed

Vulnerability type

Category:

Improper File System Access Control

CWE:

CWE-73, CWE-184

Impact:

Arbitrary File Manipulation (Move/Rename/Permission Changes)

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Gotenberg's PDF API contained a file handling flaw where it only validated EXIF tags against an exact match of "FileName," allowing specially crafted tags like "System:FileName" to bypass checks.

When exploited, this behavior lets remote attackers move, rename, or change permissions of arbitrary files accessible to the Gotenberg process, which is particularly risky in deployments where sensitive files reside on the same filesystem.

Affected context

The vulnerability occurs in Gotenberg deployments that:

  • Use the EXIF processing functionality (via ExifTool) for handling uploaded files
  • Rely on tag-based validation to constrain which EXIF operations are allowed
  • Run Gotenberg containers with filesystem access to directories containing other application or system files

In these contexts, an attacker-controlled file with crafted EXIF metadata can influence how ExifTool operates on the host filesystem within the container's view.

Exploit preconditions

  • Attack surface: HTTP(S) API endpoints that accept user-supplied files (e.g., images, documents) processed by ExifTool.
  • Required access: Ability to upload or submit files to a vulnerable Gotenberg instance; no prior authentication may be required depending on how the API is deployed.
  • Trigger point: The moment Gotenberg invokes ExifTool on the supplied file and applies tag-based rules intended to restrict file operations.
  • Why exploitation is possible: The tag validation logic checks only for an exact tag name "FileName" and fails to treat "System:FileName" and similar variants as dangerous. ExifTool then interprets the crafted tag as a legitimate instruction to rename/move files or change their permissions, enabling unintended file system operations.

Why this happens

This issue stems from incomplete validation of metadata tags passed to a powerful file-manipulation backend (ExifTool). Instead of enforcing a strict allowlist or fully qualifying allowed tag namespaces, the code only compared tag names to the exact string "FileName."

This pattern maps to CWE-73: External Control of File Name or Path, because attacker-controlled metadata effectively determines which files are manipulated, and to CWE-184: Incomplete List of Disallowed Inputs, since the validation logic does not correctly treat related or namespaced tags (e.g., "System:FileName") as dangerous.

Abstractly, any time user-controlled metadata or parameters are used to steer file operations without robust canonicalization and scoping of allowed operations, the application risks unintended control over file paths and permissions.

Potential impact

  • Attackers may rename or move arbitrary files reachable from the Gotenberg container's filesystem.
  • Attackers could change permissions on files, potentially making sensitive data world-readable or altering executability.
  • Application behavior may be disrupted by moving or renaming configuration files, temporary files, or generated outputs.
  • In some deployments, altered file permissions or locations could facilitate further compromise or data exfiltration.

General mitigation guidance

Effective mitigation typically focuses on tightening how metadata is interpreted and limiting file system authority:

  • Use a strict allowlist of EXIF tags, with explicit namespace handling (e.g., only a precise, scoped "FileName" tag, if truly needed) and reject all others by default.
  • Treat metadata as untrusted input: avoid passing tags through directly to ExifTool or other tools that can alter files without an intermediate validation layer.
  • Constrain the file system view of Gotenberg containers using chroot-like isolation, Docker volumes that contain only the minimal working set, and read-only mounts where possible.
  • Run Gotenberg with the least privileges required, ensuring it cannot modify sensitive directories or system files.
  • Implement defense-in-depth controls such as mandatory access control (e.g., AppArmor, SELinux) profiles tailored to restrict file operations from the container.

How teams detect issues like this

Detection often involves a combination of code-level and runtime techniques:

  • Static analysis / code review:
  • Look for places where user-controlled metadata (EXIF tags, headers, user parameters) is passed into external tools that can perform file operations.
  • Flag logic that performs simple string equality checks against dangerous tag names (e.g., "FileName") without handling namespaces or variants.
  • Identify any use of ExifTool or similar utilities where tag-based operations can influence filenames or paths.
  • Configuration and policy checks:
  • Verify container configurations to ensure Gotenberg has limited write access and is not mounted with broad host directories.
  • Enforce policies that disallow direct mapping of user-controlled input into file paths or file attributes.
  • Runtime monitoring:
  • Monitor file system activity from Gotenberg containers for unusual renames, moves, or chmod operations, especially outside expected working directories.
  • Use host-based intrusion detection or container security tools that can alert on unexpected file permission changes or file moves initiated by the Gotenberg process.

Sources

SourceLink
github.comgithub.com/gotenberg/gotenberg/security/advisories/GHSA-62p3-hvxx-fxg4

Frequently asked

questions

Yes. As long as an attacker can submit files to a vulnerable Gotenberg API endpoint that triggers ExifTool processing, they can attempt to exploit this issue remotely over the network.

The attacker typically needs only the ability to upload or provide files to Gotenberg. No shell or local access to the container is required; the exploit happens during normal file processing.

The most robust fix is to adopt a strict allowlist for EXIF tags (with explicit namespace handling), avoid passing unvalidated tags into ExifTool's file-modifying capabilities, and ensure the Gotenberg process is confined to a minimal, non-sensitive filesystem scope with least privilege.

Treat all metadata as untrusted input, avoid exposing powerful file operations directly to user-controlled parameters, apply strict input validation and canonicalization, and combine application-level checks with OS-level sandboxing and filesystem restrictions to contain impact if validation fails.

Find out what's already
exploitable in your codebase.