Exploit database

GH-7b5f07d84a7eaff26b3cb7289fb549ec

xingchenrs/cybermeowfians

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

166 sources

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

Repository files1
xingchenrs/cybermeowfiansRevision f2047f10cc57

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

scripts/validate_repository.py

Suggested starting filePython · 16,304 bytes
#!/usr/bin/env python3
"""Validate the research repository tree and catalogs."""

from __future__ import annotations

import json
import re
import sys
from pathlib import Path


CORE_FILES = (
    "README.md",
    "LICENSE",
    "NOTICE",
    "THIRD_PARTY_NOTICES.md",
    "CONTRIBUTING.md",
    "SECURITY.md",
    "CITATION.cff",
    "PROVENANCE.md",
    "requirements.txt",
    "docs/public/OVERVIEW.md",
    "docs/public/SCOPE.md",
    "docs/public/GLOSSARY.md",
    "docs/public/cases/CASE_INDEX.json",
    "BUILD_MATRIX.json",
    "USAGE_CATALOG.json",
    "skills/android-kernel-porting-research/SKILL.md",
    "tools/kernel-analysis-kit/README.md",
    "scripts/validate_repository.py",
)
TEXT_SUFFIXES = {
    "",
    ".c",
    ".bat",
    ".cff",
    ".cmd",
    ".gitignore",
    ".h",
    ".json",
    ".md",
    ".mk",
    ".py",
    ".ps1",
    ".s",
    ".txt",
    ".yaml",
    ".yml",
}
IGNORED_DIRS = {
    ".git",
    ".pytest_cache",
    ".mypy_cache",
    ".ruff_cache",
    "__pycache__",
    ".superpowers",
}
IGNORED_PREFIXES = (
    "docs/plans/",
    "docs/specs/",
)
FORBIDDEN_SUFFIXES = {
    ".bin",
    ".elf",
    ".i64",
    ".id0",
    ".id1",
    ".id2",
    ".img",
    ".ko",
    ".o",
    ".pyc",
    ".so",
    ".til",
}
FORBIDDEN_TEXT = {
    r"\blater researcher\b": "replace 'later researcher' with a professional Chinese description",
    r"第一轮收束": "remove internal process phrasing",
    r"第二轮收束": "remove internal process phrasing",
    r"打一发": "remove informal exploit phrasing",
    r"root 外观": "replace with precise privilege-state wording",
    r"cosmetic choice": "replace mixed-language informal phrasing",
    r"forged root": "replace with precise privilege-state wording",
    r"forged uid-0": "replace with precise privilege-state wording",
    r"cosmetic daemon choice": "replace mixed-language informal phrasing",
    r"再喷一次": "replace informal retry phrasing",
    r"painted KVA": "replace internal shorthand with explicit address-domain wording",
    r"CTF 答案": "remove competition-answer framing",
    r"CTF答案": "remove competition-answer framing",
    r"CTF_[A-Z0-9_]+\b": "remove competition-specific identifier",
    r"\binternal handoff\b": "remove internal handoff phrasing",
    r"公开仓": "replace publication-meta wording with neutral repository wording",
    r"公开层": "replace publication-meta wording with neutral scope wording",
    r"决议公开": "remove publication-decision process phrasing",
    r"入口层": "replace publication-meta wording with neutral entry wording",
    r"冻结仓": "replace internal archive phrasing with neutral evidence-gap wording",
    r"应被公开": "replace publication-meta wording with neutral recording wording",
    r"公开展示纪律": "replace publication-meta heading with neutral case-writing rules",
}
FORBIDDEN_LOCAL_MARKERS = (
    "C:\\Users\\",
    "/Users/",
    ".codex/",
    "vscode://",
    "file://",
)
MARKDOWN_LINK_RE = re.compile(r"\[[^\]]+\]\(([^)]+)\)")
ALLOWED_CVES = {"CVE-2026-43074", "CVE-2026-43499"}
ALLOWED_EVIDENCE = {
    "DEVICE_PASS",
    "OPERATOR_CONFIRMED",
    "REFERENCE_ONLY",
    "RUNTIME_BLOCKED",
    "STATIC_CLOSED",
    "STATIC_FAIL",
}
CATALOG_GROUPS = (
    "published_cases",
    "reference_cases",
    "unclosed_cases",
    "static_disproofs",
)
GROUP_EVIDENCE = {
    "published_cases": {"DEVICE_PASS", "OPERATOR_CONFIRMED"},
    "reference_cases": {"REFERENCE_ONLY"},
    "unclosed_cases": {"STATIC_CLOSED", "RUNTIME_BLOCKED"},
    "static_disproofs": {"STATIC_FAIL"},
}
REQUIRED_KMI_TRACKS = ("5.15", "6.1", "6.6", "6.12")
EXAMPLE_HEADINGS = (
    "## 精确身份",
    "## 分层结论",
    "## 成功链",
    "## 雷点",
    "## 保留源码",
)
ALLOWED_KMI_TRACKS = {
    "5.15",
    "5.15-arm32",
    "6.1",
    "6.6",
    "6.12",
}
BACKTICK_PATH_RE = re.compile(r"`((?:\.\.?/)?(?:docs|tools|skills|examples)/[^`\n]+\.(?:md|json|py|c|h|mk))`")
REQUIRED_CASE_FIELDS = {
    "case_id",
    "theme",
    "cve",
    "model",
    "soc",
    "system_version",
    "kernel_release",
    "kernel_sha256",
    "identity_anchor",
    "evidence_label",
    "route_family",
    "kmi_track",
    "example_dir",
    "summary",
    "caveat",
}
SHA256_RE = re.compile(r"^[0-9a-f]{64}$")


