Skip to content
RCE Write-up Advanced

Steps to Reproduce

An OGNL injection vulnerability in Atlassian Confluence Server and Data Center allows an unauthenticated attacker to execute arbitrary code on the server. The flaw arises from insufficient validation of user input used in Velocity templates, enabling escape from a string literal and injection of malicious OGNL expressions.

jacobriggs.io

Published on jacobriggs.io

This is my PoC write-up for CVE-2021-26084, which amounts to RCE and affects certain versions of Confluence Server and Data Center instances. I've come across this vulnerability a few times during the course of my research, so decided to add a brief PoC write-up for ease of future reference.

Jacob Riggs, on jacobriggs.io

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 fails to sanitise user input that is embedded in single quotes within Velocity templates, allowing an attacker to use a Unicode escape sequence to break out of the string and inject OGNL expressions.

Impact

Successful exploitation could result in the execution of arbitrary code with the privileges of the server.

What the attacker needed

Target runs a vulnerable Confluence version; No authentication required; Network access to the Confluence instance

The fix

The vulnerability was fixed by upgrading to Confluence version 7.13.0 (LTS) or higher, or to specific patched versions for older branches.

How it was found

  1. Send a crafted HTTP request to a vulnerable endpoint such as /pages/doenterpagevariables.action with a malicious parameter value.
  2. Include the sequence u0027 in the parameter value to escape the string literal.
  3. Append an OGNL expression that executes arbitrary 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.

This is a bug in a popular team collaboration tool called Confluence. It lets someone who is not logged in run their own commands on the server, because the software fails to properly check some input that gets evaluated as code. The fix is to update to a patched version.

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.