{"id":16971,"date":"2023-02-18T04:01:43","date_gmt":"2023-02-18T04:01:43","guid":{"rendered":"https:\/\/nftandcrypto-news.com\/crypto\/platypus-attack-exploited-incorrect-ordering-of-code-auditor-claims\/"},"modified":"2023-02-18T04:01:45","modified_gmt":"2023-02-18T04:01:45","slug":"platypus-attack-exploited-incorrect-ordering-of-code-auditor-claims","status":"publish","type":"post","link":"https:\/\/nftandcrypto-news.com\/crypto\/platypus-attack-exploited-incorrect-ordering-of-code-auditor-claims\/","title":{"rendered":"Platypus attack exploited incorrect ordering of code, auditor claims"},"content":{"rendered":"
\n

The $8m Platypus flash loan attack was made possible because of code that was in the wrong order, according to a post mortem report from Platypus auditor Omniscia. The auditing company claims the problematic code didn\u2019t exist in the version they saw.<\/p>\n

\n

In light of the recent @Platypusdefi<\/a> incident the https:\/\/t.co\/30PzcoIJnt team has prepared a technical post-mortem analysis describing how the exploit unravelled in great details. <\/p>\n

Be sure to follow @Omniscia_sec<\/a> to receive more security updates!https:\/\/t.co\/cf784QtKPK pic.twitter.com\/egHyoYaBhn<\/a><\/p>\n

\u2014 Omniscia (@Omniscia_sec) February 17, 2023<\/a><\/p><\/blockquote>\n

According to the report, the Platypus MasterPlatypusV4 contract \u201ccontained a fatal misconception in its emergencyWithdraw mechanism\u201d which made it perform \u201cits solvency check before updating the LP tokens associated with the stake position.\u201d<\/p>\n

The report emphasized that the code for the emergencyWithdraw function had all of the necessary elements to prevent an attack, but these elements were simply written in the wrong order, as Omniscia explained:<\/p>\n

\u201cThe issue could have been prevented by re-ordering the MasterPlatypusV4::emergencyWithdraw statements and performing the solvency check after the user\u2019s amount entry has been set to 0 which would have prohibited the attack from taking place.\u201d<\/p><\/blockquote>\n

Omnisia admitted that they audited a version of the MasterPlatypusV4 contract from Nov. 21 to Dec. 5, 2021. However, this version \u201ccontained no integration points with an external platypusTreasure system\u201d and therefore did not contain the misordered lines of code. From Omniscia\u2019s point of view, this implies that the developers must have deployed a new version of the contract at some point after the audit was made.<\/p>\n

Related: <\/strong>Raydium announces details of hack, proposes compensation for victims<\/strong><\/p>\n

The auditor claims that the contract implementation at Avalanche (AVAX) C-Chain address 0xc007f27b757a782c833c568f5851ae1dfe0e6ec7 is the one that was exploited. Lines 582-584 of this contract appear to call a function called \u201cisSolvent\u201d on the PlatypusTreasure contract, and lines 599-601 appear to set the user\u2019s amount, factor, and rewardDebt to zero. However, these amounts are set to zero after the \u201cisSolvent\u201d function has already been called.<\/p>\n

<\/figure>\n

The Platypus team confirmed<\/a> on Feb. 16 that the attacker exploited a \u201cflaw in [the] USP solvency check mechanism,\u201d but the team did not initially provide further detail. This new report from the auditor sheds further light on how the attacker may have been able to accomplish the exploit.<\/p>\n

The Platypus team announced on Feb. 16 that the attack had occurred. It has attempted to contact the hacker and get the funds returned in exchange for a bug bounty. The attacker used flashed loans to perform the exploit, which is similar to the strategy used in the Defrost Finance exploit of Dec. 25.<\/p>\n<\/div>\n