GithubHelp home page GithubHelp logo

fewkap / verismart-public Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kupl/verismart-public

0.0 0.0 0.0 240 KB

a safety verifier for Solidity smart contracts

License: Other

Shell 0.08% OCaml 97.66% Python 2.25%

verismart-public's Introduction

VeriSmart

VeriSmart is a safety analyzer for Solidity smart contracts. Currently, VeriSmart supports two types of analysis modes.

  • Safety verification (VeriSmart, S&P '20)

In this mode, VeriSmart can be used to prove the absence of bugs or detect bugs. The key feature in this mode is, VeriSmart automatically infers transcation invariants, which are conditions that hold under arbitrary interleaving of transcations, of smart contracts. With this ability, VeriSmart can precisely analyze safety properties (e.g., no integer overflows) in smart contracts.

  • Vulnerable transaction sequence generation (SmarTest, Security '21)

VeriSmart in this mode can be used to generate vulnerable transaction sequences (with concrete arguments for each transaction) that demonstrate the flaws. The key feature in this mode is, we guide a symbolic execution procedure with language models to find vulnerable sequences effectively. VeriSmart in this mode is called SmarTest.

VeriSmart has been developed and maintained by Software Analysis Laboratory at Korea University.

The benchmarks used in our papers (S&P '20, Security '21) are available here.

Installation

Dependencies

  • Install OCaml libraries below:
opam install -y conf-m4.1 ocamlfind ocamlbuild num yojson batteries ocamlgraph zarith
  • Install Z3:
wget https://github.com/Z3Prover/z3/releases/download/z3-4.7.1/z3-4.7.1.tar.gz
tar -xvzf z3-4.7.1.tar.gz
cd z3-z3-4.7.1
python3 scripts/mk_make.py --ml
cd build
make -j 4
sudo make install
  • Install Solidity Compiler (solc).

Build

Clone this project.
chmod +x build
./build

Usage

You can check execution options by ./main.native -help.

Examples

  • Set verification timeout to 1 minute with -verify_timeout, and set Z3 timeout (per query) to 10 seconds with -z3timeout.
# -verify_timeout: specified in seconds (default: 5 minutes)
# -z3timeout: specified in milliseconds (default: 30 seconds)
./main.native -input CONTRACT.sol -verify_timeout 60 -z3timeout 10000
  • Specify a root contract with -main.
./main.native -input CONTRACT.sol -main ROOTNAME

Note that, if -main option is not provided, VeriSmart will assume the last contract in source code as a root contract.

  • Specify a solc version with -solc.
./main.native -input CONTRACT.sol -solc 0.5.11

Note that, in this case, CONTRACT.sol must be compiled with solc v.0.5.11, where the solc binary named solc_0.5.11 should be located at the path identified by which solc_0.5.11. If the -solc option is not explicitly provided, VeriSmart will attempt to compile the source code with solc binary named solc, located at the path identified by which solc.

  • To run SmarTest (vulnerable sequence geeneration mode), specify the mode with -mode.
./main.native -input examples/leak_unsafe.sol -mode exploit -exploit_timeout 10 leak

Note that the default mode is verification mode. You can also explicitly specify verification mode by providing -mode verify option.

  • You can check the full list of availble options by: ./main.native --help

Related Publications

For technical details of VeriSmart and SmarTest, please see our papers below.

Contact

Sunbeom So: [email protected]

verismart-public's People

Contributors

sunbeomso avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.