Code Monkey home page Code Monkey logo

ctf's Introduction

CTF - Capture the Flag

Ejercicios de Hackeo de Contratos Inteligentes

#1 Token Vulnerable

Objetivo:

  • El owner al publicar el contrato TokenVulnerable se hace acreedor de 100 millones de tokens.
  • Luego del ataque, el atacante attacker debe poseer 100 millones de tokens y el owner debe poseer cero
  • Modifica el archivo ./test/TokenVulnerable.js en la parte designada.
  • Añade los contratos necesarios para ejecutar el ataque.
  • Ejecuta el test npx hardhat test test/TokenVulnerable.js y debería pasar

Pistas:

  • delegatecall
  • storage layout

Testing:

npx hardhat test test/TokenVulnerable.js

#2 Camouflage

Objetivo:

  • El attacker es añadido a un whitelist y es la única cuenta en dicha whitelist.
  • Es posible hacer una transferencia del whitelist a otra cuenta que no tenga código.
  • El attacker debe lograr tener un balance superior a 10 NFTs.

Pistas:

  • Crea Dos
  • Reentrancy
  • Precomputación

Testing:

npx hardhat test test/Camouflage.js

#3 NotInvited

Objetivo:

  • No has sido invitado a la fiesta y por ello no estás en la lista blanca. Ve la manera de cómo incluirte.
  • Puedes postular como aplicante para participar de un sorteo para ingresar a la lista blanca. Sin embargo, no es lo tuyo esperar.
  • Ganas si el método success cuando es llamando por el attacker da como resultado true.

Pistas:

  • Storage slot position
  • Storage layout

Testing:

npx hardhat test test/NotInvited.js

#4 NaiveDonation

Objetivo:

  • Existe un contrato (NaiveDonation) que guarda una cantidad de Ether. Sin embargo, está mal resguardado.
  • Explota el mal patrón de autenticación usado para sustraer todo el balance de dicho contrato.
  • Asume que el owner del contrato NaiveDonation, mediante pishing, es convencido de donar 1 wei a una address cualquiera.
  • Ganas si el método success como resultado true.

Pistas:

  • tx.origin.
  • constructor

Testing:

npx hardhat test test/NaiveDonation.js

ctf's People

Contributors

leemarreros avatar

Stargazers

Sandy avatar Erick Carvajal R avatar

Watchers

 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.