• Stars
    star
    167
  • Rank 226,635 (Top 5 %)
  • Language
    Solidity
  • 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

A simple template to perform whitehacks safely

Whitehacks Kit

A simple template to perform whitehacks safely in a single tx, leveraging Foundry and Flashbots.

Disclaimer

Provided AS-IS as educational content only, disclaim any liability for using it.

Usage

Whitehacks are hard and should be execute by professionals. If you are unsure reach-out the Seal 911 Bot. Reach-out anyway.

This repo offers a guide to prepare them.

They must be executed in 1 shot and privately, hence one single transaction and the private mempool by Flashbots.

You prepare, you test in a fork, you don't change, you execute.

Setup

  1. Fork the repo
  2. Install Foundry
  3. Edit Whitehack.sol
  4. Adapt Whitehack.s.sol

Preparation

  1. Unset $ETH_RPC_URL
unset $ETH_RPC_URL
  1. Check no RPC port open on your computer, if so kill the processes
netstat -an | grep LISTEN | grep 8545

Test

  1. Run Anvil fork with
anvil --fork-url https://eth.llamarpc.com
  1. Impersonate your account 0xYOUR_WALLET_ADDRESS
cast rpc \
    anvil_impersonateAccount "0xYOUR_WALLET_ADDRESS" \
    --rpc-url "http://localhost:8545"
  1. Run the script
forge script \
  script/Whitehack.s.sol:WhitehackScript \
  --rpc-url "http://localhost:8545" \
  --sender "0xYOUR_WALLET_ADDRESS" \
  -vvv \
  --broadcast

Run

Do not change your script and contract after the test

forge script \
  script/Whitehack.s.sol:WhitehackScript \
  --rpc-url "https://rpc.flashbots.net?hint=hash" \
  --sender "0xYOUR_WALLET_ADDRESS" \
  --interactives 1 \
  -vvv \
  --broadcast

The rpc url is set for Full Privacy on Flashbots

Examples

More Repositories

1

zkFHE

Verifiable and confidential computation based on ZKP and FHE, powered by risc0 zkVM.
Rust
76
star
2

gas-saver

Gas Saver is a collection of smart contracts to save gas on Ethereum
65
star
3

loadbalanceeeer

PoC local JSON-RPC load-balancer with opt-in anonymizer via Tor
Python
56
star
4

security-toolkit

A collection of smart contracts for implementing security controls and guardrails. Useful for OpSec and educational purposes.
Solidity
52
star
5

IYKYK

KYC without doxxing yourself. Prove your identity to a third party without disclosing it.
TypeScript
41
star
6

NFTSet

NFTSets are NFTs which can hold your NFTs/collectibles (ERC721), your tokens (ERC20, ERC1155), ETH and act like a smart-wallet.
Solidity
30
star
7

testnet-fyi

Testnet as a service - create shareable short lived testnets
Python
28
star
8

cover-exploit

Solidity
28
star
9

zkSafe

Operate your Gnosis Safe with web2 accounts using Sismo zkConnect SSO
Solidity
24
star
10

bsc-hack-analysis-2022-10-06

Go
22
star
11

yIdleStrategies

Yearn v2 Strategies for Idle.finance
Solidity
20
star
12

zkml-community-calls

notes for community call for ZKML Community
19
star
13

gas-saver-deployer

A collection of smart contracts to save gas on Ethereum to deploy other contracts leveraging CHI tokens.
JavaScript
19
star
14

curve-whitehack-example

Example of the whitehack for Curve exploit 30/07/23
Solidity
18
star
15

jpbc

jPBC fork for get Maven works again
Java
15
star
16

revoke-safe-module

A Gnosis Safe Module to delegate to an another account to revoke on your behalf token allowances for an exploited address.
Solidity
14
star
17

gas-saver-gnosis-safe-module

A collection of smart contracts to save gas on Ethereum in a Gnosis Safe Wallet leveraging GST2 or CHI tokens
JavaScript
11
star
18

yearn-vaults-swap

Swap between Yearn Vaults V2
Solidity
10
star
19

idle-token-helper

Idle Token Helper is a collection of smart contracts to simplify interaction with Idle Protocol
Solidity
10
star
20

WrapX

Supercharge your NFTs with new behaviours and superpowers!
Python
9
star
21

ubi-strategy

Ubi Yearn V2 strategy
Python
9
star
22

zk-testnet-fyi

ZK Rollup as a Service - create shareable short lived zk rollups in 1-click!
Smarty
9
star
23

usdc-to-any-synths

Collection of smart contracts to swap between usdc and any Synthetix synths
Solidity
6
star
24

zkOIDC

Privacy-preserving sign-in with Sismo Connect via OpenID Connect
JavaScript
5
star
25

ubi-vaults-ui

UBI Vaults UI - forked with love from ape.tax
Vue
3
star
26

bonaDEX

Aave V2 limit repay order mechanism for long/short positions automated via Gelato Finance protocol
TypeScript
3
star
27

delegation-registry

A simple registry to facilitate delegation between accounts
Python
3
star
28

ethdns-fyi

Resolve ENS names and redirect to their IPFS content hash
TypeScript
2
star
29

risc0

[FORKED] RISC Zero is a zero-knowledge verifiable general computing platform based on zk-STARKs and the RISC-V microarchitecture.
C++
2
star
30

pathfinder-systemd

Starknet pathfinder configuration to run as systemd service
2
star
31

rentable-protocol

Rentable Protocol - smart contracts
Solidity
2
star
32

videoracle-protocol

Verify real-world events on-chain with video proofs
Solidity
1
star