Reversing Citrix Gateway for XSS
An unauthenticated open redirect in the Citrix Gateway OAuth logout endpoint could be turned into reflected XSS via CRLF injection, allowing an attacker to execute JavaScript or redirect users to a phishing page.
Published on blog.assetnote.io
One of the targets we looked at late last year was Citrix Gateway. Citrix Gateway is another of these “all-in-one” network devices, combining a load balancer, firewall, VPN, etc.
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
Likely the application failed to validate or encode the post_logout_redirect_uri parameter before using it in a Location header, allowing both arbitrary redirects and header injection.
Impact
An attacker could redirect users to a phishing page to steal credentials or execute arbitrary JavaScript to steal session cookies, and the endpoint remains available even if OAuth is not configured.
What the attacker needed
No authentication required; victim clicks a crafted link
The fix
The vulnerability was fixed by upgrading to the latest version of Citrix Gateway, as per Citrix's security bulletin.
How it was found
- Find the unauthenticated endpoint /oauth/idp/logout by analysing the ns_vpn_process_unauthenticated_request function.
- Identify the query parameter post_logout_redirect_uri from a log message in ns_aaa_oauth_fetch_logout_url.
- Send a request with an external URL in that parameter and observe a 302 redirect to the attacker-controlled location.
- Insert two newline sequences at the start of the parameter value to terminate the HTTP headers early.
- Append HTML containing a script tag to achieve reflected cross-site scripting in Chrome; use a ws:// URL for Firefox.
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.
An open redirect lets an attacker send a victim to a different website by abusing a link on the real site. CRLF injection means inserting special newline characters into a web response to break its structure and add new content, such as a script. Together, these let an attacker run malicious JavaScript in the victim's browser or trick them into entering credentials on a fake login page.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.