Beosin: Analysis of the $8.5 million attack incident on the Platypus project on the Avalanche chain
According to ChainCatcher news, monitoring from Beosin EagleEye, a security risk monitoring, early warning, and blocking platform under the blockchain security audit company Beosin, shows that the Platypus project contract on the Avalanche chain has suffered a flash loan attack. The Beosin security team analyzed that the attacker first borrowed 44 million USDC through a flash loan and then called the deposit function of the Platypus Finance contract to stake, which would mint an equivalent amount of LP-USDC for the attacker. Subsequently, the attacker staked all LP-USDC into pool number 4 of the MasterPlatypusV4 contract, and then called the positionView function to calculate the borrowable balance using the _borrowLimitUSP function. The _borrowLimitUSP function returns a percentage of the value of the collateral staked by the attacker in MasterPlatypusV4 as the borrowing limit, allowing the attacker to mint a large amount of USP (profit point) through the borrow function.Due to the attacker having a large amount of debt (USP) from borrowing against LP-USDC, under normal logic, they should not have been able to withdraw the collateral. However, the emergencyWithdraw function check mechanism of the MasterPlatypusV4 contract had issues, only checking whether the user's borrowing amount exceeded their borrowLimitUSP (borrowing limit) without checking whether the user had repaid the debt, allowing the attacker to successfully withdraw the collateral (44 million LP-USDC).After repaying the 44 million USDC flash loan, the attacker was left with 41,794,533 USP, and then exchanged the profit in USP for various stablecoins worth $8,522,926.