Skip to content
RCE Write-up Advanced

Confluence Unauthorized RCE Vulnerability (CVE-2019-3396) Analysis

A server-side template injection vulnerability in Confluence's Widget Connector allowed an attacker to pass a custom template path and load remote templates, leading to path traversal and remote code execution. An attacker could execute arbitrary commands on vulnerable Confluence Server or Data Center systems.

paper.seebug.org

Published on paper.seebug.org

On March 20, 2019, Confluence released a security alert, there was a server-side template injection vulnerability(CVE-2019-3396) in Confluence Server and Data Center, in the Widget Connector. An attacker is able to exploit this issue to achieve path traversal and remote code execution on systems that run a vulnerable…

The author, on paper.seebug.org

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

The Widget Connector allowed the `_template` parameter to be passed from user input without proper validation, and the template loading mechanism (ClasspathResourceLoader) permitted loading remote templates via protocols like FTP, leading to template injection and RCE.

What the attacker needed

Confluence Server or Data Center vulnerable version; Ability to insert a widget (e.g., YouTube video) in a page; For some versions, authentication required

The fix

The vulnerability was fixed by filtering the `_template` parameter in the Widget Connector, as seen in the patch.

How it was found

  1. Insert a YouTube video into a Confluence page and capture the request with Burpsuite.
  2. Add the `_template` parameter to the request parameters.
  3. Set `_template` to a remote template URL (e.g., an FTP URL hosting a malicious Velocity template).
  4. Send the request; Confluence loads and renders the remote template, executing the embedded code.

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.

Confluence is a collaboration tool. A feature that embeds videos from sites like YouTube let users supply a template file path. Because the path was not properly checked, an attacker could make Confluence load a template from a remote server. That template could contain code that runs on the Confluence server, giving the attacker control.

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.