Code Monkey home page Code Monkey logo

audius's Introduction

welcome to unhacked

unhacked is a bi-weekly ctf, giving whitehats the chance to go back in time before real exploits and recover funds before the bad guys get them.

you are a whitehat, right anon?

meet audius

audius is a streaming music service with a market cap of over $250mm.

in july, they were hacked and their treasury was emptied of all its $AUDIO tokens.

the simple soundbite is that there was a storage slot collision with a proxy contract that allowed reinitialization of existing contracts. since all of the contracts are behind a proxy, this collision meant that the initialize() function of all contracts could be called any time.

but how can we exploit this vulnerability to drain the treasury?

your job is to use this knowledge, dig into the code, and empty the treasury of over 18mm $AUDIO tokens before the blackhat does.

how to play

  1. fork this repo and clone it locally.

  2. add a mainnet RPC url into test/AudiusHack.t.sol so that the tests are able to fork mainnet from block 15201700.

  3. review the code in the src/ folder, which contains all the code at the time of the hack. you can explore the state of the contract before the hack using block 15201700. ex: cast call --rpc-url ${ETH_RPC_URL} --block 15201700 0x4DEcA517D6817B6510798b7328F2314d3003AbAC "getGuardianAddress()"

  4. if you get stuck, there are a few helpful resources. first, try reading this post mortem from the audius team. if you need more hints, check out the audius exploiter's history on etherscan (you may want to try decompiling the bytecode of the contracts they deployed).

  5. when you find an exploit, code it up in AudiusHack.t.sol. the test will pass if you succeed.

  6. post on twitter for bragging rights and tag @unhackedctf. first correct answer gets a spot on the leaderboard. no cheating.

solution

this contest is no longer live. you can read a write up of the solution here or find the solution code in the test folder.

subscribe

for new weekly challenges and solutions, subscribe to the unhacked newsletter.

audius's People

Contributors

zobront avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

audius's Issues

Challenge source code does not have the vulnerability

Currently, after commit a16fa8d, the challenge is not actually solvable, because of this.

As a suggestion, go back the commit history, then try solving this one.

I kept banging my head against the wall trying to find the storage collision as articles kept stating that it's supposed to be at slot #0, but I could clearly see that it was not.

Then I looked at the code. :-|

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.