Executive brief
Apache CXF is a widely-used Java framework for building web services and REST APIs. The OAuth2 security module has a flaw in how it constructs HTTP response headers: it fails to sanitize user-controlled input in the 'realm' parameter, allowing an attacker to inject line breaks and create malformed responses. An attacker exploiting this could inject fake HTTP headers, redirect users to malicious sites, or split the response to deceive clients—potentially leading to session hijacking or credential theft.
Technical details
The vulnerability is a CRLF injection (CWE-113) in the OAuth2 AuthorizationUtils class within Apache CXF's security module. The root cause is the lack of input sanitization when constructing the WWW-Authenticate HTTP response header: the 'realm' parameter is concatenated directly without removing or escaping CR (\r) and LF (\n) characters. An attacker who can control the realm value (e.g., via a malicious OAuth2 authorization request) can inject these characters to add arbitrary HTTP headers or completely split the HTTP response. The attack requires network access to an OAuth2-protected endpoint and no authentication or user interaction. Successful exploitation allows an attacker to manipulate response headers, potentially leading to cache poisoning, session hijacking, credential theft, or phishing. Fixed in versions 4.2.2 and 4.1.7.
Affected products
- Apache CXF org.apache.cxf:cxf-rt-rs-security-oauth2 >= 4.2.0, < 4.2.2; < 4.1.7
Timeline
- 2026-06-11: disclosed: Vulnerability disclosed on oss-security mailing list
- 2026-06-12: advisory: Published to GitHub Advisory Database and NVD
- 2026-06-12: patched: Fixes available in CXF 4.2.2 and 4.1.7