CSRF Protection Bypass - Atlassian Confluence Server
A built-in Confluence plugin reflected the request Origin header into CORS response headers for any URL matching its patterns, including non-existent paths that return a 404 page containing the user's CSRF token. An attacker could read that token cross-origin and use it to bypass CSRF protection, potentially creating an administrator account and gaining RCE.
The Server version of Atlassian Confluence comes with a built-in plugin named applinks-cors, with the following declaration in file atlassian-plugin.xml:
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 CORS filter reflected the attacker-supplied Origin header into Access-Control-Allow-Origin together with Access-Control-Allow-Credentials, without validating it against an allowlist, and applied it to error pages that leak the CSRF token.
Impact
With Secure Administrator Session disabled or already active, the leaked token could let an attacker create an administrator account and then achieve RCE by uploading a malicious plugin; however, Chrome's SameSite behaviour now blocks the cross-origin cookie, so the exploit only works in browsers like Firefox.
What the attacker needed
Victim visits attacker page; victim logged in to Confluence; browser sends cookies cross-site (e.g. Firefox); Secure Admin Session disabled or active
The fix
The issue was fixed in the listed Confluence versions, though the text notes an earlier fix was incomplete.
How it was found
- Create a web page that, when visited by a victim, sends a request to the consumer-info endpoint on the victim's Confluence site.
- Read the response from that request to extract the CSRF token.
- Use the leaked token to bypass CSRF protection.
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.
Websites use a rule called CORS to decide whether one site's page may read another site's responses. Here the server trusted whatever origin the browser sent, so a malicious page could read a Confluence page it should not see. That page happened to contain a secret anti-forgery token, which the attacker then reused to perform actions as the victim.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.