<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Gotenberg &lt;= 8.30.1 — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gotenberg--8.30.1/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Tue, 02 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gotenberg--8.30.1/feed.xml" rel="self" type="application/rss+xml"/><item><title>Gotenberg ExifTool Argument Injection via Metadata Values</title><link>https://feed.craftedsignal.io/briefs/2024-01-02-gotenberg-exiftool-injection/</link><pubDate>Tue, 02 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-02-gotenberg-exiftool-injection/</guid><description>Gotenberg version 8.30.1 and earlier is vulnerable to argument injection, where an unauthenticated attacker can inject arbitrary ExifTool pseudo-tags via newline characters in metadata values, leading to arbitrary file manipulation within the container filesystem.</description><content:encoded><![CDATA[<p>Gotenberg, a Docker-based solution for converting various document formats to PDF, is vulnerable to an argument injection flaw affecting versions 8.30.1 and earlier. This vulnerability stems from insufficient sanitization of metadata values passed to the ExifTool during PDF processing. Specifically, the application fails to properly sanitize newline characters within metadata values. By exploiting this flaw, an unauthenticated attacker can inject arbitrary ExifTool pseudo-tags, such as <code>-FileName</code>, <code>-Directory</code>, <code>-SymLink</code>, and <code>-HardLink</code>, allowing for unauthorized file manipulation, including renaming, moving, overwriting, and creating symbolic or hard links to files within the container&rsquo;s filesystem. The vulnerability is a bypass of an incomplete key sanitization fix introduced in version 8.30.1, highlighting the importance of thorough input validation.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious PDF file or uses an existing PDF.</li>
<li>The attacker injects a newline character followed by an ExifTool pseudo-tag (e.g., <code>-FileName=/tmp/inject_proof</code>) into a metadata value (e.g., the &lsquo;Title&rsquo; field).</li>
<li>The attacker sends the PDF, along with the crafted metadata, to the Gotenberg <code>/forms/pdfengines/metadata/write</code> endpoint via a POST request.</li>
<li>Gotenberg&rsquo;s <code>WriteMetadata</code> function in <code>pkg/modules/exiftool/exiftool.go</code> processes the metadata.</li>
<li>The unsanitized metadata value is passed to <code>go-exiftool</code>&rsquo;s <code>SetString</code> function.</li>
<li><code>go-exiftool</code> writes the key-value pair to ExifTool&rsquo;s stdin using <code>fmt.Fprintln(e.stdin, &quot;-&quot;+k+&quot;=&quot;+str)</code>.</li>
<li>The newline character splits the ExifTool stdin line into two separate arguments, injecting the attacker&rsquo;s pseudo-tag.</li>
<li>ExifTool executes the injected command (e.g., moving the PDF to <code>/tmp/inject_proof</code>).</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows an unauthenticated attacker to rename or move any PDF being processed to an arbitrary path within the container filesystem, which runs as root by default. This also enables overwriting arbitrary files (e.g., corrupting the <code>/etc/passwd</code> file), creating symlinks, and creating hard links. The container filesystem becomes fully exposed to arbitrary file manipulation.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply value sanitization parallel to the existing key check in <code>WriteMetadata</code> as described in the advisory.</li>
<li>Implement detection rules to identify attempts to exploit the vulnerability by monitoring for suspicious characters in HTTP requests to the <code>/forms/pdfengines/metadata/write</code> endpoint using the provided Sigma rule.</li>
<li>Monitor for unexpected file modifications within the Gotenberg container, especially the creation or modification of symbolic links and hard links, using <code>file_event</code> log source.</li>
<li>Upgrade to a patched version of Gotenberg that addresses this vulnerability to prevent exploitation (CVE-2026-40281).</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>argument-injection</category><category>vulnerability</category><category>container</category></item></channel></rss>