Gotenberg Unauthenticated SSRF Vulnerability
Gotenberg is vulnerable to Server-Side Request Forgery (SSRF) due to bypassable default deny-lists in the `downloadFrom` and `webhook` features, where case-sensitive regex matching allows attackers to use IPv6 loopback URLs to bypass the deny-list and access internal HTTP services.
Gotenberg, a Docker-based solution for converting HTML, Markdown, and Office documents to PDF, contains an unauthenticated SSRF vulnerability affecting its downloadFrom and webhook features. The vulnerability stems from a bypassable default deny-list that is intended to prevent the service from making outbound requests to internal-only targets. Due to case-sensitive regex matching, an attacker can supply URLs encoded with IPv6 loopback addresses, such as http://[::ffff:127.0.0.1]:..., to circumvent the deny-list. This allows an external attacker to force the Gotenberg server to make outbound requests to internal-only resources, potentially exposing sensitive information or services. The issue affects versions of Gotenberg prior to the fix, and defenders should implement mitigations to prevent unauthorized access to internal resources.
Attack Chain
- An attacker identifies a Gotenberg instance with the vulnerable
downloadFromorwebhookfeatures enabled. - The attacker crafts a malicious URL containing an IPv6 loopback address (e.g.,
http://[::ffff:127.0.0.1]:18081/page_1.pdf) to bypass the case-sensitive deny-list. - For the
downloadFromfeature, the attacker sends a POST request to/forms/pdfengines/metadata/readwith the crafted URL in thedownloadFromparameter. - For the
webhookfeature, the attacker sends a POST request to/forms/pdfengines/flattenwith the crafted URL in theGotenberg-Webhook-UrlorGotenberg-Webhook-Events-Urlheader. - Gotenberg’s filtering logic, due to its case sensitivity, fails to block the request because of the IPv6 loopback formatting.
- Gotenberg makes an outbound GET request (for
downloadFrom) or POST request (forwebhook) to the attacker-specified internal resource. - The internal resource processes the request and returns data to the Gotenberg server.
- The attacker gains access to the data from the internal resource via the Gotenberg server, potentially leading to information disclosure or further exploitation.
Impact
Successful exploitation of this SSRF vulnerability allows unauthenticated attackers to bypass intended restrictions and force the Gotenberg server to interact with internal resources. This can lead to the exposure of sensitive information residing on internal services, potentially including configuration files, internal APIs, or other confidential data. The impact could include unauthorized access to sensitive systems, data exfiltration, or the ability to pivot further into the internal network.
Recommendation
- Inspect webserver logs for HTTP requests containing URLs with IPv6 loopback addresses such as
http://[::ffff:127.0.0.1]in the request URI or headers, specifically targeting the/forms/pdfengines/metadata/readand/forms/pdfengines/flattenendpoints. - Deploy the Sigma rule provided in this brief to detect SSRF attempts using IPv6 loopback bypasses.
- Block the identified IOCs (URLs containing IPv6 loopback addresses) at network perimeters to prevent initial exploitation attempts.
Detection coverage 2
Detect Gotenberg SSRF via IPv6 Loopback Bypass - downloadFrom
criticalDetects SSRF attempts in Gotenberg's downloadFrom feature by identifying requests with IPv6 loopback addresses in the URL.
Detect Gotenberg SSRF via IPv6 Loopback Bypass - webhook
criticalDetects SSRF attempts in Gotenberg's webhook feature by identifying requests with IPv6 loopback addresses in the Gotenberg-Webhook-Url header.
Detection queries are kept inside the platform. Get full rules →
Indicators of compromise
3
url
| Type | Value |
|---|---|
| url | http://[::ffff:127.0.0.1]:18081/page_1.pdf |
| url | http://[::ffff:127.0.0.1]:18082/upload |
| url | http://[::ffff:127.0.0.1]:18082/events |