Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
code-shield — 基于证据的C/C++漏洞修复管道 + http-parser案例研究(CVE-2024-22019类)。Python核心,React 19控制台,17项测试验证套件。 | Kitploit
工具/GitHubGitHub/kos2001/code-shield
防御工具静态分析漏洞分析代码分析模糊测试二进制分析
GitHubkos2001/code-shield

code-shield

基于证据的C/C++漏洞修复管道 + http-parser案例研究(CVE-2024-22019类)。Python核心,React 19控制台,17项测试验证套件。

查看仓库
11个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

protocol-remediator

C/C++ 协议·平台代码的漏洞发现规范化为可重现的证明,并在隔离副本中验证候选补丁的 MVP。code-shield 是已被确认存在名称冲突风险的工作名称,因此在公开包和 CLI 中使用了中立的内部名称。

当前实现的核心不是补丁生成模型,而是以下验证闭环。

root@kitploit:~
sanitizer 또는 SARIF
  -> Finding + EvidenceBundle
  -> source context
  -> manual/external-agent patch
  -> 원본 재현
  -> build
  -> patched reproducer
  -> tests
  -> static rescan
  -> bounded refuzz
  -> protocol oracle
  -> verified report

已实现的功能

  • 版本化的 Finding、EvidenceBundle、PatchProposal、VerificationReport JSON 模型
  • detected → reproducible → contextualized → proposed → plausible → verified 状态转移
  • AddressSanitizer、MemorySanitizer、UndefinedBehaviorSanitizer 报告收集
  • SARIF 2.1 发现收集
  • 标准化发现的 SARIF 2.1 导出
  • 围绕源代码位置生成可审计的上下文 JSON
  • 基于 TOML 的目标/构建/网关配置
  • 应用了 network-off、capability-drop、resource-limit 的 Docker 执行器
  • 需要显式 opt-in 的本地执行器
  • 在原始目标副本中重现发现后,在单独副本中验证补丁
  • 补丁校验和、重现器校验和、路径逃逸、符号链接、文件和行限制检查
  • 拒绝针对测试/fuzz harness/重现器等保护路径的补丁
  • 外部补丁代理命令适配器
  • 保留每个命令的退出码、stdout/stderr、时间和网关结果

要求

  • Python 3.11 或更高版本
  • 用于补丁验证的 Git
  • 默认隔离执行需要 Docker
  • 运行示例需要 Clang

无运行时 Python 依赖。

安装与测试

root@kitploit:~
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -m unittest discover -s tests -v

如果要直接运行而不安装:

root@kitploit:~
PYTHONPATH=src python3 -m protocol_remediator --help
PYTHONPATH=src python3 -m unittest discover -s tests -v

动态端到端套件是 examples 中的 C/C++ fixture 矩阵。使用 Clang ASan/UBSan 实际重现 CWE-121、CWE-190、CWE-416、CWE-787、CWE-476,然后针对每个修复不变量的补丁运行所有六个网关。每个 fixture 的输入和验证范围已在 examples/README.md 中整理。

如果要在没有单元测试框架的情况下仅运行实际矩阵:

root@kitploit:~
PYTHONPATH=src python3 examples/run_fixture_matrix.py

如果要自动生成并运行更多 C/C++ 变体示例:

root@kitploit:~
PYTHONPATH=src python3 examples/run_generated_corpus.py --count 50

该 runner 不使用 unittest,而是将生成的每个项目传递给相同的 VerificationPipeline。结果摘要默认保存在 artifacts/generated-corpus-summary.json。

前端控制台

使用 Vite + React + TypeScript 构建的前端 frontend,可以以操作仪表盘的形式查看当前实现状态。该控制台将 fixture 矩阵、生成语料库、Hermes API 服务器连接面、验证网关和证据安全性不变量整合在一个屏幕上。

root@kitploit:~
cd frontend
npm install
npm run dev

默认开发服务器是 http://127.0.0.1:5173。使用以下命令检查生产构建:

root@kitploit:~
cd frontend
npm run build

CLI

收集 sanitizer 发现

root@kitploit:~
protocol-remediator ingest-sanitizer \
  --log asan.log \
  --reproducer crash.input \
  --target-name parser \
  --revision 0123456789abcdef \
  --variant asan-x86_64 \
  --output intake/parser-crash

输出:

root@kitploit:~
intake/parser-crash/finding.json
intake/parser-crash/evidence.json

收集 SARIF

root@kitploit:~
protocol-remediator ingest-sarif \
  --sarif results.sarif \
  --output intake/sarif

导出 SARIF

root@kitploit:~
protocol-remediator export-sarif \
  --finding intake/parser-crash/finding.json \
  --finding intake/another/finding.json \
  --output artifacts/findings.sarif

生成模型中立的上下文

root@kitploit:~
protocol-remediator context \
  --finding intake/parser-crash/finding.json \
  --evidence intake/parser-crash/evidence.json \
  --target-root /path/to/target \
  --output intake/parser-crash/context.json

验证现有补丁

root@kitploit:~
protocol-remediator verify \
  --config /path/to/target/target.toml \
  --finding intake/parser-crash/finding.json \
  --evidence intake/parser-crash/evidence.json \
  --patch candidate.patch \
  --artifacts artifacts

