Back to Blog

The Short Analysis of the Flashloan Attack to the APE AirDrop

Code Auditing
March 17, 2022
(pic is from The creators of Bored Ape Yacht Club unveil ApeCoin crypto token (lifestyleasia.com))
(pic is from The creators of Bored Ape Yacht Club unveil ApeCoin crypto token (lifestyleasia.com))

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 consider 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 flash loan 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 NFT 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.

Profit

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

Lessons

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

Credit to Will Sheehan, who reported the transaction.

About BlockSec

BlockSec is a pioneering blockchain security company established in 2021 by a group of globally distinguished security experts. The company is committed to enhancing security and usability for the emerging Web3 world in order to facilitate its mass adoption. To this end, BlockSec provides smart contract and EVM chain security auditing services, the Phalcon platform for security development and blocking threats proactively, the MetaSleuth platform for fund tracking and investigation, and MetaDock extension for web3 builders surfing efficiently in the crypto world.

To date, the company has served over 300 esteemed clients such as MetaMask, Uniswap Foundation, Compound, Forta, and PancakeSwap, and received tens of millions of US dollars in two rounds of financing from preeminent investors, including Matrix Partners, Vitalbridge Capital, and Fenbushi Capital.

Official website: https://blocksec.com/

Official Twitter account: https://twitter.com/BlockSecTeam

Sign up for the latest updates
Newsletter - April 2026
Security Insights

Newsletter - April 2026

In April 2026, the DeFi ecosystem experienced three major security incidents. KelpDAO lost ~$290M due to an insecure 1-of-1 DVN bridge configuration exploited via RPC infrastructure compromise, Drift Protocol suffered ~$285M from a multisig governance takeover leveraging Solana's durable nonce mechanism, and Rhea Finance incurred ~$18.4M following a business logic flaw in its margin-trading module that allowed circular swap path manipulatio

~$7.04M Lost: GiddyDefi, Volo Vault & More | BlockSec Weekly
Security Insights

~$7.04M Lost: GiddyDefi, Volo Vault & More | BlockSec Weekly

This BlockSec weekly security report covers eight attack incidents detected between April 20 and April 26, 2026, across Ethereum, Avalanche, Sui, Base, HyperLiquid, and MegaETH, with total estimated losses of approximately $7.04M. The highlighted incident is the $1.3M GiddyDefi exploit, where the attacker did not break any cryptography or use a flash loan but simply replayed an existing on-chain EIP-712 signature with the unsigned `aggregator` and `fromToken` fields swapped out for a malicious contract, demonstrating how partial signature coverage turns any historical signature into a generic permit. Other incidents include a $3.5M Volo Vault operator key compromise on Sui, a $1.5M Purrlend privileged-role takeover, a $413K SingularityFinance oracle misconfiguration, a $142.7K Scallop cross-pool index injection, a $72.35K Kipseli Router decimal mismatch, a $50.7K REVLoans (Juicebox) accounting pollution, and a $64K Custom Rebalancer arbitrary-call exploit.

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026
Security Insights

Weekly Web3 Security Incident Roundup | Apr 13 – Apr 19, 2026

This BlockSec weekly security report covers four attack incidents detected between April 13 and April 19, 2026, across multiple chains such as Ethereum, Unichain, Arbitrum, and NEAR, with total estimated losses of approximately $310M. The highlighted incident is the $290M KelpDAO rsETH bridge exploit, where an attacker poisoned the RPC infrastructure of the sole LayerZero DVN to fabricate a cross-chain message, triggering a cascading WETH freeze across five chains and an Arbitrum Security Council forced state transition that raises questions about the actual trust boundaries of decentralized systems. Other incidents include a $242K MMR proof forgery on Hyperbridge, a $1.5M signed integer abuse on Dango, and an $18.4M circular swap path exploit on Rhea Finance's Burrowland protocol.

Best Security Auditor for Web3

Validate design, code, and business logic before launch. Aligned with the highest industry security standards.

BlockSec Audit