tokamak-network/Argus
GitHub: tokamak-network/Argus
针对以太坊交易的实时攻击检测、事后取证与时间旅行调试一体化工具包。
Stars: 0 | Forks: 0
# Argus
[](https://github.com/tokamak-network/Argus/actions/workflows/ci.yml)
[](LICENSE-MIT)
**Ethereum 的百眼守护者**
针对 EVM 交易的实时攻击检测、事后取证以及时间旅行调试。
## Argus 的功能
### Sentinel — 实时攻击检测
集成在区块处理层面的 2 阶段检测流水线:
- **预过滤器**: 基于回执的启发式算法(约 10-50μs/tx)过滤掉 99% 的良性交易
- **深度分析器**: 仅对可疑交易进行完整的操作码级重放
- **Mempool 监控**: 在攻击被包含进区块*之前*进行检测
- **自动暂停熔断器**: 在收到严重警报时自动停止处理
- **多渠道警报**: JSONL、Webhook (Slack/Discord/PagerDuty)、WebSocket、Prometheus
### Autopsy Lab — 事后取证
重放任何主网交易并生成取证报告:
- **攻击模式分类**: 重入攻击、闪电贷、价格预言机操纵、访问控制绕过
- **资金流向追踪**: 追踪攻击过程中的 ETH 和 ERC-20 代币流动
- **Markdown 报告生成**: 包含攻击阶段、证据和建议修复措施的结构化时间线
### 时间旅行调试器
GDB 风格的操作码粒度交互式重放:
- 执行的单步前进/后退
- 在操作码、地址或存储槽上设置断点
- 执行过程中任意时刻的完整状态检查
- 50ms 内的步骤导航
## 快速开始
### 运行 Sentinel 演示
```
git clone https://github.com/tokamak-network/Argus.git
cd Argus
cargo run --example sentinel_realtime_demo
```
这会模拟一个包含良性和恶意交易的区块,展示 Sentinel 的检测流水线是如何工作的:
```
Demo 1 Multi-TX Block Scanning
TX 0: Simple ETH transfer (21k gas, success)
TX 1: Flash loan via Aave (2.5M gas, 6 ERC-20 transfers)
TX 2: 5 ETH transfer, reverted (950k gas)
Alert #2:
Priority: High
Score: 0.75
Summary: Pre-filter alert: high-value-revert, unusual-gas, self-destruct
Reason: HighValueWithRevert { value_wei: 5000000000000000000 }
Demo 3 Mempool Pre-Filter (Pending TX Scanning)
Mempool TXs scanned: 4
Mempool TXs flagged: 3
Demo 4 Auto-Pause Circuit Breaker
Critical alert → block processing HALTED
```
### 运行 Autopsy 演示
```
cargo run --example reentrancy_demo
```
部署一个易受攻击的合约,执行重入攻击,并生成完整的取证报告:
```
Phase 1 Deploy & Execute
Execution: SUCCESS (gas_used=82107)
Opcode steps recorded: 80
Phase 2 Verify Attack
Max call depth: 4 (need >= 3 for reentrancy)
CALL opcodes: 4
SSTORE opcodes: 4 (attacker counter writes)
Result: CONFIRMED — reentrancy pattern detected
Phase 3 AttackClassifier
Reentrancy (target=0x...0043)
confidence: 90.0%
evidence: Re-entrant call at step 47
evidence: State modified at step 69
evidence: Value transfer during re-entry
Phase 5 SentinelService Pipeline
Alert Priority: Critical
Score: 0.85
Summary: Likely reentrancy attack (confidence: 90%)
```
## 案例研究 — 回溯分析
**[回溯分析:1.28 亿美元 Balancer V2 漏洞利用](docs/analysis-balancer-v2-exploit.md)**
2025 年 11 月 3 日,攻击者利用 Balancer V2 `batchSwap` 中的舍入误差,在 30 分钟内从 6 条链上抽走了 1.28 亿美元。我们通过 Argus 的检测流水线分析了这笔交易:
1. **预过滤器**: 标记交易模式(300 万 gas + 4.2KB calldata + Balancer Vault 交互)
2. **深度分析器**: 操作码重放后分类为价格操纵(82% 置信度)
3. **Autopsy**: 生成包含资金流向追踪的取证报告
阅读完整分析:[docs/analysis-balancer-v2-exploit.md](docs/analysis-balancer-v2-exploit.md)
**[回溯分析:15 亿美元 Bybit 漏洞利用](docs/analysis-bybit-1.4b-exploit.md)**
2025 年 2 月 21 日,朝鲜的 Lazarus Group 实施了历史上最大的加密货币盗窃案——通过针对 Safe{Wallet} 前端的供应链攻击,从 Bybit 冷钱包中窃取了 15 亿美元。
1. **预过滤器**: 因向未经验证的合约进行异常 DELEGATECALL 而标记该交易
2. **深度分析器**: 分类为访问控制绕过(95% 置信度)——代理实现被覆盖
3. **Autopsy**: 追踪跨越 40 多个中间钱包的资金流向
阅读完整分析:[docs/analysis-bybit-1.4b-exploit.md](docs/analysis-bybit-1.4b-exploit.md)
## 对比分析
| | Argus | Forta | Phalcon | Tenderly | Hexagate |
|---|---|---|---|---|---|
| 运行时检测 | 是 | 是 (bot network) | 是 | 部分 | 是 |
| Mempool 预检测 | 是 | 否 | 是 | 是 | 是 |
| 事后取证 | **是** | 否 | 否 | 部分 | 否 |
| 开源 | **完全** | 部分 | 否 | 否 | 否 |
| 自托管 | **是** | 否 | 否 | 否 | 否 |
| 多链 | 否 | 是 (7+) | 是 | 是 (109) | 是 |
| 生产环境记录 | **暂无** | 扫描 2.7 亿+ TX | 阻止 20+ 次攻击 | 140 万+ 次模拟 | 未披露 |
## 架构
```
┌─────────────────────────────────────┐
│ Ethereum Network │
└──────────────┬──────────────────────┘
│
┌──────────────▼──────────────────────┐
│ Mempool Monitor │
│ (pre-execution calldata scan) │
└──────────────┬──────────────────────┘
│
┌────────────────────▼────────────────────────┐
│ Sentinel Pipeline │
│ │
│ ┌──────────┐ ┌────────────────────────┐ │
│ │Pre-filter │───▶│ Deep Analyzer │ │
│ │ ~10-50μs │ │ (opcode-level replay) │ │
│ │ per tx │ │ │ │
│ └──────────┘ └───────────┬────────────┘ │
└──────────────────────────────┼──────────────┘
│
┌────────────────────────▼─────────┐
│ Alert Dispatcher │
│ JSONL / Webhook / WS / Prometheus │
└────────────────────────┬─────────┘
│
┌────────────────────────▼─────────┐
│ Auto-Pause Circuit Breaker │
│ (halt on Critical severity) │
└──────────────────────────────────┘
```
## 功能特性
| 功能 | 描述 | 功能开关 |
|---------|-------------|-------------|
| Sentinel | 实时攻击检测流水线 | `sentinel` (默认) |
| Autopsy Lab | 事后取证分析 | `autopsy` (默认) |
| 时间旅行调试器 | 交互式操作码重放 | 始终包含 |
| CLI | 交互式调试器 Shell | `cli` |
| Dashboard | Sentinel 指标的 Web UI | `sentinel` |
## 构建
```
# 默认 (Sentinel + Autopsy)
cargo build
# 使用 CLI debugger
cargo build --features cli
# 所有功能
cargo build --all-features
```
**要求**: Rust 1.85+ (edition 2024)
### Docker
```
# 本地构建
docker build -t argus-demo .
# 运行 Sentinel demo
docker run argus-demo
# 运行 Autopsy demo
docker run argus-demo reentrancy_demo
# 运行 Dashboard demo
docker run argus-demo sentinel_dashboard_demo
```
## 技术支持
Argus 使用 [ethrex](https://github.com/lambdaclass/ethrex) LEVM 作为其 EVM 执行引擎——这是一个用 Rust 编写的极简、快速的 Ethereum Virtual Machine 实现。Argus 依赖于包含 `tokamak-debugger` 功能的 [Tokamak Network 分支](https://github.com/tokamak-network/ethrex)。
## 许可证
双重许可:[MIT](LICENSE-MIT) 或 [Apache 2.0](LICENSE-APACHE)。
由 [Tokamak Network](https://tokamak.network/) 构建。
标签:AI工具, Discord告警, DNS 反向解析, EVM, opcode分析, PFX证书, Rust, Slack告警, TLS, Web3安全, 交易回放, 以太坊, 价格预言机操纵, 入侵检测系统, 内存池监控, 加密货币, 区块链安全, 可视化界面, 子域名变形, 安全数据湖, 密码管理, 攻击检测, 文档安全, 断路器, 智能合约审计, 网络流量审计, 请求拦截, 资金流向追踪, 通知系统, 通知系统, 通知系统, 重入攻击, 闪电贷攻击, 防御工具