• Stars
    star
    106
  • Rank 314,825 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web3 Decoder

Web3 Decoder is a Burp Suite Extension that helps to analyze what is going on with the operations involving smart contracts of the web3. This is mainly JSON-RPC calls to Ethereum Nodes, and nodes of other compatible networks (like Polygon, Arbitrum, BSC...)

Block explorers API Keys

Most block explorers supported, like etherscan.io require an API key to allow more than 1 request each 5 seconds.

To add your API keys you have 2 options:

  • You can add your API keys modifying the .api_keys.json file
  • You can add Environment variables with the same names as the ones in the API_KEYS.json file
    • e.g.: export ETHERSCAN_API=YOURAPIKEY

Manually adding a contract's ABI

The extension caches the downloaded ABIs from the block explorers like etherscan inside a folder named .abi_caches in JSON format. You can simply add a new file inside that folder, with the following naming convention:

{chain_id}_{contract_address.lower()}.abi

For example:

# Ethereum Mainnet (chain ID 1), contract 0xfbdca68601f835b27790d98bbb8ec7f05fdeaa9b
1_0xfbdca68601f835b27790d98bbb8ec7f05fdeaa9b.abi

# Polygon (chain id 137), contract 0x447646e84498552e62ecf097cc305eabfff09308
137_0x447646e84498552e62ecf097cc305eabfff09308.abi

Precompiled Binaries and Python3 Virtualenv

This extension requires python3 libraries like web3.py that unfortunately are not available for python 2.7 to be used directly with Jython 2.7. As a 'hack', the main functionality is written in a python 3 library that is being executed by the extension through a python virtual environment (talking about dirty...)

I have created precompiled binaries of the python3 library used, for Linux, Windows and Mac OSX. The extension will use these binaries if it is not able to execute the library. For better performance or development, you can create a virtualenv, and install as follows:

git clone https://github.com/nccgroup/web3-decoder 
cd "web3-decoder"
virtualenv -p python3 venv
source venv/bin/activate
pip install web3 py-evm

The extension will make calls to the library using the created virtualenv.

Once the virtualenv is created, you can add the python extension by selecting the burp_web3_decoder.py file in the Extender tab of Burp Suite

Features and TODOs

  • Burp EditorTab added to compatible Requests and Responses
  • Decode of eth_call JSON-RPC calls
  • Decode of eth_sendRawTransaction JSON-RPC calls (and their inner functions)
  • Decode of response results from eth_call
  • Support for re-encoding of eth_call decoded functions
  • Automatic download of the smart contract ABI called from etherscan APIs (if the contract is verified)
  • Decode of function inputs both in eth_call and eth_sendRawTransaction
  • Decode of function inputs that uses "Delegate Proxy" contracts
  • Decode of function inputs called via "Multicall" contracts
  • Manual addition of contract ABIs for contracts that are not verified in etherscan
    • Allow to make this from Burp interface, instead of writing the JSON to a file
  • Pre-compiled binaries to allow the extension to work without setup
  • Support for other compatible networks (Polygon, Arbitrum, Fantom, BSC, etc.)
  • Support for re-signing a modified decoded rawTransaction (requires input of privateKey)

Chains Supported so far

All supported chains can be found in the chains.json file. These are chains that have a block explorer with the same APIs as etherscan. If you want to add more blockchain explorers, add them to the chains.json file, test it, and make a pull request!

  • Ethereum Mainnet
  • Ropsten
  • Rinkeby
  • Goerli
  • Optimism
  • Cronos
  • Kovan
  • BSC
  • Huobi ECO
  • Polygon
  • Fantom
  • Arbitrum
  • Sepolia
  • Aurora
  • Avalanche

Examples

For more examples, including proxy and multicall calls, see the EXAMPLES.md

eth_call:

Raw: image

Decoded: image

eth_sendRawTransaction (Uniswap v2 test):

{
    "method": "eth_sendRawTransaction", 
    "params": [
        "0x02f9015b820539808459682f00850df8475800830493e0947a250d5630b4cf539739df2c5dacb4c659f2488d880de0b6b3a7640000b8e47ff36ab500000000000000000000000000000000000000000000009e0950598867d8000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000002105eaa660ff62b14a5e093fc348e13ab63af2e600000000000000000000000000000000000000000000000000000000623b16570000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0fc001a005cfdf9ff11dea2d3e8781cb6ba140ae6e86a0922bfa75938b6f2456f513e24ca057f02b3f7125edb59e22651d503bc296153860e3843f9d495ad21d898c8e20c3"
    ], 
    "id": 4700418092893, 
    "jsonrpc": "2.0"
}

