
EVMLISA เป็นเครื่องวิเคราะห์แบบคงที่โดยใช้การตีความแบบนามธรรมสำหรับ EVM Bytecode ของสัญญาอัจฉริยะที่นำไปใช้กับ Ethereum blockchain และสร้างขึ้นบน Lisa ด้วยสัญญาอัจฉริยะ EVM Bytecode EVMLISA จึงสร้างกราฟการควบคุมเสียงและการควบคุมที่แม่นยำของสัญญาอัจฉริยะ
Evmlisa ขึ้นอยู่กับสิ่งพิมพ์ที่ผ่านการตรวจสอบโดยเพื่อน
Vincenzo Arceri, Saverio Mattia Merenda, Greta Dolcetti, Luca Negrini, Luca Olivieri, Enea Zaffanella "ไปสู่การสร้างเสียงกราฟการควบคุมการไหลของ EVM bytecode" ในการประชุมเชิงปฏิบัติการนานาชาติ ACM ครั้งที่ 26 เกี่ยวกับเทคนิคทางการสำหรับโปรแกรมที่มีลักษณะคล้าย Java (FTFJP 2024) ซึ่งตั้งอยู่ร่วมกับ ECOOP 2024
การรวบรวม EVMLISA ต้องการ:
คุณต้องทำ:
git clone https://github.com/lisa-analyzer/evm-lisa.git
cd evm-lisaก่อนที่จะเรียกใช้ EVMLISA ตรวจสอบให้แน่ใจว่าคุณได้ตั้งค่าตัวแปรสภาพแวดล้อมด้วยคีย์ Etherscan API ของคุณ ทำตามขั้นตอนด้านล่างเพื่อตั้งค่าตัวแปรสภาพแวดล้อม:
.env ในโครงการ EVMLISA.env เพิ่มบรรทัดต่อไปนี้: ETHERSCAN_API_KEY=<your_etherscan_api_key>
<your_etherscan_api_key> ด้วยคีย์ Etherscan API ของคุณที่นี่คุณสามารถค้นหาวิธีสร้างคีย์ Etherscan API
เมื่อคุณตั้งค่าตัวแปรสภาพแวดล้อมแล้วคุณสามารถเรียกใช้ EVMLISA ผ่าน Docker หรือผ่าน Bash
สร้างคอนเทนเนอร์:
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>ด้วยที่อยู่ของสัญญาสมาร์ท Ethereum ที่คุณต้องการวิเคราะห์
สร้างโครงการ:
./gradlew buildสร้าง Zip Distribution:
./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>ด้วยที่อยู่ของสัญญาสมาร์ท Ethereum ที่คุณต้องการวิเคราะห์
คำสั่งนี้จะเริ่มต้นกระบวนการวิเคราะห์สำหรับสัญญาอัจฉริยะที่ระบุโดยให้ข้อมูลเชิงลึกและผลลัพธ์ตามรหัส Bytecode 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
ในการวิเคราะห์โปรแกรม Bytecode EVM EVMLISA ใช้โดเมนของชุดของสแต็คนามธรรมเพื่อเพิ่มความแม่นยำโดยเฉพาะอย่างยิ่งเมื่อพบลูปในซอร์สโค้ด
Evmlisa แนะนำโดเมนนามธรรมสแต็ค PowerSet
นี่คือตัวอย่างของวิธีการเรียกใช้ EVMLISA ในตัวอย่างนี้เราจะวิเคราะห์สัญญาอัจฉริยะตามที่อยู่ 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
# #############