<?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>Cwe-78 — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/cwe-78/</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>Wed, 03 Jan 2024 16:25:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/cwe-78/feed.xml" rel="self" type="application/rss+xml"/><item><title>Gotenberg Unauthenticated RCE via ExifTool Metadata Key Injection</title><link>https://feed.craftedsignal.io/briefs/2024-01-gotenberg-rce/</link><pubDate>Wed, 03 Jan 2024 16:25:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-gotenberg-rce/</guid><description>Gotenberg version 8.29.1 is vulnerable to unauthenticated remote code execution (RCE) due to newline injection in metadata keys passed to ExifTool, allowing arbitrary command execution via the `-if` flag.</description><content:encoded><![CDATA[<p>Gotenberg version 8.29.1, a popular Docker-based solution for converting documents to PDF, is vulnerable to unauthenticated remote code execution (RCE). The vulnerability resides in the <code>/forms/pdfengines/metadata/write</code> endpoint, which handles writing metadata to PDF files. Due to insufficient validation of JSON metadata keys, an attacker can inject newline characters (<code>\n</code>) to manipulate ExifTool arguments. This allows the attacker to inject the <code>-if</code> flag to execute arbitrary Perl code, leading to OS command execution. This vulnerability was discovered on 2026-04-04 and affects deployments where Gotenberg&rsquo;s port 3000 is exposed without authentication. Exploitation is straightforward, requiring a single HTTP POST request with a crafted JSON payload, and the server returns a 200 OK status with a valid PDF, obscuring the attack.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker sends a POST request to <code>/forms/pdfengines/metadata/write</code> with a PDF file and a <code>metadata</code> JSON object.</li>
<li>The JSON object contains a key with embedded newline characters (<code>\n</code>).  For example: <code>&quot;Title\\n-if\\nsystem('id')||1\\n-Comment&quot;: &quot;x&quot;</code>.</li>
<li>Gotenberg&rsquo;s backend deserializes the JSON object. The <code>\n</code> character is preserved.</li>
<li>The crafted key is passed to the go-exiftool library.</li>
<li>go-exiftool writes the key verbatim to ExifTool&rsquo;s stdin, splitting it into separate arguments: <code>-Title</code>, <code>-if</code>, <code>system('id')||1</code>, <code>-Comment=x</code>.</li>
<li>ExifTool executes the <code>system('id')</code> command due to the <code>-if</code> flag, which evaluates Perl expressions.</li>
<li>The attacker exfiltrates the command output via out-of-band techniques, such as an HTTP callback.</li>
<li>The server responds with HTTP 200 and a valid PDF file.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows an unauthenticated attacker to execute arbitrary commands as the Gotenberg process user, which is <code>gotenberg</code> (UID 1001) and a member of the <code>root</code> group in the default Docker image. This enables the attacker to read and write files, establish reverse shells, or pivot to other systems in the network. Because the vulnerability requires no authentication and provides no error signal, any Gotenberg instance exposed to an untrusted network is at risk of complete compromise.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Implement input validation within Gotenberg to reject metadata keys containing control characters such as <code>\n</code>, <code>\r</code>, and <code>\x00</code>. Reference the code example in the advisory (strings.ContainsAny).</li>
<li>Deploy the following Sigma rule to detect exploitation attempts by identifying requests with newline characters in the metadata parameter.</li>
<li>Place Gotenberg behind an authenticated reverse proxy to prevent direct access from untrusted networks.</li>
<li>Monitor webserver logs for POST requests to the <code>/forms/pdfengines/metadata/write</code> endpoint, as this is the entry point for the attack. Enable webserver logging to capture request parameters.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>gotenberg</category><category>rce</category><category>exiftool</category><category>newline-injection</category><category>cwe-78</category></item></channel></rss>