Exploit database

GH-b7eeca4acf335ee5398b753d19eb63d8

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

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-98260

61 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.py

Python · 2,576 bytes
#!/usr/bin/env python3
"""离线审计:把 kernelsu-prague.ko 的未定义符号与 ksu_symbols.inc 表比对,列出缺失项。"""
import re
import struct
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parent.parent
INC = ROOT / "src" / "ksu_symbols.inc"
KO = ROOT / "android/app/src/main/assets/kernelsu-prague.ko"

SHT_SYMTAB = 2
SHN_UNDEF = 0


def parse_symbol_table(blob):
    """返回 ELF64 中所有 SHN_UNDEF 符号的名字。"""
    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
        sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link, sh_info, \
            sh_addralign, sh_entsize = struct.unpack_from("<IIQQQQIIQQ", blob, off)
        sections.append(dict(type=sh_type, offset=sh_offset, size=sh_size,
                             link=sh_link, entsize=sh_entsize))

    symtab = next((s for s in sections if s["type"] == SHT_SYMTAB), None)
    if symtab is None:
        raise SystemExit("没有 SYMTAB")
    strtab = sections[symtab["link"]]
    names = blob[strtab["offset"]:strtab["offset"] + strtab["size"]]

    out = []
    count = symtab["size"] // symtab["entsize"]
    for i in range(1, count):
        off = symtab["offset"] + i * symtab["entsize"]
        st_name, st_info, st_other, st_shndx, st_value, st_size = \
            struct.unpack_from("<IBBHQQ", blob, off)
        if st_shndx != SHN_UNDEF or not st_name:
            continue
        end = names.find(b"\0", st_name)
        out.append(names[st_name:end].decode("ascii", "replace"))
    return sorted(set(out))


def parse_inc(path):
    """抓 {"name", UINT64_C(0x...)} 形式的条目名。"""
    text = path.read_text(encoding="utf-8", errors="replace")
    return set(re.findall(r'\{"([^"]+)"\s*,\s*UINT64_C', text))


def main():
    ko = Path(sys.argv[1]) if len(sys.argv) > 1 else KO
    needed = parse_symbol_table(ko.read_bytes())
    have = parse_inc(INC)
    missing = [s for s in needed if s not in have]
    print(f"ko={ko}")
    print(f"undef_total={len(needed)} table={len(have)} missing={len(missing)}")
    for s in missing:
        print(f"  MISS {s}")
    extra = sorted(have - set(needed))
    if extra:
        print(f"table_extra={len(extra)} (表里有但 .ko 不引用)")
        for s in extra[:20]:
            print(f"  EXTRA {s}")


if __name__ == "__main__":
    main()