Skip to content
RCE Write-up Advanced

Typo3: leak to Remote code execution.

A debug mode leak exposed the TYPO3 encryptionKey, which is used to sign HMACs protecting serialized data. With the key, an attacker could forge a valid HMAC and trigger unsafe deserialization via a form parameter, leading to remote code execution.

synacktiv.com

Published on synacktiv.com

Written by Hugo Vincent - 17/12/2020 - in Pentest - Download

The author, on synacktiv.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 application unserializes user-controlled data after validating an HMAC, and the HMAC key was leaked via debug output, allowing an attacker to forge valid HMACs.

Impact

An unauthenticated attacker could achieve remote code execution on the server, but this required debug mode to be enabled to leak the encryptionKey.

What the attacker needed

Debug mode enabled; encryptionKey leaked; form with __state parameter

The fix

The text does not state a fix, but it should be fixed by disabling debug mode in production and avoiding unserialize on user-controlled data.

How it was found

  1. Brute force the admin login panel and observe a 500 error that leaks debug information including the encryptionKey.
  2. Use the leaked encryptionKey to calculate a valid HMAC for a malicious serialized payload.
  3. Generate a Guzzle gadget chain payload with phpggc, base64 encode it, and compute its HMAC.
  4. Send the payload via the __state parameter of a form submission (e.g., contact form).
  5. The server deserializes the payload, writing a PHP backdoor to a web-accessible folder.
  6. Access the backdoor to execute commands.

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.

TYPO3 is a content management system. A misconfiguration (debug mode) revealed a secret key. That key is used to sign data so users cannot tamper with it. With the key, an attacker can sign malicious data that the server later unserializes, which can run code.

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.