Skip to content

feat: rebuild attack chains for 5 entries with multi-stage semantics#20

Open
perhaps468 wants to merge 1 commit into
Tencent:mainfrom
perhaps468:feat/trace-fix-5-entries
Open

feat: rebuild attack chains for 5 entries with multi-stage semantics#20
perhaps468 wants to merge 1 commit into
Tencent:mainfrom
perhaps468:feat/trace-fix-5-entries

Conversation

@perhaps468

Copy link
Copy Markdown

概述

Closes #7
本 PR 针对 5 个 VulnGym 样本进行人工辅助的链路重建。这些样本并非单点行号偏移,而是整条数据流或调用链的语义错位——节点能找到代码,但位置不在利用链上;或漏洞需要多阶段触发,单一入口点难以表达完整利用过程。

修复目标:

  • entry-00185 n8n ReadWriteFile 写入 .git/ 目录导致 RCE
  • entry-00197 openclaw sandbox TOCTOU race condition(多阶段)
  • entry-00290 openclaw 悬空符号链接沙箱逃逸
  • entry-00320 langflow 文件上传路径穿越
  • entry-00391 fastmcp OpenAPIProvider SSRF + 路径穿越

每个 entry 的 entry_point / critical_operation / trace 均经 GitHub raw 远程字节级匹配 + 本地 SCHEMA 校验双重复核(33 个 {file,line,code} 节点 H1/H2/H3/H4 全 0),并补全 desc 字段。

多阶段样本处理:

  • entry-00197(TOCTOU):单 entry_point + 5 节点 trace 显式表达"请求进入 → 语法校验 → realpath 检查 → 竞态窗口 → 实际读取"的 check/use 两阶段。
  • entry-00290(悬空符号链接):critical_operation 保留在检查点 resolveSymlinkHopPath(root cause 是 fail-open 决策),最终 sink 写入操作放在 trace 末端;desc 显式说明 check-vs-sink 区别。

变更内容

  • 新增 data/entries.fixed.jsonl
    • 修复后的 JSONL 快照,408 行;5 条 target 的 entry_point / critical_operation / trace 已重建(替代 data/entries.jsonl 入库,二者内容等价)。
  • 新增 rebuild_report.md
    • 5 条 target 的逐条修复报告:修复前问题 / 修复后链路 / 多阶段说明 / 关键判断依据 / 验收对照与精简交付清单。
  • 新增 fix_diff.csv
    • 字段级 before/after 修改记录,5 entry × 3 fields。
  • 新增 scripts/apply_entry_patches.py
    • 幂等生成器,含 PATCHES 字典,可重跑出 fixed.jsonl / fix_diff.csv / report.json,内嵌 SCHEMA 校验。
  • 新增 scripts/runtime_audit.py
    • GitHub raw 远程字节级审计脚本,TARGETED = 5 条 target + 4 条 config-vuln 历史 target,输出 NDJSON 到 debug-b5f720.log
  • 新增 scripts/verify_patched_entries.py
    • 本地 SCHEMA 校验脚本,对每条 target 的 entry_point / critical_operation / 全部 trace 节点校验 desc 非空 + line 合法 + code 形参。

验收对照

跑了 3 个脚本,全部 =0 通过:

  1. python scripts/runtime_audit.py --use-remote
    5 条 target 的 entry_point / critical_operation / 全部 trace 共 33 个 {file,line,code} 节点,到 GitHub raw 对应 commit 拉源码行级精确匹配,H1/H2/H3/H4 全 0;NDJSON 落在 debug-b5f720.log(gitignored)。

  2. python scripts/verify_patched_entries.py
    对 5 条 target 校验 entry_point / critical_operation / 全部 trace 节点的 desc 非空、line 合法、code 形态正确;H3=0 全条目 schema clean。

  3. wc -l data/entries.fixed.jsonl
    修复后 408 行,与 data/entries.jsonl 一致;本轮只对 5 条 target 做语义重建,未截断其它 entry。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

【2026犀牛鸟】重建整体错位和多阶段利用样本的调用链

1 participant