
Evmlisaは、Ethereumブロックチェーンに展開され、LISAに基づいて展開されたスマートコントラクトのEVMバイトコードの抽象的な解釈に基づいた静的分析器です。 EVMバイテコードスマートコントラクトを考えると、Evmlisaはスマートコントラクトの健全で正確なコントロールフローグラフを構築します。
Evmlisaは、ピアレビューされた出版物に基づいています
Vincenzo Arceri、Saverio Mattia Merenda、Greta Dolcetti、Luca Negrini、Luca Olivieri、Enea Zaffanella。 「EVMバイトコード制御フローグラフの健全な構造に向けて」 。 Ecoop 2024と共同で開催された、Javaのようなプログラムの正式なテクニック(FTFJP 2024)に関する第26回ACM International Workshopの議事録。
Evmlisaのコンパイルには次のことが必要です。
必要がある:
git clone https://github.com/lisa-analyzer/evm-lisa.git
cd evm-lisaEvmlisaを実行する前に、EtherScan APIキーを使用して環境変数を設定していることを確認してください。以下の手順に従って、環境変数を設定します。
.envという名前のファイルを作成することから始めます。.envファイル内に、次の行を追加します。 ETHERSCAN_API_KEY=<your_etherscan_api_key>
<your_etherscan_api_key> EtherScan APIキーに置き換えます。ここでは、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 :結果のフォルダーを共有します。分析するEthereum Smart契約のアドレスに
<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]分析するEthereum Smart契約のアドレスに
<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を実行する方法の例は次のとおりです。この例では、スタックサイズ、スタックセットサイズ、ライブストレージ使用量、CFGのダンプの特定のオプションを使用して、アドレス0x7c21C4Bbd63D05Fa9F788e38d14e18FC52E9557Bでスマートコントラクトを分析します。
./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
# #############