The short analysis of the flashloan attack to the APE AirDrop

(pic is from The creators of Bored Ape Yacht Club unveil ApeCoin crypto token (

As reported by Will Sheehan, the APE token has been attacked by the MEVor. After the analysis, we think it’s due to the vulnerability that the AirDrop process of the APE token only considers the spot state, which can be manipulated by the attacker.

In particular, the attacker can borrow BYAC tokens that can be redeemed to NFTs, and then use these NFTs to claim the AirDrop. After that, the attacker mint the BYAC tokens using the BYAC NFTs to return the flashloan. However, the attacker got the AirDrop APE tokens through this process. We think this is similar to the flashloan based price manipulation attack, where a contract only consider the spot price of an asset (which can be manipulated.)

In the following, we will use the attack transaction to illustrate this process.

Step I: prepare the NFT for the fee of the flashloan

The attacker transferred 1060 NFT to the attack contract 0x7797. Note that, this NFT is not borrowed from the flashloan, but is brought with 106 ETH.

Step II: Borrow the BYAC tokens through flashloan

Step III: Use the NFTs to claim the APE tokens

Note that, during this process, the attacker has six NFTs. One is the 1060 he/she bought, and five ones that are redeemed using the borrowed BYAC tokens (in step II). In total, it gets 60,564 APE tokens.

Step IV: Mint the NFT to get BYAC tokens

The attacker minted the six NFTs to get the BYAC tokens. Note that, the attacker also minted his own NFT (1060) to pay the fees for flash loan. Since there are still BYAC tokens remained after paying back the flash loan (since he minted his own BYAC NFT 1060), the attacker swapped the remaining BYAC tokens for around 14 ETH.


In total, the attacker got 60,564 APE token, which worthed around 500K USD (at the time of writing this blog, the price of APE is $8 ). The cost is one NFT (106 ETH — 14 ETH), which is around 270K USD.


We think the issue here is that the AirDrop of APE token only considers the spot state that whether NFTs are hold by someone. This is fragile since the attacker can manipulate the spot state using flashloan. If the cost of the flashloan is smaller than the value of the AirDrop token, then it creates an attack opportunity that has shown in the attack.


Credit to Will Sheehan, who reported the transaction.

About BlockSec

The BlockSec Team focuses on the security of the blockchain ecosystem, and collaborates with leading DeFi projects to secure their products. The team is founded by top-notch security researchers and experienced experts from both academia and industry. The core founder of the team has been recognized as the Most Influential Scholar Award (Rank 4 from 2012–2021), in the field of security and privacy. They have published multiple blockchain security papers in prestigious conferences, reported several zero-day attacks of DeFi applications, and released detailed analysis reports of high impact security incidents.




A Blockchain Security and Data Company.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Aadhaar details Leaked for Rs 500

HTTP & Encryption — Securing the World Wide Web

Information Security Design

🥳 Say hello to VICA Token 🥳

How to hack a Web App {mini-series} Part 1: Footprinting a web infrastructure

What is CPS, why is it so radical?

{UPDATE} Bar Oasis 2 Aftertaste 01 LITE Hack Free Resources Generator

Enhance your privacy in Firefox with Temporary Containers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


A Blockchain Security and Data Company.

More from Medium

Flashloan Attack on APE Airdrop

LI.FI Attack: a Cross-chain Bridge Vulnerability? No, It’s Due to Unchecked External Call!

Introducing ERC1155D: The most efficient non-fungible token contract in existence.

Polygon stablecoin Qi Dao exploited for $13M ⚠️