The repository contains Python implementation of Maian -- a tool for automatic detection of buggy Ethereum smart contracts of three different types: prodigal, suicidal and greedy. Maian processes contract's bytecode and tries to build a trace of transactions to find and confirm bugs. The technical aspects of the approach are described in our paper.
Maian analyzes smart contracts defined in a file <contract file>
with:
-s <contract file> <main contract name>
-bs <contract file>
-b <contract file>
Maian checks for three types of buggy contracts:
-c 0
-c 1
-c 2
For instance, to check if the contract ParityWalletLibrary.sol
given in Solidity source code with WalletLibrary
as main contract is suicidal use
$ python maian.py -s ParityWalletLibrary.sol WalletLibrary -c 0
The output should look like this:
To get the full list of options use python maian.py -h
For GUI inclined audience, we provide a simple GUI-based Maian. Use python gui-maian.py
to start it.
A snapshot of one run is given below
Maian should run smoothly on Linux (we've checked on Ubuntu/Mint) and MacOS. Our attempts to run it on Windows have failed. The list of dependencies is as follows:
pip install web3
sudo apt install python-pyqt5
To reduce the number of false positives, Maian deploys the analyzed contracts (given either as Solidity or bytecode source) on
a private blockchain, and confirms the found bugs by sending appropriate transactions to the contracts.
Therefore, during the execution of the tool, a private Ethereum blockchain is running in the background (blocks are mined on it in the same way as on the Mainnet). Our code stops the private blockchain once Maian finishes the search, however, in some extreme cases, the blockchain keeps running. Please make sure that after the execution of the program, the private blockchain is off (i.e. top
does not have geth
task that corresponds to the private blockchain).
Maian is released under the MIT License, i.e. free for private and commercial use.