In this repository, I try to perform a mainnet fork and then simulate popular smart contract exploits on various DEFI Protocols using Hardhat Framework.

Overview

defiHacks_via_Hardhat

1. Alchemix Access Control Bug

Any user could have called setWhitelist() to give an attacker the ability to call the harvest function or to call the flush function. While these two actions are relatively harmless, an attacker could also front-run the intended keeper addresses to block harvest() and flush() from being called, effectively causing a denial of service.

Reference - https://medium.com/immunefi/alchemix-access-control-bug-fix-debrief-a13d39b9f2e0

2. 88mph Function Initialization Bug

The init() function used to initialize the NFT contract on 88mphโ€™s platform, was missing an onlyOwner modifier, and there was also no initializer modifier to prevent a re-initialization as well. This vulnerability would have allowed a malicious attacker to have access to any userโ€™s NFTs and deposits via burn() and mint() functions.

Note: The blockNumber of the hardhat config is set a block where in one of the NFT was minted.

Reference - https://medium.com/immunefi/88mph-function-initialization-bug-fix-postmortem-c3a2282894d3

3. CoinstoreNFT Public Burn Bug

The burn() function present in the ERC721 standard which destroys the token and removes it from blockchain is missing proper access control. As a result, this function can be called by anyone.

Reference - https://twitter.com/BlockSecTeam/status/1543928537882714112

4. FlippazOne Missing Access Control

The ownerWithdrawAllTo() function is missing the onlyOwner modifier check. Additionally, the check of whether the auction is over is also missing. As a result, any user can call the function and drain all the funds. Be sure to check out the tweet linked below to understand more about what happend - when one of the user sent the transaction to the public mempool.

Reference - https://twitter.com/bertcmiller/status/1544496577338826752

Special Mentions

https://twitter.com/immunefi

https://twitter.com/AshiqAmien

You might also like...

A collection of Revolt hacks, exploits & tools that is completely made using NodeJS.

ZeroRevolt A collection of Revolt hacks, exploits & tools that is completely made using NodeJS Tools Name Description userInformation Grab's the speci

Aug 4, 2022

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

This project will be using various AI and Rule Engine algorithm to detect various attack against a company!

๐Ÿ“Œ Introduction This project will be using various AI and Rule Engine algorithm to detect various attack against a website! ๐Ÿ“Œ Mission After starting

Apr 29, 2022

A Typescript Hardhat-based template to develop evm-based smart contracts with all the tooling you need.

EVM-based Smart Contract Scaffold A Typescript Hardhat-based template to develop evm-based smart contracts with all the tooling you need. Features Use

Oct 24, 2022

A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable

A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable

JavaScript Iteration protocol workshop A workshop about JavaScript iteration protocols: iterator, iterable, async iterator, async iterable by @loige.

Dec 20, 2022

Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Citizens App (web3-react-redux) React application based on smart contract using web3 and MetaMask extention. Start the applicarion Recomend to install

Aug 25, 2022

Connect your Ethereum smart contract to any real world API using the oracle pattern!

Minimal Viable Oracle (MVO) - An effective way to Build your own oracle with Solidity Smart contracts cannot access off-chain data directly. This repo

Aug 25, 2022

Services, Checkers and Exploits from saarCTF 2022

saarCTF 2022 Services from saarCTF 2022. Building services Enter a service directory and use docker-compose, e.g.: cd bytewarden docker-compose up --b

Dec 7, 2022

Prototype Pollution exploits collection

Prototype Pollution Exploits Intro This repository is a collection of exploits for Prototype Pollution vulnerability. If you're not familiar with the

Dec 10, 2022
Owner
null
Groth16 proofs are very popular and are used by many protocols in production.

Geometry presents: the Groth16 Malleability Challenge Preamble Groth16 proofs are very popular and are used by many protocols in production. Libraries

Geometry 39 Dec 14, 2022
A hardhat solidity template with necessary libraries that support to develop, compile, test, deploy, upgrade, verify solidity smart contract

solidity-hardhat-template A solidity hardhat template with necessary libraries that support to develop, compile, test, deploy, upgrade, verify solidit

ChimGoKien 4 Oct 16, 2022
This Next.js app is designed to be used with the Figment Learn Pathways, to help developers learn about various blockchain protocols such as Solana, NEAR, Secret, Polygon and Polkadot!

???? What is learn-web3-dapp? We made this decentralized application (dApp) to help developers learn about Web 3 protocols. It's a Next.js app that us

t0nto 8 Oct 1, 2022
Foundry-Hardhat plugins: Use Foundry for Hardhat projects

This repo contains hardhat plugins to use foundry tools in hardhat environments. Installation See in each plugin anvil forge foundryup Documentation F

Foundry 77 Nov 3, 2022
This repository contains the Solidity smart contract of Enso, a detailed list of features and deployment instructions.

Enso NFT Smart Contract This repository contains the Solidity smart contract of Enso, a detailed list of features and deployment instructions. We stro

enso NFT 3 Apr 24, 2022
Solana blockchain candy machine app boilerplate on top of Metaplex Candy Machine. NextJS, Tailwind, Anchor, SolanaLabs.React, dev/mainnet automation scripts.

NFT Candy Factory NOTE: This repo will prob only work on unix-based environments. The NFT Candy Factory project is designed to let users fork, customi

Kevin Faveri 261 Dec 30, 2022
A generative engine that takes various png layers on a sprite sheet format, combines them and then converts them into a .gif file

Welcome to the Generative GIF Engine v2.0.4 ?? [8 minute read] This python and node app generates layered-based gifs to create NFT gif art! It is fast

Jalagar 112 Jan 2, 2023
A generative engine that takes various png layers on a sprite sheet format, combines them and then converts them into a .gif file

Welcome to the Generative Animated Engine v3.0.1 ?? [8 minute read] This repo used to be called jalagar/Generative_Gif_Engine but because it now suppo

Jalagar 47 May 24, 2022
SmartBuilder: A Block-based Visual Programming Framework for Smart Contract Development

SmartBuilder A Block-based Visual Programming Framework for Smart Contract Development Technology stack used SmartBuilder Framework - Google Blockly A

ibelab 4 Mar 29, 2022
A collection of Discord hacks & exploits that is completely made using NodeJS.

ZeroDiscord A collection of Discord hacks & exploits that is completely made using NodeJS Before using any of these tools First off, all of the tools

OTAK 130 Jan 5, 2023