
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
# #############