def iter_files(root: Path) -> list[Path]:
    files: list[Path] = []
    for path in root.rglob("*"):
        if any(part in IGNORED_DIRS for part in path.parts):
            continue
        if path.is_file():
            relative = path.relative_to(root).as_posix()
            if any(relative.startswith(prefix) for prefix in IGNORED_PREFIXES):
                continue
            files.append(path)
    return files


def is_text_file(path: Path) -> bool:
    return path.suffix.lower() in TEXT_SUFFIXES or path.name in {"LICENSE", "NOTICE"}


def load_json(path: Path) -> object:
    return json.loads(path.read_text(encoding="utf-8"))


def validate_core_files(root: Path, issues: list[str]) -> None:
    for relative in CORE_FILES:
        if not (root / relative).is_file():
            issues.append(f"missing core file: {relative}")


def validate_example_readme(
    example_dir: Path,
    case_id: str,
    issues: list[str],
    kernel_sha256: str | None = None,
    evidence_label: str | None = None,
) -> None:
    readme = example_dir / "README.md"
    if not readme.is_file():
        issues.append(f"{case_id}: example README.md is missing")
        return
    text = readme.read_text(encoding="utf-8")
    missing = [heading for heading in EXAMPLE_HEADINGS if heading not in text]
    if missing:
        issues.append(f"{case_id}: example README missing headings: {missing}")
    if kernel_sha256 and kernel_sha256 not in text:
        issues.append(f"{case_id}: example README must include kernel_sha256")
    if evidence_label and evidence_label not in text:
        issues.append(f"{case_id}: example README must include evidence_label {evidence_label}")


