# Impact of AI on CVEs : PROTECTION STRATEGIES

Heap out-of-bounds write in libheif's UNCI decoder lets a malformed HEIF image overwrite a heap vtable pointer, hijacking control flow to RCE, chained with a kernel LPE to root.

- Payout: Research
- Severity: critical
- Program: libheif
- Write-up by: JFrog Security Research
- Disclosed: 2026-11-24
- CVE: CVE-2026-47178
- Write-up quality: 7/10
- Original: https://jfrog.com/blog/impact-of-ai-on-cves-protection-strategies/
- Library page: https://bugbountylibrary.com/r/blog%3Ajfrog-com-blog-impact-of-ai-on-cves-protection-strategies
- Tags: area:oss domain:oss impact:privesc impact:rce kind:research platform:threat-intel sev:critical tech:linux technique:chained technique:source-review vuln:memory-corruption vuln:privilege-escalation vuln:rce

**Target:** libheif UNCI decoder / libheif-thumbnailer
**Root cause:** Heap out-of-bounds write in the UNCI decoder in libheif allows overwriting virtual function pointers on the heap, leading to control-flow hijack and remote code execution.
**Steps:**
1. Compile `heif-dec` (libheif-bundled C++ HEIF parser) with AddressSanitizer.
2. Instruct the AI to find a heap out-of-bounds write via static analysis only, then confirm dynamically via an ASAN crash.
3. Craft a malformed HEIF image tile that triggers the UNCI decoder OOB write.
4. Use heap feng shui to place and overwrite a C++ virtual function pointer; confirm instruction pointer control (classic `0x41414141`).
5. Target GNOME Nautilus, which decodes HEIF via `libheif-thumbnailer`; use a gadget in `libdav1d` (one_gadget-like) that calls `system()` with an attacker string in `rdi`.
6. Chain with the DirtyClone Linux kernel LPE (incomplete dirtyfrag patch fix) to escalate from code execution to root.
7. Deliver the malformed image via messaging app or by the user merely navigating to the file's directory in the file manager — no click required.
**How found:** Inspired by nation-state spyware using format parsing as initial access, the team targeted libheif. They built an ASAN-instrumented heif-dec and had an LLM perform static analysis to hypothesize a heap OOB write, using the ASAN crash as an oracle to rule out hallucination; the bug was found in ~2 hours.
**Exploitation:** A single malformed HEIF image is parsed by libheif-thumbnailer when Nautilus renders a thumbnail. The UNCI decoder OOB write corrupts a heap vtable pointer, redirecting a virtual call to a libdav1d gadget that invokes system() with attacker-controlled rdi, yielding code execution as the user. The DirtyClone kernel LPE then elevates to root, giving full system takeover with zero user interaction.
**Escalation:** Chained the libheif RCE with a Linux kernel LPE (DirtyClone, incomplete dirtyfrag fix) to go from user-level code execution to root.
**Insight:** Use ASAN-instrumented harnesses as a truth oracle for LLM static-analysis hypotheses: let the model propose the bug, then require a dynamic crash before investing exploit effort. Also check thumbnailer helper binaries (e.g. libheif-thumbnailer) rather than the main app, since file managers decode untrusted images out-of-process.