Decoded:

[
  {
    "chain_id": 1337, 
    "access_list": [], 
    "nonce": 0, 
    "r": 2628844986784880378434698689940765181553490914879903463877191830852582236748, 
    "s": 39775559607776431912363889945449043629789293388076288013264795388376358199491, 
    "max_priority_fee_per_gas": 1500000000, 
    "gas": 300000, 
    "max_fee_per_gas": 60000000000, 
    "from": "0x2105Eaa660ff62b14a5e093fc348e13ab63AF2E6", 
    "y_parity": 1, 
    "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", 
    "value": 1000000000000000000,
    "data": "0x7ff36ab500000000000000000000000000000000000000000000009e0950598867d8000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000002105eaa660ff62b14a5e093fc348e13ab63af2e600000000000000000000000000000000000000000000000000000000623b16570000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f", 
    "decoded_function": {
      "args": {
        "amountOutMin": 2915256698432979992576, 
        "path": [
          "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 
          "0x6B175474E89094C44Da98b954EedeAC495271d0F"
        ], 
        "to": "0x2105Eaa660ff62b14a5e093fc348e13ab63AF2E6", 
        "deadline": 1648039511
      }, 
      "function": "swapExactETHForTokens(uint256,address[],address,uint256)", 
      "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
      "abi": {
        "outputs": [
          {
            "internalType": "uint256[]", 
            "type": "uint256[]", 
            "name": "amounts"
          }
        ], 
        "inputs": [
          {
            "internalType": "uint256", 
            "type": "uint256", 
            "name": "amountOutMin"
          }, 
          {
            "internalType": "address[]", 
            "type": "address[]", 
            "name": "path"
          }, 
          {
            "internalType": "address", 
            "type": "address", 
            "name": "to"
          }, 
          {
            "internalType": "uint256", 
            "type": "uint256", 
            "name": "deadline"
          }
        ], 
        "stateMutability": "payable", 
        "type": "function", 
        "name": "swapExactETHForTokens"
      }
    }
  }
]

How it works

eth_chainId JSON-RPC request to the node in use to detect which chain we are working on, and depending on the chain, selects a block explorer API, by searching in the chains.json file.

As an example of use, to decode function calls, we need the ABI (Application Binary Interface) of the contract, which contains all functions that can be called in the contract and their inputs and outputs. For now, it works with verified contracts in the block explorer, or by manually adding the ABI. In future releases, we will explore the possibility of automatically generating an ABI by searching the function selectors in public databases.

The following "flow" diagram shows in a simplified way the process that the eth_decoder library follows when decoding eth_call JSON-RPC calls:

image

Known Limitations

  • Decoding raw transactions in Windows is not possible due to one of the libraries used not available in Windows g

More Repositories

1

ScoutSuite

Multi-Cloud Security Auditing Tool
Python
6,173
star
2

Scout2

Security auditing tool for AWS environments
Python
1,728
star
3

sobelow

Security-focused static analysis for the Phoenix Framework
Elixir
1,601
star
4

Winpayloads

Undetectable Windows Payload Generation
Python
1,519
star
5

demiguise

HTA encryption tool for RedTeams
Python
1,326
star
6

house

A runtime mobile application analysis toolkit with a Web GUI, powered by Frida, written in Python.
JavaScript
1,321
star
7

PMapper

A tool for quickly evaluating IAM permissions in AWS.
Python
1,279
star
8

redsnarf

RedSnarf is a pen-testing / red-teaming tool for Windows environments
PowerShell
1,182
star
9

featherduster

An automated, modular cryptanalysis tool; i.e., a Weapon of Math Destruction
Python
1,074
star
10

SocksOverRDP

Socks5/4/4a Proxy support for Remote Desktop Protocol / Terminal Services / Citrix / XenApp / XenDesktop
C++
990
star
11

singularity

A DNS rebinding attack framework.
JavaScript
962
star
12

exploit_mitigations

Knowledge base of exploit mitigations available across numerous operating systems, architectures and applications and versions.
812
star
13

AutoRepeater

Automated HTTP Request Repeating With Burp Suite
Java
742
star
14

fuzzowski

the Network Protocol Fuzzer that we will want to use.
Python
702
star
15

aws-inventory

Discover resources created in an AWS account.
Python
690
star
16

