cognis-digital/forkfuzz

GitHub: cognis-digital/forkfuzz

一款智能合约主网分叉不变量模糊测试工具,在合约部署前通过重放真实链上状态来检测协议不变量是否可能被破坏。

Stars: 0 | Forks: 0

FORKFUZZ # FORKFUZZ ### 主网分叉不变量模糊测试器,针对实时状态和有状态序列重放你的合约,在部署前破坏协议不变量。 [![PyPI](https://img.shields.io/pypi/v/cognis-forkfuzz.svg?color=6b46c1)](https://pypi.org/project/cognis-forkfuzz/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/0c94f8210d163522.svg)](https://github.com/cognis-digital/forkfuzz/actions) [![License: COCL 1.0](https://img.shields.io/badge/License-COCL%201.0-2b6cb0.svg)](LICENSE) [![Suite](https://img.shields.io/badge/Cognis-Neural%20Suite-6b46c1.svg)](https://github.com/cognis-digital) *Web3 与智能合约安全 — 链上安全与分析。*
``` pip install cognis-forkfuzz forkfuzz scan . # → prioritized findings in seconds ``` ## 使用说明 — 分步指南 1. **安装** CLI: pipx install "git+https://github.com/cognis-digital/forkfuzz.git" 2. **检查** JSON 合约规格是否存在不变量违规(主要命令): forkfuzz check spec.json 3. **扩展搜索** — 更多的随机序列、更长的调用序列,以及用于可复现性的固定种子: forkfuzz check spec.json --runs 5000 --max-calls 50 --seed 42 4. **阅读输出** — 违规表格,或用于分类和比对的 JSON: forkfuzz check spec.json --format json > violations.json 5. **在 CI 中自动化** — 当任何不变量被破坏时使任务失败(非零退出),使用固定种子以确保运行是确定性的: forkfuzz check spec.json --runs 2000 --seed 1 --format json ## 目录 - [为什么选择 forkfuzz?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关项目](#related) · [贡献](#contributing) ## 为什么选择 forkfuzz? 一条命令实现“针对真实主网流动性对我的合约进行模糊测试”,将 Echidna 的学习曲线降至零;对 CI 友好的语料库缓存是其一大亮点。 `forkfuzz` 是单一用途、可脚本化且可自托管的:将其指向一个目标,以你的工作流已经使用的格式(表格 · JSON · SARIF)获取优先级排序的结果,在 CI 中对其进行门控,并让代理通过 MCP 驱动它。
↑ 回到顶部
## 功能 - ✅ 安全评估 - ✅ 解析规格 - ✅ 加载规格 - ✅ 运行序列 - ✅ 模糊测试 - ✅ 可在 Linux/macOS/Windows · Docker · devcontainer 上运行 - ✅ 提供 Python, JavaScript, Go 和 Rust 移植版 (`ports/`)
↑ 回到顶部
## 快速开始 ``` pip install cognis-forkfuzz forkfuzz --version forkfuzz scan . # scan current project forkfuzz scan . --format json # machine-readable forkfuzz scan . --fail-on high # CI gate (non-zero exit) ```
↑ 回到顶部
## 示例 ``` $ forkfuzz scan . [HIGH ] FOR-001 example finding (./src/app.py) [MEDIUM ] FOR-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 回到顶部
## 架构 ``` flowchart LR IN[input] --> P[forkfuzz
analyze + score] P --> OUT[report] ```
↑ 回到顶部
## 从任何 AI 技术栈中使用 `forkfuzz` 可与每一种流行的 AI 使用方式互操作: - **MCP 服务器** — `forkfuzz mcp` (Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `forkfuzz scan . --format json` 通过管道传递给任何代理或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 一行代码将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI 流水线提供退出码 + SARIF
↑ 回到顶部
## 对比 | | **Cognis forkfuzz** | Foundry (forge) 不变量测试 | |---|:---:|:---:| | 可自托管,无需账号 | ✅ | 视情况而定 | | 单一命令,零配置 | ✅ | ⚠️ | | 用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生 (AI 代理) | ✅ | ❌ | | 多语言移植 (JS/Go/Rust) | ✅ | ❌ | | 开源许可证 | ✅ COCL | 视情况而定 | *秉承 **Foundry (forge) 不变量测试 / Echidna** 的精神,以 Cognis 的方式重新构建。遗漏了致谢?提交一个 PR。*
↑ 回到顶部
## 集成 接入你的技术栈:用于代码扫描的 **SARIF**、用于任何场景的 **JSON**、用于 AI 代理的 **MCP 服务器** (`forkfuzz mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。详见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 回到顶部
## 安装 — 各种方式,所有平台 ``` pip install "git+https://github.com/cognis-digital/forkfuzz.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/forkfuzz.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/forkfuzz.git" # uv pip install cognis-forkfuzz # PyPI (when published) docker run --rm ghcr.io/cognis-digital/forkfuzz:latest --help # Docker brew install cognis-digital/tap/forkfuzz # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/forkfuzz/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | 云平台 | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/forkfuzz` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 回到顶部
## 相关 Cognis 工具 - [`reentryx`](https://github.com/cognis-digital/reentryx) — 静态 + 符号执行检测器,用于标记 Solidity/Vyper 中的重入、跨函数和只读重入路径,并输出用于 CI 门控的 SARIF。 - [`approvewarden`](https://github.com/cognis-digital/approvewarden) — 扫描任何钱包中危险的 ERC-20/721/1155 代币授权和无限额度,评估资金抽离风险并生成撤销交易。 - [`mevscope`](https://github.com/cognis-digital/mevscope) — 重放交易或地址历史,以归因三明治攻击、抢跑和尾跑 MEV 提取,并提供逐笔交易的损失核算。 - [`rugradar`](https://github.com/cognis-digital/rugradar) — 代币合约风险扫描器,在你盲目投资前检测蜜罐、隐藏的铸币/黑名单功能、所有者后门以及未锁定的流动性。 - [`storagelens`](https://github.com/cognis-digital/storagelens) — 对比和解码跨代理升级的合约存储布局,以捕获存储冲突和未初始化的存储槽漏洞。 - [`sigsleuth`](https://github.com/cognis-digital/sigsleuth) — 将原始 calldata 和 EIP-712 类型数据解码为人类可读的意图,标记盲签和恶意的 permit/Permit2 payload。 **探索套件 →** [🗂️ 所有 170+ 工具](https://github.com/cognis-digital/cognis-neural-suite) · [⭐ awesome-cognis](https://github.com/cognis-digital/awesome-cognis) · [🔗 cognis-sources](https://github.com/cognis-digital/cognis-sources) · [🤖 uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet) · [🧠 engram](https://github.com/cognis-digital/engram)
↑ 回到顶部
## 互操作性 `{}` 与 300+ 工具的 Cognis 套件组合 — JSON 输入/输出和共享的 兼容 OpenAI 的 `/v1` 主干。详见 **[INTEROP.md](INTEROP.md)** 了解 套件图谱、组合模式和参考技术栈。 ## 许可证 在 **Cognis 开放协作许可证 (COCL) v1.0** 下开源可见 — 个人、内部评估、研究和教育用途免费;**商业/生产用途需要许可证** (licensing@cognis.digital)。详见 [LICENSE](LICENSE)。
Cognis Digital · Cognis Neural Suite 中 170+ 工具之一 · 让明天在今天更美好
标签:Web3, 区块链, 可视化界面, 安全测试, 攻击性安全, 数据可视化, 日志审计, 智能合约, 请求拦截, 逆向工具