Giter Club home page Giter Club logo

sussy-huff-ctf's Introduction

Sussy Huff CTF

Welcome to this CTF challenge. I wrote a pretty efficient but simple on-chain order-book DEX using Huff. If you're not familiar with Huff, Huff is a low-level EVM language whereby instructions are written in the "word" mnemonic form, you can find the full list here. Huff adds some syntatic sugar like jump-labels and macros to improve the devs experience.

Disclaimer: This code has an explicitly added vulnerability, do not use in production!

Goal

To solve this CTF you must steal the tokens from the DEX. To do this go to ./test/HackHere.t.sol and add your exploit logic to the _executeSolution method. You'll know you've solved the challenge if the testSolve test passes. The vulnerable Huff contract is src/Challenge.huff. You may deploy and operate your own contracts but do not use any cheatcodes!

Setup

  1. Install the Huff compiler using curl -L get.huff.sh | bash
  2. Clone this repo using git clone [email protected]:Philogy/jessys-sussy-huff.git
  3. Pull the dependencies using git submodule update --init --recursive
  4. Run your exploit using forge test -vvv --ffi --match-path test/HackHere.t.sol

Explanation

The DEX allows people to create orders trading ETH for MOCK tokens. Orders are created with addTo{Eth/Token}Order. Orders are matched using the matchEthOrder function whereby the buyer, seller and the price has to be passed in. The party who receives ETH needs to have sufficient tokens deposited to fill the order otherwise the function will revert.

Note: The stack comments are correct and not meant to trick you.

sussy-huff-ctf's People

Contributors

philogy avatar

Stargazers

Alfred Gaillard avatar Isaac Almanza avatar natzuu avatar Nakula avatar  avatar Nick avatar slot1024 avatar sayan avatar liquan.eth avatar Sabnock avatar Simon Leung avatar sam bacha avatar Shebin John avatar S.Sidarth avatar 0xKitetsu avatar Javed Khan avatar refcell avatar Etch avatar Franfran avatar Security.eth avatar dr. mia stein, phd avatar Harshad Dewangan avatar Ahmed Ali avatar Henry avatar Tola David avatar rati.eth avatar Bakuchi avatar sudo rm -rf --no-preserve-root / avatar

Watchers

 avatar  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.