Grim Finance Hack
Incident Overview
Grim Finance's GrimBoostVault was exploited due to a reentrancy bug, allowing the attacker to mint large amounts of GB tokens and withdraw more SPIRIT-LP tokens than they deposited.
The attacker initiated the exploit by taking a flash loan from the Balancer vault in WBTC and WFTM tokens. They then added liquidity on SpiritSwap and minted LP tokens. The attacker exploited a reentrancy bug in the depositor () function in GrimBoostVault, using a malicious contract as the token parameter.
This allowed them to mint a large amount of GB tokens and withdraw more SPIRIT-LP tokens than they deposited. The attacker then removed liquidity, gaining more XXX and YYY tokens, and repaid the flash loan. The stolen funds were then bridged to Polygon, BSC, and Ethereum.
The attacker's address:
https://ftmscan.com/address/0xdefc385d…5b206c
The transaction behind the attack:
https://ftmscan.com/tx/0x19315e5b…4a5dd6
Affected vault:
https://ftmscan.com/address/0x660184ce…4136bf#code
The attacker's addresses on other chains:
https://etherscan.io/address/0xdefc385d…5b206c
https://polygonscan.com/address/0xdefc385d…5b206c
https://bscscan.com/address/0xdefc385d…5b206c
Incident Report
Protocol Information
Market Context at Time of Hack
What the Attacker Needed to Succeed
Understanding the prerequisites for this type of attack helps auditors identify protocols that are most at risk and helps developers build better defenses.
What Auditors Should Check
If you're auditing a protocol with similar architecture to Grim Finance, these are the critical security checks that could have prevented this incident (December 2021).
- Verify all logic paths related to Flashloan Reentrancy Attack / Reentrancy are guarded by proper access controls and input validation - see the Flash Loans Attacks attack class for patterns
- Check that all state-changing functions follow the Checks-Effects-Interactions (CEI) pattern to prevent reentrancy and logic ordering bugs
- Review privileged functions (owner, admin, governance) for potential abuse vectors - centralization risks should be documented and bounded with timelocks or multi-sigs
Master these auditing techniques with hands-on labs and real exploit scenarios in the Smart Contract Hacking course.
Free TrialRelated Attack Classes
The technique used in this hack maps to these vulnerability classes in our security curriculum:
Proof-of-Concept Exploits
On-Chain Evidence & References
Sources & References
Learn to Prevent the Next Grim Finance
The Grim Finance hack is one of many attacks that skilled auditors are trained to detect before deployment. Master real exploit patterns and defense techniques with hands-on Web3 security training.