
EVMLISA是一种基于对以太坊区块链且建立在Lisa建立的智能合约的EVM字节的抽象解释的静态分析仪。鉴于EVM字节码智能合约,EVMLISA构建了智能合约的声音和精确的控制流图。
EVMLISA基于同行评审的出版物
Vincenzo Arceri,Saverio Mattia Merenda,Greta Dolcetti,Luca Negrini,Luca Olivieri,Enea Zaffanella。 “迈向EVM字节码控制流图的声音结构” 。在第26届ACM国际正式技术研讨会论文集(FTFJP 2024)中,与ECOP 2024共同置于了2024年。
编译EVMLISA需要:
您需要:
git clone https://github.com/lisa-analyzer/evm-lisa.git
cd evm-lisa在运行EVMLISA之前,请确保使用Etherscan API密钥设置环境变量。请按照以下步骤设置环境变量:
.env的文件。.env文件中,添加以下行: ETHERSCAN_API_KEY=<your_etherscan_api_key>
<your_etherscan_api_key> 。在这里,您可以找到如何生成etherscan API密钥。
设置环境变量后,您可以通过Docker或通过Bash运行EVMLISA。
构建容器:
mkdir -p execution/docker &&
docker build -t evm-lisa:latest .
然后,您可以使用以下方式运行EVMLISA:
docker run --rm -it
-v $(pwd)/.env:/app/.env
-v $(pwd)/execution/docker:/app/execution/results
evm-lisa:latest
-a <smart_contract_address> [options]
-v $(pwd)/.env:/app/.env :安装.env文件。-v $(pwd)/execution/docker:/app/execution/results :共享结果的文件夹。将
<smart_contract_address>替换为要分析的以太坊智能合约的地址。
建立项目:
./gradlew build创建分布zip:
./gradlew distZip解压缩分布:
unzip build/distributions/evm-lisa.zip -d execution然后,您可以使用以下方式运行EVMLISA:
./execution/evm-lisa/bin/evm-lisa
-a < smart_contract_address > [options]将
<smart_contract_address>替换为要分析的以太坊智能合约的地址。
该命令将启动指定智能合约的分析过程,并根据合同的EVM字节来提供见解和结果。
Options:
-a,--address <arg> address of an Ethereum smart contract
-b,--benchmark <arg> filepath of the benchmark suite (i.e., a list of smart contract addresses)
-C,--cores <arg> number of cores to use
-c,--dump-cfg dump the CFG
-d,--dump-analysis <arg> dump the analysis (html, dot)
-D,--download-bytecode download the bytecode, without analyzing it
-f,--filepath <arg> filepath of an EVM bytecode smart contract
-o,--output <arg> output directory path
-q,--stack-size <arg> maximal height of stack
-s,--dump-stats dump statistics
-S,--use-live-storage use the live storage in SLOAD
-w,--stack-set-size <arg> maximal size of stack sets
在对EVM字节码程序的分析中,EVMLISA采用一组抽象堆栈的域来增强精度,尤其是在源代码中遇到循环时。
EVMLISA引入抽象堆栈Powerset域
这是如何运行EVMLISA的示例。在此示例中,我们将通过地址分析智能合约0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557B ,具有堆栈尺寸,堆栈大小,实时存储使用,CFG和CFG的投资的特定选项,CFG:CFG:
./execution/evm-lisa/bin/evm-lisa
-a 0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557B
--stack-size 64
--stack-set-size 10
--dump-stats
--use-live-storagedocker run --rm -it
-v $( pwd ) /.env:/app/.env
-v $( pwd ) /execution/docker:/app/execution/results
evm-lisa:latest
-a 0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557B
--stack-size 64
--stack-set-size 10
--dump-stats
--use-live-storage使用
docker run -a stderr仅将JSON报告作为标准输出。
预期输出如下:
# #############
Total opcodes : 344
Total jumps : 45
Resolved jumps : 44
Definitely unreachable jumps : 1
Maybe unreachable jumps : 0
Unsound jumps : 0
Maybe unsound jumps : 0
# #############