def validate_case_data(root: Path, issues: list[str]) -> None:
    case_index = load_json(root / "docs/public/cases/CASE_INDEX.json")
    build_matrix = load_json(root / "BUILD_MATRIX.json")
    usage_catalog = load_json(root / "USAGE_CATALOG.json")

    if not isinstance(case_index, list):
        issues.append("CASE_INDEX.json must be a list")
        return
    indexed_ids: set[str] = set()
    indexed_by_id: dict[str, dict] = {}
    example_tracks: set[str] = set()
    for entry in case_index:
        if not isinstance(entry, dict):
            issues.append("CASE_INDEX.json entries must be objects")
            continue
        missing = sorted(REQUIRED_CASE_FIELDS - set(entry))
        if missing:
            issues.append(f"case {entry.get('case_id', '<unknown>')} missing fields: {missing}")
        case_id = entry.get("case_id")
        if not isinstance(case_id, str) or not case_id:
            issues.append("case_id must be a non-empty string")
        elif case_id in indexed_ids:
            issues.append(f"duplicate case_id in CASE_INDEX.json: {case_id}")
        else:
            indexed_ids.add(case_id)
            indexed_by_id[case_id] = entry
        if entry.get("cve") not in ALLOWED_CVES:
            issues.append(f"{case_id}: unsupported cve {entry.get('cve')!r}")
        if entry.get("evidence_label") not in ALLOWED_EVIDENCE:
            issues.append(f"{case_id}: unsupported evidence label {entry.get('evidence_label')!r}")
        digest = entry.get("kernel_sha256")
        if not isinstance(digest, str) or not SHA256_RE.fullmatch(digest):
            issues.append(f"{case_id}: kernel_sha256 must be 64 lowercase hex characters")
        kmi_track = entry.get("kmi_track")
        if kmi_track not in ALLOWED_KMI_TRACKS:
            issues.append(f"{case_id}: unsupported kmi_track {kmi_track!r}")
        example_dir = entry.get("example_dir")
        if not isinstance(example_dir, str):
            issues.append(f"{case_id}: example_dir must be a string")
        elif example_dir:
            if not (root / example_dir).is_dir():
                issues.append(f"{case_id}: example_dir does not exist: {example_dir}")
            else:
                if kmi_track in REQUIRED_KMI_TRACKS:
                    example_tracks.add(kmi_track)
                validate_example_readme(
                    root / example_dir,
                    case_id,
                    issues,
                    digest if isinstance(digest, str) else None,
                    entry.get("evidence_label") if isinstance(entry.get("evidence_label"), str) else None,
                )

    missing_tracks = [track for track in REQUIRED_KMI_TRACKS if track not in example_tracks]
    if missing_tracks:
        issues.append(f"covered KMI tracks missing an example_dir: {missing_tracks}")

    if not isinstance(build_matrix, dict):
        issues.append("BUILD_MATRIX.json must be an object")
        return
    classified = set()
    membership: dict[str, set[str]] = {}
    for group in CATALOG_GROUPS:
        values = build_matrix.get(group)
        if not isinstance(values, list) or any(not isinstance(item, str) for item in values):
            issues.append(f"BUILD_MATRIX.json {group} must be a list of case IDs")
            continue
        for case_id in values:
            classified.add(case_id)
            membership.setdefault(case_id, set()).add(group)
            evidence = indexed_by_id.get(case_id, {}).get("evidence_label")
            if evidence and evidence not in GROUP_EVIDENCE[group]:
                issues.append(
                    f"{case_id}: evidence {evidence!r} is not allowed in {group}"
                )
    for case_id, groups in membership.items():
        if len(groups) > 1:
            issues.append(f"{case_id}: listed in multiple groups: {sorted(groups)}")

    if not isinstance(usage_catalog, dict):
        issues.append("USAGE_CATALOG.json must be an object")
        return
    usage_ids = set()
    usage_membership: dict[str, set[str]] = {}
    for group in CATALOG_GROUPS:
        values = usage_catalog.get(group)
        if not isinstance(values, list):
            issues.append(f"USAGE_CATALOG.json {group} must be a list")
            continue
        for entry in values:
            if not isinstance(entry, dict):
                issues.append(f"USAGE_CATALOG.json {group} entries must be objects")
                continue
            case_id = entry.get("case_id")
            if not isinstance(case_id, str) or not case_id:
                issues.append(f"USAGE_CATALOG.json {group} contains an invalid case_id")
                continue
            usage_ids.add(case_id)
            usage_membership.setdefault(case_id, set()).add(group)
            public_doc = entry.get("public_doc")
            if not isinstance(public_doc, str) or not public_doc.strip():
                issues.append(f"{case_id}: USAGE_CATALOG entry must include public_doc")
            elif not (root / public_doc).is_file():
                issues.append(f"{case_id}: USAGE_CATALOG public_doc does not exist: {public_doc}")
            usage_evidence = entry.get("evidence_label")
            indexed_evidence = indexed_by_id.get(case_id, {}).get("evidence_label")
            if usage_evidence and indexed_evidence and usage_evidence != indexed_evidence:
                issues.append(
                    f"{case_id}: USAGE_CATALOG evidence {usage_evidence!r} "
                    f"does not match CASE_INDEX {indexed_evidence!r}"
                )

    if indexed_ids != classified:
        issues.append(
            "CASE_INDEX.json and BUILD_MATRIX.json differ: "
            f"indexed_only={sorted(indexed_ids - classified)} "
            f"classified_only={sorted(classified - indexed_ids)}"
        )
    if indexed_ids != usage_ids:
        issues.append(
            "CASE_INDEX.json and USAGE_CATALOG.json differ: "
            f"indexed_only={sorted(indexed_ids - usage_ids)} "
            f"usage_only={sorted(usage_ids - indexed_ids)}"
        )

    if usage_membership != membership:
        issues.append(
            "USAGE_CATALOG.json groups differ from BUILD_MATRIX.json: "
            f"usage={ {key: sorted(value) for key, value in sorted(usage_membership.items())} } "
            f"build={ {key: sorted(value) for key, value in sorted(membership.items())} }"
        )

    matrix_path = root / "docs/public/cases/CASE_MATRIX.md"
    if matrix_path.is_file():
        matrix_lines = matrix_path.read_text(encoding="utf-8").splitlines()
        for case_id, entry in indexed_by_id.items():
            evidence = entry.get("evidence_label", "")
            if not any(case_id in line and evidence in line for line in matrix_lines):
                issues.append(
                    f"{case_id}: CASE_MATRIX.md must contain case_id and {evidence} on the same row"
                )


