Exploit databaseDownload repository ZIP
GH-9247836616796f879c19808cd689e07b
youssefnoser/opd2415-6.6.118-cve-2026-64560-ksu
Sources for CVE-2026-64560
19 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files13
youssefnoser/opd2415-6.6.118-cve-2026-64560-ksuRevision 1f03ea62a6b3
- ↑..Parent directory
- accept_run.py
- batch_loop.sh
- device_retry3.sh
- device_run.py
- ksu_hit_watch.sh
- post_hit_check.sh
- pstore_classify.sh
- root_exec.sh
- shot.sh
- shot_loop.sh
- spray_probe.c
- verify-render.sh
- wiring_assert.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
repro/tools/accept_run.py
Python · 11,182 bytes#!/usr/bin/env python3
"""按任务的 Definition of Done 核对一份(或多份)真机日志,产出可复核的验收报告。
为什么单独写一个:DoD 的每一条都要求"整行精确匹配 + 无 GATE_FAIL",靠肉眼看日志
很容易把 `STAGE0_MISS_NOT_PROVEN`、`SPRAY_DONE errors=0` 这类中间读数误当成通过;
而且"两次冷启动"这条必须把两份日志的 `boot_id` 对起来看。所以把它做成 fail-closed
的检查器:**只认精确的 marker 行**,缺哪条就明确写缺哪条,绝不"看着像通过就算通过"。
用法:
python3 repro/tools/accept_run.py <log> [<log> ...] \
--profile profiles/plz110/plz110-242e1a07f878-ce21.json [--json report.json]
* 一份 PREFLIGHT 日志、若干份 `--run` 日志可以一起传;脚本按内容自动分类。
* 检查项与 DoD 的对应关系写在报告里(`dod` 字段),便于直接把报告贴进验收记录。
"""
from __future__ import annotations
import argparse
import json
import re
import sys
from pathlib import Path
class FailClosed(Exception):
pass
def read_log(path: Path) -> str:
if not path.is_file():
raise FailClosed(f"日志不存在:{path}")
text = path.read_text(encoding="utf-8", errors="replace")
if text.lstrip().startswith("{"):
# 流水线自己的 preflight 报告是 JSON,把里面的 stdout/stderr 还原成行
try:
report = json.loads(text)
except json.JSONDecodeError:
return text
chunks: list[str] = []
def walk(node) -> None:
if isinstance(node, str):
chunks.append(node)
elif isinstance(node, list):
for item in node:
walk(item)
elif isinstance(node, dict):
for value in node.values():
walk(value)
for key in ("stdout", "stderr", "transcript", "preflightOutput", "facts"):
if key in report:
walk(report[key])
if not chunks:
walk(report)
if chunks:
return "\n".join(chunks) + "\n"
return json.dumps(report, ensure_ascii=False)
return text
def find(lines: list[str], pattern: str) -> list[str]:
rx = re.compile(pattern)
return [line.strip() for line in lines if rx.search(line)]
def one(lines: list[str], pattern: str, label: str, problems: list[str]) -> str | None:
hits = find(lines, pattern)
if not hits:
problems.append(f"缺少 {label}(正则 {pattern})")
return None
return hits[0]
def classify(text: str) -> str:
if "PREFLIGHT_PASS" in text and "RACE_STAGE_BEGIN" not in text:
return "preflight"
if "RACE_STAGE_BEGIN" in text or "ROOT_CHILD_HOLD_PASS" in text:
return "run"
return "unknown"
def check_preflight(path: Path, text: str, profile_id: str, problems: list[str]) -> dict:
lines = text.splitlines()
out: dict = {"kind": "preflight", "path": str(path)}
line = one(lines, rf"^PREFLIGHT_PASS profile={re.escape(profile_id)} .*kernel_writes=0$",
"PREFLIGHT_PASS(含 kernel_writes=0)", problems)
out["preflight_pass"] = line
if line and "race_not_started=1" not in line:
problems.append(f"PREFLIGHT_PASS 行里没有 race_not_started=1:{line}")
gates = find(lines, r"^TARGET_PROFILE_GATE_PASS|^UHID_GATE_PASS|^RACE_CPU_LIMIT_GATE_PASS|^ENV_GATE")
out["gates"] = gates
for need in ("TARGET_PROFILE_GATE_PASS", "UHID_GATE_PASS", "RACE_CPU_LIMIT_GATE_PASS", "ENV_GATE"):
if not any(g.startswith(need) for g in gates):
problems.append(f"preflight 缺门禁 {need}")
out["gate_fail"] = find(lines, r"GATE_FAIL")
if out["gate_fail"]:
problems.append("preflight 出现 GATE_FAIL:" + "; ".join(out["gate_fail"]))
return out
DOD_ITEMS = [
("stage0_won", r"^BOOTID_WRITE_PASS attempt=\d+ q0=.*$",
"stage0(KASLR 地标写入)成功"),
("stage0_gate", r"^STAGE0_GATE_PASS slide=.*$", "STAGE0 门禁通过(拿到 slide)"),
("bridge_open", r"^MISC_BRIDGE_OPEN_PASS fd=.*$", "假 fops 装好、桥能打开"),
("bridge_rw", r"^MISC_BRIDGE_RW_PASS fd=.*$", "任意读/写通道自证"),
("phys_layout", r"^PHYS_LAYOUT_PASS memstart=.*$", "物理布局门禁(memstart/kimage_voffset)"),
("phys_read", r"^PHYS_READ_PASS virtual=.*$", "物理读自证"),
("phys_write", r"^PHYS_WRITE_PASS virtual=.*$", "物理写自证"),
("root_child", r"ROOT_CHILD_HOLD_PASS child=\d+ uid=0", "root 子进程持有(uid=0)"),
("cleanup", r"^KERNEL_STATE_RESTORE_PASS dirty=0$", "内核状态还原自证"),
]
#: 持仓式交付(cycle 336n ② 裁决):root 是**进程内持有**(hold-style),payload 退出即失,
#: 不落盘、reboot 即失 —— `KERNEL_STATE_RESTORE_PASS`(落盘式清理自证)对持仓式**不适用**。
#: `--hold` 下该项记 `N/A (hold-style)`,不再计入未满足项。
HOLD_EXEMPT_ITEMS = {"cleanup"}
def check_run(path: Path, text: str, landmark: str | None, problems: list[str],
hold: bool = False) -> dict:
lines = text.splitlines()
out: dict = {"kind": "run", "path": str(path), "hold_style": bool(hold)}
env = find(lines, r"^ENV_GATE .*boot_id=")
out["env_gate"] = env[0] if env else None
if env:
match = re.search(r"boot_id=([0-9a-f-]+)", env[0])
out["boot_id"] = match.group(1) if match else None
else:
problems.append("缺 ENV_GATE 行(拿不到 boot_id,无法核对'两次冷启动')")
out["items"] = {}
for key, pattern, label in DOD_ITEMS:
hit = find(lines, pattern)
entry: dict = {"label": label, "hit": hit[0] if hit else None, "count": len(hit)}
if hold and key in HOLD_EXEMPT_ITEMS and not hit:
entry["status"] = "N/A (hold-style)"
out["items"][key] = entry
stage0 = out["items"]["stage0_won"]["hit"]
if stage0:
out["stage0_q0"] = re.search(r"q0=(0x[0-9a-f]+)", stage0).group(1)
if landmark and out["stage0_q0"] != landmark:
problems.append(
f"BOOTID_WRITE_PASS 的 q0={out['stage0_q0']} ≠ profile 的 direct.bootidParent={landmark}"
"(写到了别处,不算 stage0 通过)")
out["session_markers"] = {
"croscache_ks": bool(find(lines, r"^CROSSCACHE_KS ")),
"attempt_begin": len(find(lines, r"^ATTEMPT_BEGIN ")),
"reclaim_hits": sum(len(find(lines, r"^ORDER1_RECLAIM_GATE changed_nodes=[1-9]")) for _ in [0]),
"not_proven": len(find(lines, r"NOT_PROVEN")),
}
out["fails"] = find(lines, r"GATE_FAIL|BRIDGE_STAGE_FAIL|KERNEL_STATE_RESTORE_NOT_PROVEN")
return out
def main(argv: list[str]) -> int:
parser = argparse.ArgumentParser(description="DoD 验收核对(日志 → 报告)")
parser.add_argument("logs", nargs="+", help="真机日志(preflight 与 --run 可以混着传)")
parser.add_argument("--profile", help="profile JSON(取 port.direct.bootidParent 做地标对拍)")
parser.add_argument("--json", help="把报告写成 JSON")
parser.add_argument("--hold", action="store_true",
help="持仓式交付:root 为进程内持有(hold-style),"
"cleanup 项记 N/A(hold-style),不计入未满足")
args = parser.parse_args(argv)
problems: list[str] = []
profile_id = "plz110-242e1a07f878"
landmark = None
if args.profile:
profile = json.loads(Path(args.profile).read_text(encoding="utf-8"))
profile_id = profile.get("id", profile_id)
direct = (profile.get("port") or {}).get("direct") or {}
landmark = direct.get("bootidParent")
report: dict = {"profile": profile_id, "landmark": landmark, "logs": [],
"dod": {
"1_build_reproducible": "由 repro/fgroot.py build + profile-check 负责(不在本脚本范围)",
"2_preflight": "见 preflight 段:整行 PREFLIGHT_PASS + kernel_writes=0 + 无 GATE_FAIL",
"3_full_chain": "见 run 段的 items(stage0 → bridge → phys → root_child)",
"3_two_cold_boots": "≥2 份 run 日志的 boot_id 不同",
"4_profile_updated": "人工:profile 的 validation/verdict 如实更新",
}}
for raw in args.logs:
path = Path(raw)
text = read_log(path)
kind = classify(text)
if kind == "preflight":
report["logs"].append(check_preflight(path, text, profile_id, problems))
elif kind == "run":
report["logs"].append(check_run(path, text, landmark, problems, hold=args.hold))
else:
problems.append(f"{path}: 认不出是 preflight 还是 --run 日志(缺 marker)")
boots = {entry.get("boot_id") for entry in report["logs"]
if entry.get("kind") == "run" and entry.get("boot_id")}
report["distinct_boot_ids"] = sorted(b for b in boots if b)
if len(report["distinct_boot_ids"]) < 2:
problems.append(
f"只看到 {len(report['distinct_boot_ids'])} 个不同的 boot_id(DoD 要求≥2 次冷启动)")
runs = [e for e in report["logs"] if e.get("kind") == "run"]
for entry in runs:
for key, _pattern, label in DOD_ITEMS:
if entry["items"][key]["hit"] is None:
if args.hold and key in HOLD_EXEMPT_ITEMS:
continue # cycle 336n ②:持仓式下 cleanup 记 N/A(hold-style)
problems.append(f"{Path(entry['path']).name}: 缺「{label}」")
report["problems"] = problems
report["verdict"] = "ACCEPT" if not problems and runs else "INCOMPLETE"
if args.json:
Path(args.json).write_text(json.dumps(report, indent=2, ensure_ascii=False) + "\n",
encoding="utf-8")
print(f"判定:{report['verdict']}")
print(f"profile={report['profile']} landmark={report['landmark']}")
print(f"不同 boot_id:{report['distinct_boot_ids']}")
for entry in report["logs"]:
print(f"\n[{entry['kind']}] {entry['path']}")
if entry["kind"] == "run":
print(f" boot_id={entry.get('boot_id')} attempts={entry['session_markers']['attempt_begin']}"
f" not_proven={entry['session_markers']['not_proven']}"
+ (" [hold-style]" if entry.get("hold_style") else ""))
for key, _pattern, label in DOD_ITEMS:
hit = entry["items"][key]["hit"]
print(f" {'OK ' if hit else 'MISS'} {label}" + (f" | {hit}" if hit else ""))
else:
print(f" PREFLIGHT_PASS: {entry.get('preflight_pass')}")
if problems:
print("\n未满足:")
for item in problems:
print(f" - {item}")
return 0 if report["verdict"] == "ACCEPT" else 1
if __name__ == "__main__":
try:
raise SystemExit(main(sys.argv[1:]))
except FailClosed as exc:
print(f"accept_run: {exc}", file=sys.stderr)
raise SystemExit(2)