nveloso/conkas

GitHub: nveloso/conkas

一款基于符号执行的以太坊智能合约模块化静态分析工具,支持从 Solidity 源码或 EVM 字节码中检测重入、算术溢出、时间戳操纵等安全漏洞。

Stars: 82 | Forks: 18

![Conkas build](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/a048b44b44122426.svg) ![Conkas issues](https://img.shields.io/github/issues/nveloso/conkas?style=plastic) ![Conkas release](https://img.shields.io/github/v/release/nveloso/conkas?style=plastic) ![Conkas all releases](https://img.shields.io/github/downloads/nveloso/conkas/total?style=plastic) ![Conkas license](https://img.shields.io/github/license/nveloso/conkas?style=plastic) ![Docker build](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/d49a95d861122427.svg) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/nveloso/conkas/latest?style=plastic) ![Docker Pulls](https://img.shields.io/docker/pulls/nveloso/conkas?style=plastic) # Conkas Conkas 是一个基于符号执行的 Ethereum Virtual Machine (EVM) 模块化静态分析工具。它能够分析用 Solidity 编写的 Ethereum Smart Contracts 或编译后的运行时字节码。作为一个模块化工具,意味着任何人都可以轻松添加自定义模块来分析特定的漏洞。它使用 Z3 作为 SMT Solver,并使用 [Rattle](https://github.com/crytic/rattle) 作为中间表示 (IR)。但是,为了满足 Conkas 的需求,需要使用修改版的 Rattle,该版本可以在[这里](https://github.com/nveloso/rattle)找到。Conkas 是我硕士论文的一部分。 ## 使用方法 您可以通过命令行界面 (CLI) 使用 Conkas。 如果您有一个用 Solidity 编写的 Smart Contract,并且只想搜索 Reentrancy 漏洞,您可以输入: ``` $ python3 conkas.py -vt reentrancy -s some_file.sol ``` 如果您只有编译后的运行时字节码十六进制字符串,并且想要搜索 Conkas 提供的所有类型的漏洞,您可以输入: ``` $ python3 conkas.py some_file.bin ``` ## 依赖项 * [cbor2](https://pypi.org/project/cbor2/) * [py-solc-x](https://pypi.org/project/py-solc-x/) * [pycryptodome](https://pypi.org/project/pycryptodome/) * [pyevmasm](https://pypi.org/project/pyevmasm/) * [python3](https://www.python.org/downloads/) * [solidity_parser](https://pypi.org/project/solidity-parser/) * [z3-solver](https://pypi.org/project/z3-solver/) 您可以使用 requirements.txt 文件通过以下方式安装所有依赖项: ``` $ pip install -r requirements.txt ``` 或者创建一个 python 环境: ``` $ python3 -m venv venv $ source venv/bin/activate $ pip install -r requirements.txt ``` ## 已检测的漏洞 Conkas 已经拥有 5 个模块来检测不同类别的漏洞。Conkas 在开发模块时遵循了 [DASP Top 10](https://dasp.co/)。这 5 个模块是: * [Arithmetic](https://dasp.co/#item-3) * [Reentrancy](https://dasp.co/#item-1) * [Time Manipulation](https://dasp.co/#item-8) * [Transaction Ordering Dependence](https://dasp.co/#item-7) * [Unchecked Low-Level Calls](https://dasp.co/#item-4) ## 单元测试 Conkas 有几个用于测试 EVM 指令执行的单元测试。这些测试可以在 __*tests/*__ 文件夹中找到。 # 结果 [SmartBugs](https://github.com/smartbugs/smartbugs) 被用来评估 Conkas。结果可以在下表中找到。如果工具能够给出漏洞所属的类别,以及 Smart Contract 源代码中的行号(间隔为 -5 到 +5),则该漏洞被视为真阳性。 ## 执行时间统计 | # | Tool | Avg. Execution Time | Total Execution Time | | --- | ---------- | ------------------- | -------------------- | | 1 | Conkas | 0:00:32 | 1:14:37 | | 2 | Honeybadger | 0:01:12 | 2:49:03 | | 3 | Maian | 0:03:47 | 8:52:25 | | 4 | Manticore | 0:12:53 | 1 day, 6:15:28 | | 5 | Mythril | 0:00:58 | 2:16:21 | | 6 | Osiris | 0:00:21 | 0:50:25 | | 7 | Oyente | 0:00:05 | 0:12:35 | | 8 | Securify | 0:02:06 | 4:56:13 | | 9 | Slither | 0:00:04 | 0:09:56 | | 10 | Smartcheck | 0:00:15 | 0:35:23 | Total: 2 days, 4:12:25 ## 准确率 | Category | Conkas | Honeybadger | Maian | Manticore | Mythril | Osiris | Oyente | Securify | Slither | Smartcheck | Total | | ------------------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | ----------- | | Access Control | 0/24 0% | 0/24 0% | 0/24 0% | 5/24 21% | 4/24 17% | 0/24 0% | 0/24 0% | 1/24 4% | 6/24 25% | 2/24 8% | 8/24 33% | | Arithmetic | 19/23 83% | 0/23 0% | 0/23 0% | 13/23 57% | 16/23 70% | 13/23 57% | 18/23 78% | 0/23 0% | 0/23 0% | 1/23 4% | 22/23 96% | | Denial Service | 0/14 0% | 0/14 0% | 0/14 0% | 0/14 0% | 0/14 0% | 0/14 0% | 0/14 0% | 0/14 0% | 0/14 0% | 1/14 7% | 1/14 7% | | Front Running | 2/7 29% | 0/7 0% | 0/7 0% | 0/7 0% | 2/7 29% | 0/7 0% | 2/7 29% | 2/7 29% | 0/7 0% | 0/7 0% | 2/ 7 29% | | Reentrancy | 30/34 88% | 19/34 56% | 0/34 0% | 15/34 44% | 25/34 74% | 21/34 62% | 28/34 82% | 14/34 41% | 33/34 97% | 30/34 88% | 33/34 97% | | Time Manipulation | 7/7 100% | 0/7 0% | 0/7 0% | 4/7 57% | 0/7 0% | 2/7 29% | 0/7 0% | 0/7 0% | 3/7 43% | 2/7 29% | 7/ 7 100% | | Unchecked Low Calls | 62/75 83% | 0/75 0% | 0/75 0% | 9/75 12% | 60/75 80% | 0/75 0% | 0/75 0% | 50/75 67% | 51/75 68% | 61/75 81% | 70/75 93% | | Other | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/5 0% | 0/ 5 0% | | Total | 120/224 54% | 19/224 8% | 0/224 0% | 46/224 21% | 107/224 48% | 36/224 16% | 48/224 21% | 67/224 30% | 93/224 42% | 97/224 43% | 143/224 64% | # 添加自定义模块 要添加自定义模块,您需要创建一个包含具有以下签名的函数的 python 文件: ``` def vuln_x_analyse(traces: [Trace], find_all: bool) -> [Vulnerability]: pass ``` 当变量 *find_all* 的值为 true 时,意味着函数应返回所有漏洞,否则函数应在仅发现一个漏洞时返回并停止。您应该将此文件放在 __*vuln_finder/*__ 文件夹中。然后,您需要修改该文件夹中的 \_\_init\_\_.py,并在 *available_modules* 对象中添加如下一行: ``` from vuln_finder.vuln_name import vuln_x_analyse available_modules = { ..., 'vuln_name': vuln_x_analyse } ``` '*vuln_name*' 应该是您检测的漏洞的名称,'*vuln_x_analyse*' 应该是执行分析的函数的名称。 # 许可证 Conkas 根据 AGPL-3.0 (AGPLv3) 许可证授权和分发
标签:DNS枚举, Docker, EVM, Python, SMT求解器, Solidity, Z3求解器, 中间代码, 云安全监控, 以太坊, 区块链安全, 安全防御评估, 对称加密, 无后门, 智能合约审计, 符号执行, 网络安全工具, 自动化审计, 请求拦截, 逆向工具, 重入攻击检测, 静态分析