Skip to content
RCE Write-up Advanced

0 Day Bug Breaks Multi Million Dollar System

The Gotenberg PDF conversion service was exposed without authentication and had multiple vulnerabilities: path traversal in file upload, arbitrary file read via template helper, and a race condition in temporary profile handling that allowed code execution. An attacker could chain these to achieve unauthenticated remote code execution inside the organisation's network.

Blazej Adamczyk Follow

Published on infosecwriteups.com

The other day we got an order for black-box pentests from a country-wide organization. The organization serves tens or even hundreds of services across the country and their users are counted in millions.

Blazej Adamczyk, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Gotenberg service was exposed without authentication and its file handling and temporary profile management lacked proper input validation and isolation, allowing path traversal, arbitrary file read, and race-condition-based code execution.

Impact

An unauthenticated attacker could execute arbitrary code inside the organisation's network, pivot to internal services, and remain undetected for about two weeks.

What the attacker needed

Gotenberg exposed to the internet; no authentication required

The fix

The vulnerabilities were fixed in Gotenberg version 6.3.0, and the authors stated that Gotenberg should only be used internally by trusted applications.

How it was found

  1. Discover the Gotenberg component exposed at /api/gotenberg.
  2. Exploit path traversal in file upload to write arbitrary files.
  3. Use the toHTML helper to read arbitrary files from the container.
  4. Upload a malicious LibreOffice configuration to set up a macro.
  5. Flood the server with requests to reuse a predictable temporary profile directory.
  6. Trigger macro execution to achieve code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is about a service that turns HTML or documents into PDF files. It was reachable from the internet without a password and had several flaws: you could upload files to any location, read any file on the server, and eventually run your own commands. The attacker combined these to take control of the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.