Gotenberg is a Docker-powered stateless API for PDF files. Prior to 8.31.0, 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. This vulnerability is fixed in 8.31.0.
The /forms/pdfengines/metadata/write endpoint accepts a JSON object with metadata and passes its keys directly to the ExifTool utility (via the go-exiftool library) without any character validation. Embedding a newline character (\n) in a JSON key causes the ExifTool stdin stream to split into a new argument line, allowing the attacker to inject arbitrary ExifTool flags. The -if flag enables Perl expression evaluation, which consequently leads to the execution of arbitrary operating system commands within a single HTTP request.
An unauthenticated attacker can achieve complete remote code execution (RCE) on the server hosting the Gotenberg container, thereby gaining access to sensitive data, ability to modify the system, or complete takeover.
Gotenberg should be updated to version 8.31.0 or newer, in which the vulnerability has been fixed. Additionally, it is recommended to restrict network access to Gotenberg API endpoints exclusively to trusted sources at the firewall or network layer.
Gotenberg (Docker application) in versions prior to 8.31.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HThecodingmachine Gotenberg
APPThecodingmachine< 8.31.0
Related vulnerabilities
SSRF w Gotenberg — ominięcie deny-list przez IPv6-mapped adresy
Gotenberg: injection w wartościach metadanych — zapis plików i symlinki
An incomplete-cleanup vulnerability in the Office rendering engine of Gotenberg through 6.2.1 allows an attack...
A directory traversal vulnerability in file upload function of Gotenberg through 6.2.1 allows an attacker to u...
In Gotenberg through 6.2.1, insecure permissions for tini (writable by user gotenberg) potentially allow an at...