Back to Blog

Rustle:NEAR社区首个自动化审计工具

Code Auditing
November 1, 2022

我们很高兴发布 Rustle —— BlockSec 为 NEAR 社区提供的首个自动化审计工具。

Rustle 具有以下优点:

  • Rustle 目前可以检测 NEAR 合约中 20 多种类型的漏洞。请参阅“检测器”部分获取完整的检测器列表。
  • Rustle 易于使用。我们提供了详细的安装命令和教程。此外,我们还为用户准备了 Docker,以便快速上手。
  • Rustle 非常快速,大多数 NEAR 合约分析可以在 3 分钟内完成。
  • Rustle 用户友好,报告格式支持 CSV 和 JSON。我们还提供了一个脚本,帮助您将结果导入 Notion

检测器

Rustle 可以检测的所有漏洞。详细文档可在此处找到。

检测器 ID 描述 严重程度
unhandled-promise 检测未处理的 Promise
non-private-callback 回调函数缺少 #[private] 宏
reentrancy 查找易受重入攻击的函数
unsafe-math 算术运算缺少溢出检查
self-transfer 缺少发送方 != 接收方的检查
incorrect-json-type 参数或返回值中使用错误的类型
div-before-mul 由于操作顺序不正确导致的精度损失
round 未指定 ceil 或 floor 的四舍五入
lock-callback 回调函数中的 panic 可能导致合约被锁定
yocto-attach 特权函数中缺少 assert_one_yocto
prepaid-gas ft_transfer_call 中缺少预付费 gas 检查
non-callback-private 在非回调函数中使用 #[private] 宏
unused-ret 函数结果未被使用或检查
upgrade-func 合约中没有升级函数
tautology 条件分支中使用重言式
inconsistency 使用相似但略有不同的符号
timestamp 查找所有时间戳的使用 信息
complex-loop 查找所有具有复杂逻辑的循环,可能导致 DoS 信息
ext-call 查找所有跨合约调用 信息
promise-result 查找所有 promise 结果的使用 信息
transfer 查找所有转账操作 信息

如何使用

我们使用 Rustle 分析了一个流行的 NEAR 合约(例如 LiNEAR)。命令已在 Ubuntu 20.04 LTS 中进行测试。

  1. 按照 GitHub 页面上的安装手册进行操作。如果您想使用 Docker,请跳过此步骤,直接转到 Docker 手册

  2. 准备要让 Rustle 分析的 NEAR 合约。

     git clone https://github.com/linear-protocol/LiNEAR.git ~/near-repo/LiNEAR
    
  3. 通过运行 ./rustle 开始分析。

     ./rustle -t ~/near-repo/LiNEAR ~/near-repo/LiNEAR/contracts/linear
    
  1. audit-result/summary.csv 中检查报告
  1. 您可以指定要使用的检测器或严重性组。

./rustle -h 查看详细信息。

示例:

./rustle -t ~/near-repo/LiNEAR ~/near-repo/LiNEAR/contracts/linear -d high,medium,complex-loop

额外说明

Rustle 可用于开发过程,以迭代方式扫描 NEAR 智能合约。这可以节省大量手动工作并减轻部分潜在问题。但是,复杂逻辑或与语义相关的问题仍然是 Rustle 的局限性。定位复杂的语义问题需要 BlockSec 的专家进行全面细致的审查。请联系我们进行审计服务。

也欢迎提交 IssuePull Request

关于 BlockSec

BlockSec 是一家开创性的区块链安全公司,由一群享誉全球的安全专家于 2021 年创立。公司致力于提高新兴 Web3 世界的安全性和可用性,以促进其大规模采用。为此,BlockSec 提供智能合约和 EVM 链安全审计服务、用于安全开发和主动威胁拦截的 Phalcon 平台、用于资金追踪和调查的 MetaSleuth 平台,以及用于 Web3 构建者在加密世界中高效冲浪的 MetaSuites 扩展。

迄今为止,公司已为 MetaMask、Uniswap Foundation、Compound、Forta 和 PancakeSwap 等 300 多家知名客户提供服务,并在两轮融资中从 Matrix Partners、Vitalbridge Capital 和 Fenbushi Capital 等知名投资者处获得了数千万美元的投资。

官方网站:https://blocksec.com/

官方 Twitter 账号:https://twitter.com/BlockSecTeam

Sign up for the latest updates
The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis
Security Insights

The Decentralization Dilemma: Cascading Risk and Emergency Power in the KelpDAO Crisis

This BlockSec deep-dive analyzes the KelpDAO $290M rsETH cross-chain bridge exploit (April 18, 2026), attributed to the Lazarus Group, tracing a causal chain across three layers: how a single-point DVN dependency enabled the attack, how DeFi composability cascaded the damage through Aave V3 lending markets to freeze WETH liquidity exceeding $6.7B across Ethereum, Arbitrum, Base, Mantle, and Linea, and how the crisis forced decentralized governance to exercise centralized emergency powers. The article examines three parameters that shaped the cascade's severity (LTV, pool depth, and cross-chain deployment count) and provides an exclusive technical breakdown of Arbitrum Security Council's forced state transition, an atomic contract upgrade that moved 30,766 ETH without the holder's signature.

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 6 – Apr 12, 2026

This BlockSec weekly security report covers four DeFi attack incidents detected between April 6 and April 12, 2026, across Linea, BNB Chain, Arbitrum, Optimism, Avalanche, and Base, with total estimated losses of approximately $928.6K. Notable incidents include a $517K approval-related exploit where a user mistakenly approved a permissionless SquidMulticall contract enabling arbitrary external calls, a $193K business logic flaw in the HB token's reward-settlement logic that allowed direct AMM reserve manipulation, a $165.6K exploit in Denaria's perpetual DEX caused by a rounding asymmetry compounded with an unsafe cast, and a $53K access control issue in XBITVault caused by an initialization-dependent check that failed open. The report provides detailed vulnerability analysis and attack transaction breakdowns for each incident.

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit