Giter VIP home page Giter VIP logo

damn-vulnerable-defi's Introduction

A set of challenges to learn offensive security of smart contracts in Ethereum.

Featuring flash loans, price oracles, governance, NFTs, lending pools, smart contract wallets, timelocks, and more!

Play

Visit damnvulnerabledefi.xyz

Disclaimer

All Solidity code, practices and patterns in this repository are DAMN VULNERABLE and for educational purposes only.

DO NOT USE IN PRODUCTION.

Solutions

Unstoppable

Since the UnstoppableLender contract contains the assertion assert(poolBalance == balanceBefore);, DVT can be transferred dirtectly to the contract causing this assertion to fail, breaking the contract.

Naive Receiver

Since there is a fee of 1 ETH paid each time a flash loan is taken, and anyone can call the flashloan function, the contact can be drained of all ETH by calling the flashloan function 10 times.

Truster

Since the flashLoan allows for calling any function, the approve function can be called on the DVT token allowing the attacker to withdraw any amount of DVT from the contract by using the ERC-20 transferFrom function.

Side Entrance

This challenge can be solved by taking a flash loan from the pool and depositing the loan back into the pool using the deposit function. This gives the contract that made the flashloan the ability to later withdraw this ETH. The flashloan will succeed as the ETH balance of the flashloan pool will be the same.

The Rewarder

Selfie

A governance proposal can be created in a flash loan that would call the drainAllFunds function (from the governance contract) that would transfer all funds to the attacker.

damn-vulnerable-defi's People

Contributors

steventhornton avatar tinchoabbate avatar mpetrone 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.