def validate_paths_and_text(root: Path, issues: list[str]) -> None:
    for path in iter_files(root):
        relative = path.relative_to(root).as_posix()
        if path.suffix.lower() in FORBIDDEN_SUFFIXES:
            issues.append(f"forbidden file type retained in repository: {relative}")
        elif not path.suffix and path.name not in {"LICENSE", "NOTICE"}:
            sample = path.read_bytes()[:4096]
            if b"\x00" in sample:
                issues.append(f"binary payload retained without extension: {relative}")
        if not is_text_file(path):
            continue
        if relative == "scripts/validate_repository.py" or relative.startswith("tests/"):
            continue
        try:
            text = path.read_text(encoding="utf-8")
        except UnicodeDecodeError:
            issues.append(f"text file is not valid UTF-8: {relative}")
            continue
        for marker in FORBIDDEN_LOCAL_MARKERS:
            if marker in text:
                issues.append(f"{relative}: contains local/private path marker {marker!r}")
        for pattern, message in FORBIDDEN_TEXT.items():
            if re.search(pattern, text):
                issues.append(f"{relative}: {message}")


def validate_markdown_links(root: Path, issues: list[str]) -> None:
    for path in iter_files(root):
        if path.suffix.lower() != ".md":
            continue
        text = path.read_text(encoding="utf-8")
        for raw_target in MARKDOWN_LINK_RE.findall(text):
            target = raw_target.strip().strip("<>")
            if not target or target.startswith(("http://", "https://", "mailto:", "#")):
                continue
            target = target.split("#", 1)[0]
            resolved = (path.parent / target).resolve()
            try:
                resolved.relative_to(root)
            except ValueError:
                issues.append(f"{path.relative_to(root).as_posix()}: link escapes repository: {raw_target}")
                continue
            if not resolved.exists():
                issues.append(f"{path.relative_to(root).as_posix()}: broken link: {raw_target}")
        for raw_target in BACKTICK_PATH_RE.findall(text):
            candidates = [(path.parent / raw_target).resolve()]
            if raw_target.startswith(("docs/", "tools/", "skills/", "examples/")):
                candidates.append((root / raw_target).resolve())
            resolved = next((candidate for candidate in candidates if candidate.exists()), None)
            if resolved is None:
                issues.append(f"{path.relative_to(root).as_posix()}: broken backtick path: {raw_target}")
                continue
            try:
                resolved.relative_to(root)
            except ValueError:
                issues.append(f"{path.relative_to(root).as_posix()}: backtick path escapes repository: {raw_target}")


def main(argv: list[str] | None = None) -> int:
    argv = sys.argv[1:] if argv is None else argv
    root = Path(argv[0] if argv else ".").resolve()
    issues: list[str] = []

    validate_core_files(root, issues)
    validate_case_data(root, issues)
    validate_paths_and_text(root, issues)
    validate_markdown_links(root, issues)

    if issues:
        for issue in issues:
            print(f"ERROR: {issue}")
        return 1

    print("PASS repository validation")
    print(f"root={root}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())