HACK ANALYSIS 2 min read

MRP Token Hack Analysis


MRP Token Hack Analysis

Overview:

On July 2, 2024, the MRP Token contract fell victim to a re-entrancy attack, resulting in the loss of 17 BNB.

Smart Contract Hack Overview:

Fig: Attack Transaction

Decoding the Smart Contract Vulnerability:

  • The root cause of the issue is the lack of a reentrancy check in the victim contract.
  • This vulnerability allowed the hacker to exploit the contract by repeatedly calling the receive() function within the _transfer() function, thereby accumulating a large amount of MRP tokens.
  • As a result, the hacker was able to drain all the BNB from the victim contract.
Fig: Attack Flow

Mitigation and Best Practices:

  • Implementing a reentrancy check would have prevented the hacker from repeatedly invoking the receive() function and exploiting the contract.
  • Always validate your code by writing comprehensive test cases that cover all the possible business logic.
  • To prevent such vulnerabilities, the best Smart Contract auditors must examine the Smart Contracts for logical issues. We at CredShields provide smart contract security and end-to-end security of web applications and externally exposed networks. Schedule a call at https://credshields.com/
  • Scan your Solidity contracts against the latest common security vulnerabilities with 130+ detections at SolidityScan
Fig: SolidityScan — Smart Contract Vulnerability Scanner

Conclusion:

SolidityScan is an advanced smart contract scanning tool that discovers vulnerabilities and reduces risks in code. Request a security audit with us, and we will help you secure your smart contracts. Signup for a free trial at https://solidityscan.com/signup

Follow us on our Social Media for Web3 security-related updates.
SolidityScan — LinkedIn | Twitter | Telegram | Discord