Skip to content

Ackee-Blockchain/gmx-exploit-scenario

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMX Exploit Scenario Testing with Wake Framework

This repository contains attack scenarios and example attack contracts related to the GMX protocol hack using the Wake testing framework. The scenarios are designed for educational and defensive security purposes only.

horizontal splitter

Prerequisites

  • Wake framework installed (pip install eth-wake)
  • Node.js and npm for dependency management

Setup Instructions

1. Clone and Initialize Submodules

First, clone the repository and initialize the GMX contracts submodule:

$ git submodule update --init --recursive

2. Install Dependencies

Navigate to the gmx-contracts directory and install the required npm packages:

$ cd gmx-contracts && npm i && cd ../

3. Configure Arbitrum RPC URL

Create a .env file and add your URL for Arbitrum mainnet.

We will use Alchemy this time which is free. To get your Alchemy API key:

  1. Sign up at Alchemy Dashboard
  2. Create a new app with Arbitrum Mainnet network
  3. Copy the HTTPS URL from your app dashboard
FORK_URL=https://arb-mainnet.g.alchemy.com/v2/your-api-key-here

4. Generate Python Type Definitions

Wake needs to generate Python type definitions from the Solidity contracts:

$ wake up pytypes

This command compiles the Solidity contracts and creates corresponding Python types for use in test scenarios.

5. Run the Exploit Scenarios

Run the exploit scenarios on the forked environment:

$ wake test

6. View Detailed Call Traces

To see detailed transaction call traces during the exploit scenarios, uncomment the print(tx.call_trace) line in the tests/test_attack_simple.py files, then run the tests again:

$ wake test

The call trace will show the complete execution flow of the exploit scenario, helping you understand how the vulnerability is triggered and its impact on the protocol.

horizontal splitter

Note: These scenarios are for defensive security analysis only. Do not use this code for malicious purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published