退出码:若已验证则为 0,验证失败则为 1,配置或输入错误则为 2。

Hermes agent API 服务器

启动 Hermes API 服务器后,remediate 可以通过 HTTP API 请求补丁,而不是使用本地命令。默认端点是 POST /v1/patches,接收发现/证据/上下文和目标工作区归档,并返回 unified diff。

示例服务器执行:

root@kitploit:~
PYTHONPATH=src python3 -m protocol_remediator.hermes_server \
  --host 127.0.0.1 \
  --port 8765

安装后也可以使用 console script:

root@kitploit:~
hermes-agent-server --host 127.0.0.1 --port 8765

附加生产 backend 命令时,按参数重复 --backend-command。支持 {context}、{workspace}、{patch_output} 占位符。

root@kitploit:~
hermes-agent-server \
  --backend-command my-patch-agent \
  --backend-command --context \
  --backend-command {context} \
  --backend-command --workspace \
  --backend-command {workspace} \
  --backend-command --output \
  --backend-command {patch_output}

在 target.toml 中按如下方式指定 Hermes 模式:

root@kitploit:~
[agent]
mode = "hermes"
url = "http://127.0.0.1:8765"
timeout_seconds = 30

然后直接使用现有的 remediate 命令:

root@kitploit:~
protocol-remediator remediate \
  --config examples/length-prefixed-parser/target.hermes.toml \
  --finding artifacts/hermes-cli-input/finding.json \
  --evidence artifacts/hermes-cli-input/evidence.json \
  --artifacts artifacts/hermes-cli

开发用的端到端验证通过以下 runner 执行。该 runner 会启动临时 Hermes 服务器,通过 API 客户端接收补丁,然后完整运行验证闭环:

root@kitploit:~
PYTHONPATH=src python3 examples/run_hermes_demo.py

创建与验证外部命令代理

如果不使用 Hermes 而直接调用本地命令,则在 target.toml 中将 agent 命令指定为字符串数组:

root@kitploit:~
[agent]
mode = "command"
command = [
  "my-patch-agent",
  "--context",
  "{context}",
  "--workspace",
  "{workspace}",
  "--output",
  "{patch_output}",
]
timeout_seconds = 900

然后执行以下命令:

root@kitploit:~
protocol-remediator remediate \
  --config /path/to/target/target.toml \
  --finding intake/parser-crash/finding.json \
  --evidence intake/parser-crash/evidence.json \
  --artifacts artifacts

核心不直接调用特定 LLM API。约定是 Hermes 后端或外部命令读取上下文并生成 unified diff。agent 的工作在临时副本中执行,而非原始目标。

目标配置

完整示例请参考 target.toml:

root@kitploit:~
[project]
name = "my-protocol"
language = "c++"
root = "."

[executor]
mode = "docker"
image = "my-frozen-toolchain@sha256:..."
timeout_seconds = 300
network = false

[reproduction]
failure_regex = "AddressSanitizer|heap-buffer-overflow"

[verification]
required_gates = [
  "build",
  "reproducer",
  "tests",
  "rescan",
  "refuzz",
  "protocol",
]

[gates]
build = [["cmake", "-S", ".", "-B", "build"], ["cmake", "--build", "build"]]
reproducer = [["./build/fuzz_target", "{reproducer}"]]
tests = [["ctest", "--test-dir", "build", "--output-on-failure"]]
rescan = [["./tools/run-sast", "--fail-on-new"]]
refuzz = [["./tools/refuzz", "--seconds", "60"]]
protocol = [["./tools/protocol-oracle"]]

每个命令是参数数组,而非 shell 字符串。支持的占位符:

  • {workspace}:执行器中可见的临时目标路径
  • {reproducer}:校验和验证后复制到临时目标的重现器路径

build 和 reproducer 始终必需。默认策略下,六个网关都是必选的。如果由于目标特性某些网关不可用,则必须在 required_gates 中显式调整,且结果仍会保留在报告中。

产物

每次验证运行保留以下内容:

root@kitploit:~
artifacts/run_<id>/
  candidate.patch
  context.json
  evidence.input.json
  finding.input.json
  finding.final.json
  patch-proposal.json
  patch-stats.json
  verification-report.json

verification-report.json 包含基线和补丁命令的输出。由于 PoC 或日志可能包含机密信息,因此应对产物仓库应用单独的访问和保留策略。

安全边界

  • 默认建议是使用固定 Docker 镜像和 network=false。
  • 本地执行器必须显式声明 allow_local=true,且不应用于不可信目标。
  • 出站 LLM 命令的数据策略由操作员决定,核心不会自动上传。
  • plausible 是仅通过构建和原始重现器的状态。
  • verified 也不是程序等价性的证明,不能替代人工审批。
  • 未实现自动合并。

下一步实现优先级

  1. 实际的 ProFuzzBench/AFLNet 目标适配器
  2. 协议消息序列与状态跟踪收集器
  3. CodeQL 可选适配器及 C/C++ 源/汇模型发射器
  4. ASan/UBSan/MSan 与架构矩阵执行
  5. 基于正常语料库的差分协议 oracle
  6. AutoPatchBench runner 与定量基准报告

调查依据与设计决策已在 docs/research 中整理。

下载工具