/ApeCoinAirdropExploit

this is to replay the apecoin airdrop exploit in this tx - https://etherscan.io/tx/0xeb8c3bebed11e2e4fcd30cbfc2fb3c55c4ca166003c7f7d319e78eaab9747098

Primary LanguageSolidity

ApeCoin airdrop exploit demo

This is a demo to replay the ApeCoin airdrop exploit happened on Mar-17-2022.

The target tx is https://etherscan.io/tx/0xeb8c3bebed11e2e4fcd30cbfc2fb3c55c4ca166003c7f7d319e78eaab9747098/advanced

Installation & Run

npm install
npx hardhat run scripts/execute.js

Explanation

NFTX is a nft marketplace that allow user to trade NFT fractionally with a dedicated ERC20 token. The protocol also support flash loan which is also the main result to make this exploit possible

  1. exploiter transfer 1 of his own BAYC to the contract
  2. exploiter flashloan 5.2 bayc token from a NFTX Vault. (it is 5.2 because redeeming a BAYC nft require extra fee which make it 1.04 bayc token for 1 BAYC nft)
  3. exploiter redeem 5 BAYC NFT with 5.2 bayc token
  4. exploiter claim 60564 ApeCoin with 6 BAYC
  5. exploiter mint 5.4 bayc token with 6 BAYC (it is 5.4 because there is 10% minting fee which make it 0.9 bayc token minted per BAYC nft)
  6. exploiter return the 5.2 flashloan amount and swap the remaining 0.2 bayc token to 14.15 ETH

The exploit final gain will be 60564 ApeCoin + 14.15 ETH - the cost of his own BAYC NFT - gas fee

Disclaimer

This codebase is for demonstration purposes only

License

MIT