Skip to content

A tool to automatically patch vulnerable Ethereum smart contracts (RAID 2022).

Notifications You must be signed in to change notification settings

ASSERT-KTH/Elysium

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elysium

A tool to automatically patch vulnerable Ethereum smart contracts. This repository also includes the data, tools, and results from our paper. Our paper can be found here.

Installation Instructions

1. Install Docker

MacOS

Download and install Docker Desktop for Mac: https://docs.docker.com/desktop/mac/install/

For other operating systems follow the installation instructions on docker.com.

2. Install Rust nightly version

MacOS/Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup toolchain install nightly
rustup override set nightly

Please also configure the PATH environment variable.

For more details or other operating systems please follow the installation instructions on rust-lang.org.

3. Install Python dependencies

cd elysium
python3 -m pip install -r requirements.txt

Running Instructions

Install Solidity compiler version 0.4.24 using solc-select
solc-select install 0.4.24
solc-select use 0.4.24
Pull Docker images of detectors and evaluated tools
docker pull christoftorres/osiris
docker pull christoftorres/oyente
docker pull christoftorres/mythril
docker pull christoftorres/smartshield
docker pull christoftorres/sguard
Run Elysium
cd elysium

# Example patching multiple integer overflows
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-101/tokensalechallenge/tokensalechallenge.sol --cfg

# Example patching integer underflow
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-101/subtraction/integer_overflow_minimal/integer_overflow_minimal.sol -c IntegerOverflowMinimal --cfg

# Example patching unhandled exceptions
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-104/unchecked_return_value.sol -c ReturnValue --cfg

# Example patching leaking ether
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-105/simple_ether_drain.sol -c SimpleEtherDrain --cfg

# Example patching suicidal contract
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-106/simple_suicide.sol -c SimpleSuicide --cfg

# Example patching reentrancy and integer overflow
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-107/simple_dao.sol -c SimpleDAO --cfg

# Example patching unsafe delegatecall
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-112/proxy.sol -c Proxy --cfg 

# Example patching transaction origin
python3 elysium.py -s ../evaluation/datasets/SWC/SWC-115/mycontract.sol -c MyContract --cfg

Docker image

Build the docker image and run it:

docker build -t elysium .
docker run -it -v /var/run/docker.sock:/var/run/docker.sock elysium bash

Whilst inside the container, test the previous Running Instructions.

About

A tool to automatically patch vulnerable Ethereum smart contracts (RAID 2022).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 33.8%
  • Python 30.0%
  • C++ 21.7%
  • Solidity 12.9%
  • CMake 0.4%
  • Shell 0.4%
  • Other 0.8%