Coder Social home page Coder Social logo

jseam2 / pakala Goto Github PK

View Code? Open in Web Editor NEW

This project forked from palkeo/pakala

0.0 1.0 0.0 209 KB

Offensive vulnerability scanner for ethereum, and symbolic execution tool for the Ethereum Virtual Machine

Home Page: https://www.palkeo.com/en/projets/ethereum/pakala.html

License: GNU General Public License v3.0

Python 100.00%

pakala's Introduction

Pakala

PyPI Build States

"ilo Pakala li pakala e mani sona"

  • Pakala is a tool to search for exploitable bugs in Ethereum smart contracts.
  • Pakala is a symbolic execution engine for the Ethereum Virtual Machine.

The intended public for the tool are security researchers interested by Ethereum / the EVM.

Installation

pip3 install pakala

It works only with python 3.

Usage

Let's look at 0xeBE6c7a839A660a0F04BdF6816e2eA182F5d542C: it has a transfer(address _to, uint256 _value) function. It is supposedly protected by a require(call.value - _value) >= 0 but that condition always holds because we are substracting two unsigned integers, so the result is also an unsigned integer.

Let's scan it:

pakala 0xeBE6c7a839A660a0F04BdF6816e2eA182F5d542C --force-balance="1 ether"

The contract balance being 0, we won't be able to have it send us some ethers. So we override the balance to be 1 ETH: then it has some "virtual" money to send us.

The tool with tell you a bug was found, and dump you a path of "states". Each state corresponds to a transaction, with constraints that needs to be respected for that code path to be taken, storage that has been read/written...

Advice: look at calldata[0] in the constraints to see the function signature for each transaction.

See pakala help for more complete usage information.

How does it works? What does it do?

See the introductory article for more information and a demo.

In a nutshell:

  • It's very good at finding simple bugs in simple contracts.
  • The false-positive rate is very low. If it flags your contract it's likely people can drain it.
  • It can exploit non-trivial bugs requiring to overwrite some storage keys with others (array size underflow...), has a good modeling of cryptographic hashes, and support chaining multiple transactions.

However, It only implements an "interesting" subset of the EVM. It doesn't handle:

  • gas,
  • precompiles,
  • or a contract interacting with other contracts (DELEGATECALL, STATICCALL...).

This means that CALL support is limited to sending ethers. Other tools like Manticore can do that much better, and the focus for Pakala was offensive vulnerability scanning of contracts en masse.

pakala's People

Watchers

 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.