HTTP Header Injection In Citrix ADC And Citrix Gateway (CVE-2020-8300, CVE-2021-22927)
Citrix ADC and Citrix Gateway, when configured as a SAML Service Provider, did not properly encode the RelayState parameter, allowing an attacker to inject CR-LF characters into the Location header of a redirect response. This could let an attacker execute arbitrary JavaScript in a victim's browser on protected pages, potentially taking over the victim's account.
Published on certitude.consulting
Written by Wolfgang Ettlinger on 30.11.202130.11.2021
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
The appliance failed to encode or validate the RelayState parameter before inserting it into the Location header, allowing CR-LF injection.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser on protected pages, potentially taking over the victim's account; the text notes that other browsers may require different approaches.
What the attacker needed
Citrix ADC/Gateway configured as SAML SP; Victim logged in on the IdP; Victim clicks attacker link
The fix
Citrix issued patches (CVE-2020-8300 and CVE-2021-22927) and additional configuration steps are required to mitigate the issue.
How it was found
- The attacker accesses the protected page to retrieve a valid SAMLRequest.
- The attacker lures a victim, that is logged in on the IdP, on an attacker-controlled page.
- The page redirects the victim to the IdP using an HTML form with the SAMLRequest and a manipulated RelayState.
- After checking that the user is already authenticated, the IdP redirects the browser back to the appliance.
- The appliance issues an HTTP redirect containing the manipulated URL in the Location-header.
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.
When you log in to a website using a single sign-on system, the site often redirects you back to the page you wanted. The address of that page is stored in a parameter called RelayState. The Citrix appliance put that address directly into a response header without cleaning it, so an attacker could add extra lines that make the browser run malicious code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.