Exploit database

GH-b7eeca4acf335ee5398b753d19eb63d8

chayewuu/prague-cve-2026-98260-os4.0

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 files6
chayewuu/prague-cve-2026-98260-os4.0Revision fd3ea3a8370e

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

tools/ksu_sym_audit_ko.py

Python · 3,189 bytes
#!/usr/bin/env python3
"""对任意 .ko 做 UND 符号审计,并与 ksu_symbols.inc 及内核符号表比对。

用法:
    python ksu_sym_audit_ko.py <ko 路径> [Image.symbols.txt]
不带参数时审计两个内置 ko,并对照默认的符号表。
"""
import struct
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
INC = ROOT / "src" / "ksu_symbols.inc"
ASSETS = ROOT / "android/app/src/main/assets"
SYMS = Path("D:/CVE-2026-64560/prague/analysis/Image.symbols.txt")

SHT_SYMTAB = 2
SHN_UNDEF = 0


def undef_symbols(blob):
    if blob[:4] != b"\x7fELF" or blob[4] != 2:
        raise SystemExit("不是 ELF64")
    e_shoff, = struct.unpack_from("<Q", blob, 0x28)
    e_shentsize, e_shnum = struct.unpack_from("<HH", blob, 0x3A)
    sections = []
    for i in range(e_shnum):
        off = e_shoff + i * e_shentsize
        f = struct.unpack_from("<IIQQQQIIQQ", blob, off)
        sections.append(dict(type=f[1], offset=f[4], size=f[5], link=f[6], entsize=f[9]))
    symtab = next((s for s in sections if s["type"] == SHT_SYMTAB), None)
    if not symtab:
        raise SystemExit("没有 .symtab")
    strtab = sections[symtab["link"]]
    names = []
    for i in range(symtab["size"] // symtab["entsize"]):
        off = symtab["offset"] + i * symtab["entsize"]
        st_name, st_info, st_other, st_shndx = struct.unpack_from("<IBBH", blob, off)
        if st_shndx != SHN_UNDEF or st_name == 0:
            continue
        s = strtab["offset"] + st_name
        end = blob.index(b"\0", s)
        names.append(blob[s:end].decode("ascii", "replace"))
    return names


def table_symbols():
    out = set()
    for line in INC.read_text(encoding="utf-8").splitlines():
        line = line.strip()
        if line.startswith('{"') and ", UINT64_C(" in line:
            out.add(line[2:line.index('"', 2)])
    return out


def kernel_symbols():
    out = set()
    if not SYMS.exists():
        return out
    for line in SYMS.read_text(encoding="utf-8", errors="replace").splitlines():
        parts = line.split()
        if len(parts) >= 2:
            out.add(parts[1])
    return out


def audit(ko, table, kallsyms):
    blob = ko.read_bytes()
    und = undef_symbols(blob)
    uniq = sorted(set(und))
    miss = [s for s in uniq if s not in table]
    print(f"\n=== {ko.name} ===")
    print(f"UND 引用 {len(und)} 条 / 去重 {len(uniq)} 条 / 表内 {len(uniq) - len(miss)} / 缺失 {len(miss)}")
    for s in miss:
        where = "内核符号表有" if s in kallsyms else "**内核符号表也没有**"
        print(f"  MISS {s:<32} {where}")
    return miss


def main():
    table = table_symbols()
    kallsyms = kernel_symbols()
    print(f"ksu_symbols.inc 表项 {len(table)} 条;内核符号表 {len(kallsyms)} 条")
    targets = [Path(a) for a in sys.argv[1:]] or [
        ASSETS / "kernelsu-prague.ko",
        ASSETS / "ksunext-prague.ko",
    ]
    total = 0
    for ko in targets:
        if not ko.exists():
            print(f"跳过(不存在):{ko}")
            continue
        total += len(audit(ko, table, kallsyms))
    print(f"\n合计缺失 {total} 条")


if __name__ == "__main__":
    main()