Summary
On Citrix NetScaler ADC and Gateway, sending an over-long Host header to a specific endpoint makes the response run past the bounds of its buffer and return adjacent memory as well.
Those memory fragments frequently contain the session cookies of users who are currently logged in. With a stolen cookie the attacker takes over the session directly — no password, no MFA prompt. In 2023 this became the initial access method of choice for several ransomware operations.
Method note
The check below detects the leak through a size anomaly without storing the leaked content. Because the leaked bytes contain live credentials, test output must never be kept.
Advisory details
Root cause: a copy without a length check
While building the response, a field taken from the request is written into a fixed-size buffer without validating its length, and the response length is calculated from that value. The reply therefore ships whatever stale data was left in the buffer.
Because that region neighbours the memory used for authentication, the practical content of the leak is valid session tokens.
Exposure check
Start by reading the build number.
analyst@ubuntu:~/labs/netscaler$ ssh nsroot@gw.lab.local 'show version' | head -n 2 NetScaler NS13.1: Build 49.13.nc, Date: Jun 15 2023 # below 13.1-49.15 — affected build
Figure 1 — Reading the appliance build number
Next, measure the size of the response to an over-long Host header. A patched appliance returns a small, fixed response; an affected one returns far more.
analyst@ubuntu:~/labs/netscaler$ curl -sk -o /dev/null -w 'response size: %{size_download} bytes\n' -H "Host: $(python3 -c 'print("a"*8000)')" https://gw.lab.local/oauth/idp/.well-known/openid-configuration response size: 63218 bytes # expected ~1 KB; the rest is adjacent memory # content was not stored, only the size was measured
Figure 2 — Detecting the leak through a response size anomaly
Impact
A leaked session token can be replayed with all of that user's privileges. The attacker never knows the password and never answers the MFA challenge, so classic “failed login” alerting stays silent.
Remediation: patching alone is not enough
The step most often missed is terminating existing sessions after patching. Tokens stolen before the patch remain valid afterwards.
analyst@ubuntu:~/labs/netscaler$ ssh nsroot@gw.lab.local 'kill aaa session -all; kill icaconnection -all; show version' | head -n 2 Done NetScaler NS13.1: Build 49.15.nc, Date: Oct 10 2023 # all active sessions terminated, build current
Figure 3 — Terminating every session after the patch
- Apply the patch, then kill all AAA and ICA sessions.
- Review VPN session records from before the patch for the same account logging in from different countries at the same time.
- Remove the management interface from the internet wherever possible.
Log hunting
analyst@ubuntu:/var/log/netscaler$ grep -hoE 'LOGIN .*Source [0-9.]+' ns.log* | awk '{print $NF}' | sort | uniq -c | sort -rn | head -n 4 128 185.220.1xx.44 31 45.148.1xx.9 12 10.20.5.17 # one account, three countries — takeover suspected
Figure 4 — Anomalous source distribution in session records
Conclusion
Citrix Bleed shows that memory safety bugs do not only cause crashes — they produce identity theft. Remote access appliances need discipline on two fronts: patching and session management. Invalidating sessions after every critical patch should be a standard step.
Sources
Test it in your own environment
We test your remote access and VPN estate, including session hijacking scenarios.