Whale Loans Hack
Incident Overview
Whale Loans was exploited due to K-check of the WhaleSwap Finance Pair contract. When a user swaps, there is an issue with the magnitude of the parameters passed in.
The attacker flashloaned BSC-USD and then returns flashloan with a K-check parameter in function swap() contract WhaleswapPair.sol of magnitude 10000^4. However, the K-check takes a parameter of magnitude 10000^2, which causes the K-check to fail.
Exploiter address: https://bscscan.com/address/0xd793ff8d…bf7a50
Attack transaction: https://bscscan.com/tx/0x9f5b02cb…0ebab3
Attacker contract: https://bscscan.com/address/0xf9553675…29385f
Victim address: https://bscscan.com/address/0x8bfee2ca…e76794
Incident Report
Protocol Information
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 Whale Loans, these are the critical security checks that could have prevented this incident (June 2022).
- Verify all logic paths related to Other are guarded by proper access controls and input validation
- 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 TrialSecurity Audit History
- BlockSec Report
Sources & References
Learn to Prevent the Next Whale Loans
The Whale Loans 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.