Skip to main content

dolabra

Dolabra is a semantic analysis tool for EVM bytecode based on Mythril and Ithildin. By using symbolic execution and taint analysis, it aims at detecting functions that are instances of given patterns. It is primarily written in Python and contains several modules and loaders to facilitate the analysis of Solidity contracts.

Table of Contents

Features

  • Analysis of Solidity contracts.
  • Symbolic analysis of contracts.
  • Multiple contract loaders to load contracts from different sources.
  • Modular architecture to facilitate the addition of new analysis modules.
  • CLI for easy interaction.

Installation

Clone the repository and install the required dependencies.

$ pip install dolabra

Usage

Dolabra can analyze contracts provided in one of the following formats. Run dolabra --help to see all arguments that the program accepts.

Deployed contracts using RPC

The following command analyzes the contract bytecode at the given target address. You'll have to supply the RPC endpoint using the --rpc argument, unless you are using geth, in which case the default endpoint http://localhost:8545 is used.

$ dolabra analyze --address 0x45e650d1AcE4d63541b80793510D585AceA9C37B

Specify solc compiler

This command will use the solc compiler that is currently installed on your system if --solc is not specified. Older compilers can be downloaded from the ethereum/solc-bin repository (make sure you make them executable).

$ dolabra analyze --sol test.sol --solc ./solc-linux-amd64-v0.8.4+commit.c7e474f2

Creation Bytecode

Provide a file containing the EVM (creation) bytecode in one line.

$ dolabra analyze --bin ./creation_bytecode_example.bin

Runtime Bytecode

Provide a file containing the runtime bytecode in one line.

$ dolabra analyze --bin-runtime ./runtime_bytecode_example.bin

Modules

Dolabra contains several analysis modules located in the dolabra/analysis/module/modules directory. Each module is designed to perform a specific type of analysis on Solidity contracts. The available modules are:

  • Getter: Analyzes getter functions in contracts.
  • Payable: Analyzes payable functions in contracts, needs a more abstract approach.
  • Setter: Analyzes setter functions in contracts.
  • StorageCallerCheck: Checks storage caller in contracts.

The followings serve as a basis for the modules (providing extendability):

  • BaseModule: The base module from which other modules are derived.
  • Loader: Loads contracts for analysis.
  • Taints: Taint classes for taint analysis.
  • Utils: Provides utility functions for modules.

Contract Loaders

Dolabra provides several contract loaders located in the dolabra/contract_loaders directory to load contracts from different sources such as files, JSON-RPC, and Solidity sources. The available contract loaders are:

  • BinaryLoader: Loads binary contracts.
  • ContractLoader: The base loader from which other loaders are derived.
  • FileLoader: Loads contracts from files.
  • JsonrpcLoader: Loads contracts using JSON-RPC.
  • Loader: Provides a generic loader interface.
  • SolidityLoader: Loads Solidity contracts.

Pitfalls

  • cargo/rust should be installed because of mythril
  • There is currently a known incompatibility between rust and blake2b-py GitHub Issue, using a nightly build of rust resolved it.

Development Setup

Install all the requirements inside a virtual environment or globally. For development and testing purposes, there is the possibility to whitelist modules in symbolic.py

$ cd <dolabra-root>
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip3 install -e .

Installing Dolabra Globally

$ $ pip install dolabra

Metadata

Release files for dolabra 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dolabra 1.0
File Size Uploaded Provenance Actions
dolabra-1.0.tar.gz 17.4 kB Without provenance Details for dolabra-1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dolabra 1.0
File Interpreter ABI Platform Actions
dolabra-1.0-py3-none-any.whl Python 3 none any Details for dolabra-1.0-py3-none-any.whl

Total release size: 45.1 kB

Release files / dolabra-1.0.tar.gz

Download URL dolabra-1.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
40cd05148e9e5382ce2e38742d691897e86a818e769544ff09e3b59a0e9bd36a
BLAKE2b-256 checksum
How to use checksums
3bf32d69521cd0ddd206d52bb4f6ca364bdfa42b7ba6371e9b1a568daa3a1137
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / dolabra-1.0-py3-none-any.whl

Download URL dolabra-1.0-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4986b229c5cf405b1c40be12e915e8eb03cb05e61273db6c83ac9b06e2fe051d
BLAKE2b-256 checksum
How to use checksums
9b550450af0153d2e83adf977f15324244a6f221634a17534468f41d58dd5b73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Security for dolabra 1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page