BurpSuiteHTTPSmuggler

A Burp Suite extension to help pentesters to bypass WAFs or test their effectiveness using a number of techniques
Java
654
star
17

Sniffle

A sniffer for Bluetooth 5 and 4.x LE
C
648
star
18

nmap-nse-vulnerability-scripts

NMAP Vulnerability Scanning Scripts
Lua
618
star
19

TriforceAFL

AFL/QEMU fuzzing with full-system emulation.
C
615
star
20

LoggerPlusPlus

Advanced Burp Suite Logging Extension
Java
608
star
21

nccfsas

Information released publicly by NCC Group's Full Spectrum Attack Simulation (FSAS) team.
C
598
star
22

sadcloud

A tool for standing up (and tearing down!) purposefully insecure cloud infrastructure
HCL
593
star
23

freddy

Automatically identify deserialisation issues in Java and .NET applications by using active and passive scans
Java
570
star
24

phantap

Phantom Tap (PhanTap) - an โ€˜invisibleโ€™ network tap aimed at red teams
C
560
star
25

tracy

A tool designed to assist with finding all sinks and sources of a web application and display these results in a digestible manner.
JavaScript
549
star
26

azucar

Security auditing tool for Azure environments
PowerShell
546
star
27

VCG

VisualCodeGrepper - Code security scanning tool.
Visual Basic .NET
506
star
28

Cyber-Defence

Information released publicly by NCC Group's Cyber Incident Response Team
Python
470
star
29

autochrome

This tool downloads, installs, and configures a shiny new copy of Chromium.
HTML
431
star
30

scrying

A tool for collecting RDP, web and VNC screenshots all in one place
Rust
425
star
31

wssip

Application for capturing, modifying and sending custom WebSocket data from client to server and vice versa.
JavaScript
425
star
32

blackboxprotobuf

Blackbox protobuf is a Burp Suite extension for decoding and modifying arbitrary protobuf messages without the protobuf type definition.
Python
380
star
33

autopwn

Specify targets and run sets of tools against them
Python
374
star
34

idahunt

idahunt is a framework to analyze binaries with IDA Pro and hunt for things in IDA Pro
Python
373
star
35

CrossSiteContentHijacking

Content hijacking proof-of-concept using Flash, PDF and Silverlight
HTML
372
star
36

Solitude

Solitude is a privacy analysis tool that enables anyone to conduct their own privacy investigations. Whether a curious novice or a more advanced researcher, Solitude makes the process of evaluating user privacy within an app accessible for everyone.
CSS
370
star
37

vlan-hopping---frogger

Easy 802.1Q VLAN Hopping
Shell
346
star
38

DriverBuddy

DriverBuddy is an IDA Python script to assist with the reverse engineering of Windows kernel drivers.
Python
331
star
39

shocker

A tool to find and exploit servers vulnerable to Shellshock
Python
330
star
40

WMIcmd

A command shell wrapper using only WMI for Microsoft Windows
C#
319
star
41

acCOMplice

Tools for discovery and abuse of COM hijacks
PowerShell
272
star
42

umap

The USB host security assessment tool
Python
265
star
43

keimpx

Check for valid credentials across a network over SMB
Python
260
star
44

SusanRTTI

Another RTTI Parsing IDA plugin
Python
258
star
45

metasploitavevasion

Metasploit AV Evasion Tool
Shell
257
star
46

UPnP-Pentest-Toolkit

UPnP Pentest Toolkit for Windows
C#
244
star
47

umap2

Umap2 is the second revision of NCC Group's python based USB host security assessment tool.
Python
240
star
48

GTFOBLookup

