Skip to content

Commit 043c0a5

Browse files
authored
Merge pull request #2164 from HackTricks-wiki/update_CVE-2026-33824__Remote_Code_Execution_in_Windows_I_20260423_190733
CVE-2026-33824 Remote Code Execution in Windows IKEv2
2 parents 8c3c9bc + 71c8aba commit 043c0a5

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/network-services-pentesting/ipsec-ike-vpn-pentesting.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,43 @@ Practical tips
328328
- Increase receive buffer and timeouts for UDP-based scanners to avoid packet loss.
329329
- If the service exposes custom Vendor IDs (see section above), use them to quickly fingerprint vulnerable versions before attempting any exploit traffic.
330330

331+
## IKEv2 fragmentation abuse: async shallow-copy double free (Windows IKEEXT case study)
332+
333+
RFC 7383 fragmentation (`SKF`, payload type `0x35`) is a good place to look for **pre-auth memory corruption** in IKEv2 implementations. Reassembly code often builds a temporary packet context, copies state from the long-lived SA object, and reinjects the reassembled message into later parsing stages. If some fields are **deep-copied** while embedded pointers are only **shallow-copied**, packet-context cleanup can free memory still owned by the SA, and the same allocation can be freed again later during SA teardown.
334+
335+
Real-world pattern seen in Windows IKEEXT:
336+
- During `IKE_SA_INIT`, a Vendor ID handler allocates a blob tied to the SA.
337+
- A fragmented `IKE_AUTH` is reassembled and queued for async processing.
338+
- The queueing path deep-copies the reassembly buffer but leaves the SA-owned blob pointer aliased inside the queued packet context.
339+
- Destroying the queued context frees the aliased pointer first.
340+
- Negotiation cleanup later tears down the original SA and frees the same pointer again, yielding a **double free** reachable from the network.
341+
342+
Practical auditing notes:
343+
- Treat **fragment reassembly + reinjection + async work queues** as one attack surface, not separate features.
344+
- Compare which fields are deep-copied versus shallow-copied when packet contexts are queued to worker threads.
345+
- Check whether invalid reassembled messages still traverse cleanup paths. A malformed `IKE_AUTH` may still be enough if reassembly and queue teardown happen before semantic validation fails.
346+
- For Windows targets, the reachable service is typically **IKEEXT** listening on **UDP/500** and **UDP/4500** (NAT-T), so successful exploitation targets a privileged network-facing service.
347+
348+
### Detection notes for fragmentation-driven IKEv2 exploitation
349+
350+
This pattern is **stateful**. A single packet is not enough; correlate packets within the same IKE session:
351+
352+
1. Look for an `IKE_SA_INIT` request that contains a vendor-specific setup payload. In the Windows case study, the write-up keys on:
353+
- UDP payload offset `17`: `20 22 08` (`IKEv2`, `IKE_SA_INIT`, initiator)
354+
- Vendor ID bytes anywhere later in the packet: `68 6a 8c bd fe 63 4b 40 51 46 fb 2b af 33 e9 e8`
355+
2. From the same source / IKE session, look for fragmented `IKE_AUTH` traffic:
356+
- UDP payload offset `16`: `35 20 23 08` (`SKF`, `IKEv2`, `IKE_AUTH`, initiator)
357+
- UDP payload offset `20`: `00 00 00 01`
358+
359+
Parsing notes:
360+
- Multi-byte fields are **big-endian**.
361+
- On **UDP/4500**, the 4-byte non-ESP marker `00 00 00 00` shifts all IKE offsets by `+4`.
362+
- Detection quality improves if you correlate on the IKE SPIs from the header instead of just source IP/port.
363+
364+
Operational notes:
365+
- If IKE is not needed, block **UDP/500** and **UDP/4500**.
366+
- If IKE is required, restrict those ports to known peers while patches are being deployed.
367+
331368
## Reference Material
332369

333370
- [PSK cracking paper](http://www.ernw.de/download/pskattack.pdf)
@@ -345,5 +382,8 @@ Practical tips
345382

346383
- [YIKES: WatchGuard Fireware OS IKEv2 out-of-bounds write (CVE-2025-9242)](https://labs.watchtowr.com/yikes-watchguard-fireware-os-ikev2-out-of-bounds-write-cve-2025-9242/)
347384
- [0xdf – HTB: Expressway](https://0xdf.gitlab.io/2026/03/07/htb-expressway.html)
385+
- [ZDI - CVE-2026-33824: Remote Code Execution in Windows IKEv2](https://www.thezdi.com/blog/2026/4/22/cve-2026-33824-remote-code-execution-in-windows-ikev2)
386+
- [RFC 7383 - Internet Key Exchange Protocol Version 2 (IKEv2) Message Fragmentation](https://datatracker.ietf.org/doc/rfc7383/)
387+
- [Microsoft Security Update Guide - CVE-2026-33824](https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2026-33824)
348388

349389
{{#include ../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)