关于Caracal
功能介绍
1、提供了检测工具,支持检测存在安全漏洞的Cairo代码; 2、提供了输出打印工具,支持输出和报告检测到的信息; 3、支持进行污染分析; 4、数据流分析框架; 5、支持在Scarb项目中轻松使用和运行;
工具安装
预编译源码
源码构建
cargo
install --git https://github.com/crytic/caracal --profile release --force
(向右滑动,查看更多) 除此之外,我们还可以使用下列命令将该项目源码克隆至本地:
git
clone
https:
//github.com/crytic/caracal
(向右滑动,查看更多) 然后切换到项目目录中,执行下列命令完成项目代码构建:
cd caracal
cargo
install --path . --profile release --force
(向右滑动,查看更多)
工具使用
查看检测工具:
caracal
detectors
查看输出打印工具:
caracal
printers
独立文件使用
如需使用独立的Cario文件,你需要有一个本地Cairo编译器代码。下列命令可以运行检测工具:
caracal detect path/file/to/
analyze
caracal detect
path
/
file
/
to
/
analyze
--corelib path/to/corelib/src
(向右滑动,查看更多)
运行打印输出工具:
caracal print path/file/to/
analyze
--printer printer_to_use --corelib path/to/corelib/src
(向右滑动,查看更多) Cairo项目
如果的Cairo项目中有多个文件跟合约,你可能需要使用--contract-path来指定目标合约。下列命令可以运行检测工具:
caracal detect path/to/dir
caracal detect path/to/dir --contract-path token::myerc20::... token::myerc721::...
(向右滑动,查看更多)
运行打印输出工具:
caracal
path/to/dir --printer printer_to_use
(向右滑动,查看更多)
Scarb
如果你的项目使用了Scarb,你则需要将下列内容添加到Scarb.toml中:
[[target.starknet-contract]]
sierra
=
true
[cairo]
sierra-replace-ids
=
true
然后将Scarb.toml文件所在目录的路径在运行检测工具时使用参数传递给Caracal:
caracal
detect path/to/dir
运行打印输出工具:
caracal
path/to/dir --printer printer_to_use
(向右滑动,查看更多)
检测工具
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
输出打印工具
cfg:将每一个函数的CFG导出至一个.dot文件中; callgraph:将函数调用图导出至一个.dot文件中;
许可证协议
项目地址
原文始发于微信公众号(FreeBuf):Caracal:一款功能强大的Starknet智能合约静态分析工具
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论