Offline command line lookup utility for GTFOBins (https://github.com/GTFOBins/GTFOBins.github.io), LOLBAS (https://github.com/LOLBAS-Project/LOLBAS), WADComs (https://wadcoms.github.io), and HijackLibs (https://hijacklibs.net/).
Python
238
star
49

G-Scout

Google Cloud Platform Security Tool
Python
232
star
50

asatools

Main repository to pull all NCC Group Cisco ASA-related tool projects.
Shell
220
star
51

cisco-SNMP-enumeration

Automated Cisco SNMP Enumeration, Brute Force, Configuration Download and Password Cracking
Shell
216
star
52

depthcharge

A U-Boot hacking toolkit for security researchers and tinkerers
Python
212
star
53

thetick

A simple embedded Linux backdoor.
Python
195
star
54

AWS-recipes

A number of Recipes for AWS
Python
195
star
55

kube-auto-analyzer

Kubernetes Auto Analyzer
HTML
192
star
56

TPMGenie

TPM Genie is an I2C bus interposer for discrete Trusted Platform Modules
C++
189
star
57

BinProxy

BinProxy is a proxy for arbitrary TCP connections. You can define custom message formats using the BinData gem.
Ruby
172
star
58

DetectWindowsCopyOnWriteForAPI

Enumerate various traits from Windows processes as an aid to threat hunting
C++
168
star
59

TriforceLinuxSyscallFuzzer

A linux system call fuzzer using TriforceAFL
C
167
star
60

BKScan

BlueKeep scanner supporting NLA
Shell
167
star
61

pybeacon

A collection of scripts for dealing with Cobalt Strike beacons in Python
Python
167
star
62

typofinder

A finder of domain typos showing country of IP address
Python
166
star
63

BLESuite

BLESuite is a Python package that provides an easier way to test Bluetooth Low Energy (BLE) device
Python
165
star
64

tcpprox

A small command-line TCP proxy utility written in Python
Python
156
star
65

libslub

Python
155
star
66

LazyDroid

bash script to facilitate some aspects of an Android application assessment
Shell
151
star
67

chuckle

An automated SMB relay exploitation script.
Shell
151
star
68

requests-racer

Small Python library that makes it easy to exploit race conditions in web apps with Requests.
Python
150
star
69

whalescan

Whalescan is a vulnerability scanner for Windows containers, which performs several benchmark checks, as well as checking for CVEs/vulnerable packages on the container
Python
143
star
70

gitpwnd

GitPwnd is a network penetration tool that lets you use a git repo for command and control of compromised machines
Python
139
star
71

CollaboratorPlusPlus

Java
139
star
72

Carnivore

Tool for assessing on-premises Microsoft servers authentication such as ADFS, Skype, Exchange, and RDWeb
C#
139
star
73

Change-Lockscreen

Offensive tool to trigger network authentications as SYSTEM
C#
134
star
74

Decoder-Improved

Improved decoder for Burp Suite
Java
134
star
75

Wubes

Qubes containerization on Windows
Python
131
star
76

OutlookLeakTest

The Outlook HTML Leak Test Project
C#
131
star
77

port-scan-automation

Automate NMAP Scans and Generate Custom Nessus Policies Automatically
Shell
128
star
78

Hodor

Hodor! Fuzzer..
Python
126
star
79

Zulu

The Zulu fuzzer
Python
125
star
80

WinShareEnum

Windows Share Enumerator
C#
121
star
81

memscan

Searches for strings, regex, credit card numbers of magnetic stripe card tracks in a Windows process's memory space
C#
120
star
82

ebpf

eBPF - extended Berkeley Packet Filter tooling
Python
116
star
83

cq

Python
115
star
84

argumentinjectionhammer

A Burp Extension designed to identify argument injection vulnerabilities.
Python
114
star
85

DroppedConnection

Python
113
star
86

SCOMDecrypt

SCOMDecrypt is a tool to decrypt stored RunAs credentials from SCOM servers
C#
112
star
87

GOATCasino

This is an intentionally vulnerable smart contract truffle deployment aimed at allowing those interested in smart contract security to exploit a wide variety of issues in a safe environment.
JavaScript
112
star
88

OneLogicalMyth_Shell

A HTA shell to assist with breakout assessments.
HTML
111
star
89

BLE-Replay

BLE-Replay is a Bluetooth Low Energy (BLE) peripheral assessment tool
Python
110
star
90

ccs

Python
107
star
91

WindowsDACLEnumProject

A collection of tools to enumerate and analyse Windows DACLs
C++
105
star
92

DIBF

Windows NT ioctl bruteforcer and modular fuzzer
C++
103
star
93

raccoon

Salesforce object access auditor
Python
103
star
94

go-pillage-registries

Pentester-focused Docker registry tool to enumerate and pull images
Go
103
star
95

cloud_ip_ranges

Identify IP addresses owned by public cloud providers
Python
101
star
96

DatajackProxy

Datajack Proxy allows you to intercept TLS traffic in native x86 applications across platforms
JavaScript
100
star
97

pcap-burp

Pcap importer for Burp
Java
100
star
98

jwt-reauth

Java
100
star
99

KilledProcessCanary

A canary designed to minimize the impact from certain Ransomware actors
C#
99
star
100

Berserko

Burp Suite extension to perform Kerberos authentication
Java
99
star