libopenapv / Android APV Codec Zero-Click Heap Buffer Overflow (CVE-2026-0006)
by Mobile Hacking Lab (independent patch analysis / reproduction); original discovery and disclosure credited to the unnamed reporting researchers per the repo's own attribution · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-0006
- Category
- binary
- Affected product
- libopenapv (Samsung APV — Advanced Professional Video — codec), integrated into Android 16 as a Mainline module (mediaswcodec / C2SoftApvDec)
- Affected versions
- libopenapv v0.1.11.1 through v0.1.13.0; Android 16 devices with security patch level before 2026-03-01 (e.g., Samsung Galaxy S26 Ultra and similar)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Tags
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-04 |
| Author / Researcher | Mobile Hacking Lab (independent patch analysis / reproduction); original discovery and disclosure credited to the unnamed reporting researchers per the repo’s own attribution |
| CVE / Advisory | CVE-2026-0006 |
| Category | binary |
| Severity | Critical |
| CVSS Score | 9.8 (as stated in source repository) |
| Status | PoC |
| Tags | android, libopenapv, apv-codec, heap-overflow, zero-click, media-framework, mediaswcodec, mainline-module |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | libopenapv (Samsung APV — Advanced Professional Video — codec), integrated into Android 16 as a Mainline module (mediaswcodec / C2SoftApvDec) |
| Versions Affected | libopenapv v0.1.11.1 through v0.1.13.0; Android 16 devices with security patch level before 2026-03-01 (e.g., Samsung Galaxy S26 Ultra and similar) |
| Language / Platform | Python (MP4 generator), C (ASan/native PoCs), Bash (ADB deployment); target platform ARM64 Android |
| Authentication Required | No |
| Network Access Required | No (local file/media processing; delivery of the crafted file is out of scope) |
Summary
The APV decoder in libopenapv parses two different structures — an AU_INFO PBU (Payload Byte Unit) and the actual FRAME PBU — to determine frame dimensions, but oapvd_info() and oapvd_decode() read those dimensions from different sources without cross-validating them. A crafted APV bitstream can declare small dimensions (16x16) in the AU_INFO PBU that Android’s media framework uses to size its output buffers, while the real FRAME PBU header declares much larger dimensions (64x64), causing oapvd_decode() to write far more pixel data than was allocated — an overflow of roughly 14,848 bytes. Because Android’s media framework processes video files automatically to generate thumbnails/previews, simply having the crafted MP4 land on a vulnerable device (e.g., via Google Photos indexing) can trigger the overflow with zero user interaction. The repository provides a generator that builds this mismatched MP4 from a valid baseline, native ASan/OOB-write PoCs that reproduce the crash offline, and a deployment script that pushes the file to an Android device and captures the resulting SIGSEGV/ASan report.
Vulnerability Details
Root Cause
oapvd_info() (used for buffer sizing) and oapvd_decode() (used for actual pixel writes) each trust the frame dimensions declared in a different PBU of the same access unit, with no consistency check between the AU_INFO PBU and the FRAME PBU headers before allocation and decode.
Attack Vector
- Attacker starts from a valid 64x64 YUV422 10-bit APV bitstream (
valid.apv) and a baseline MP4 container produced by ffmpeg. - Attacker injects a crafted
AU_INFOPBU (type 65) declaring 16x16 dimensions, while leaving the realFRAMEPBU at 64x64, and patches the container’sapvC/apv1/tkhdboxes to also advertise 16x16. - Attacker rebuilds the MP4’s
mdat,stsz, andstcoboxes so the container is well-formed and points at the crafted access unit. - Victim’s Android device processes the file (e.g., media scan / thumbnail generation in Google Photos) using the vulnerable
mediaswcodec/C2SoftApvDeccomponent. - The framework allocates a small (16x16) output buffer based on
oapvd_info(), thenoapvd_decode()decodes the actual 64x64 frame into it, overflowing the heap buffer and crashing the media process (or worse, corrupting adjacent heap state).
Impact
Zero-click heap memory corruption in a privileged Android system media process triggered by passive file/thumbnail processing, ranging from denial of service (crash) to potential remote code execution depending on heap layout and further exploitation.
Environment / Lab Setup
Target: Android 16 (API 36) ARM64 device/emulator, security patch level before 2026-03-01,
with the APV codec module present (/apex/com.android.media.swcodec/lib64/libcodec2_soft_apvdec.so)
Attacker: Python 3, adb, Android NDK r29+ (only needed to rebuild the native ASan PoC), ffmpeg (to regenerate the baseline MP4)
Proof of Concept
PoC Script
See
generate_overflow_mp4.py,deploy_exploit_mp4.sh,poc_mp4_asan.c,poc_android_oob_write.c,valid.apv, andapv-mp4/in this folder.
| |
generate_overflow_mp4.py patches a baseline MP4 with the mismatched AU_INFO/FRAME dimensions described above. deploy_exploit_mp4.sh pushes the resulting file to a connected Android device, triggers a media scan and viewer intent, and polls logcat for the resulting SIGSEGV/ASan crash signature, retrying automatically if the crash doesn’t trigger immediately.
Detection & Indicators of Compromise
Signs of compromise:
mediaswcodecor Google Photos crashing shortly after a new video/MP4 file appears on-device- Tombstones or ASan logs referencing
oapvd_decode,C2SoftApvDec, or the APV codec module - MP4 files whose container-level dimensions (
apvC/apv1/tkhd) disagree with the dimensions encoded in the embedded APV bitstream’sFRAMEPBU
Remediation
| Action | Detail |
|---|---|
| Primary fix | Apply the Android March 2026 Security Bulletin update; upstream libopenapv fixes landed in commit fb6a5eab (bounds/signature checks), v0.1.13.1 (oapv_param.c dimension validation), and v0.2.0.0 (bounds-checked bitstream reader) |
| Interim mitigation | Restrict automatic media scanning/thumbnailing of untrusted files where possible, and keep devices on the latest security patch level until upgraded |
References
Notes
Mirrored from https://github.com/mobilehackinglab/CVE-2026-0006-openapv-poc on 2026-07-05.
| |