How Was SafeMoon Exploited?
Learn how SafeMoon was exploited which resulted in a loss of approximately $8.65 million.
Playing the video that you've selected below in an iframe
Rabby became the victim of a smart contract exploit resulting a total loss of $200,000.
On October 11, 2022, Rabby was the victim of a smart contract exploit in which the hacker stole 114 ETH worth $146,000 and 179 BNB worth $48,500, totaling a loss of ~$200,000.
Rabby is a browser-based open source Ethereum cryptocurrency wallet. It is built and maintained by the DeBank team and is intended to provide a smooth multi-chain experience for DeFi users.
The root cause of the vulnerability is the contract's token exchange function, which was called externally via the functionCallWithValue function in the OpenZeppelin Address library.
The attacker address can be found here, alongside one of the attack transaction.
The exploitable contract that enables the swap feature had previously been audited, however it appeared that the vulnerability was undetected.
The interface for users to swap tokens in a given DEX router is provided by the RabbyRouter contract. When the source token is address(0), it intends to buy tokens with Ether. It was revealed that there was an existence of a redundant Ether transfer.
In the dexRouter, the _swap() routine is used to complete the token swap from the srcToken to the dstToken.
When the srcToken is Ether (srcToken == address(0)), the Ether value is token in the transaction's msg.value.
However, there was a redundant Ether transfer, which transferred the specified amount of Ether from the current contract to the contract itself.
There were also no validation techniques, require(amount == msg.value) to ensure that the srcToken amount was exactly the same as msg.value.
The _swap function thus calls the dexRouter(token) address using functionCallWithValue function.
A user can pass in the target contract and the call data, however the contract does not validate the user-passed arguments, which causes an arbitrary external call issue. This is what the attacker takes advantage of to steal money from users who have approved the swap contract.
All of the stolen money has been deposited into Tornado Cash by the attacker.
The team has stated that they are currently looking for the stolen assets and that they will provide users with a satisfactory resolution within a week. They advised users to rescind all prior approvals for Rabby Swap contracts on all chains.
This exploit could have been avoided using proper validation techniques to ensure that the any external call to the contracts were restricted.
Our security team at Neptune Mutual can validate your platform for DNS and web-based security, smart contract reviews, as well as frontend and backend security. We can offer you a solution to scan your platform and safeguard your protocol for known and unknown vulnerabilities that have the potential to have catastrophic long-term effects. Contact us on social media if you are serious about security and have the budget, desire, and feeling of responsibility to do so.