本文へ移動
Contact

TECHFUND
Media

Hi AUDIT
2024/7/16

MRP token Hack Analysis

On July 2, 2024, the MRP token on the Binance Smart Chain (BSC) faced a significant exploit. The wrapped-token contract, WMRP, fell victim to a reentrancy vulnerability, resulting in a loss of approximately 17 BNB. This blog post breaks down how the attack occurred and what we can learn from it

Attacker Address

[0x132d9bbdbe718365af6cc9e43bac109a9a53b138](https://bscscan.com/address/0x132d9bbdbe718365af6cc9e43bac109a9a53b138)

*Attack Transaction:*

[0x4353a6d37e95a0844f511f0ea9300ef3081130b24f0cf7a4bd1cae26ec393101](https://bscscan.com/tx/0x4353a6d37e95a0844f511f0ea9300ef3081130b24f0cf7a4bd1cae26ec393101)

*Vulnerable Contract (WMRP):*

[0x35f5cef517317694df8c50c894080caa8c92af7d](https://bscscan.com/address/0x35f5cef517317694df8c50c894080caa8c92af7d)

Exploit Analysis

The exploit targeted a flaw in the WMRP contract during the removal of liquidity. Here’s a step-by-step breakdown of the attack:

1. The attacker exploited a reentrancy vulnerability in the WMRP contract. This type of vulnerability allows the attacker to repeatedly call a function before the previous executions are completed.

2. When the WMRP contract attempted to remove liquidity, it triggered the attacker's fallback function. This function is automatically called when a contract receives funds, allowing the attacker to manipulate the process.

3. The issue stemmed from the _removeLiquidity function within the transfer function. The attacker transferred the WMRP token to themselves with a value of 0, triggering the reentrancy vulnerability.

4. By hooking into the transfer function, the attacker was able to re-enter the contract’s receive function. This allowed them to transfer BNB back to the WMRP contract, exploiting the system to obtain more MRP tokens than allowed.

5. Ultimately, the attacker drained all the BNB from the WMRP contract by continuously exploiting the transfer function flaw.

 Conclusion

By analyzing this exploit, we hope to raise awareness about similar vulnerabilities in the DeFi ecosystem. Sharing these insights can help the web3 community identify and mitigate such risks in future projects, thereby enhancing overall security and robustness.

Understanding these attack vectors is crucial for developers and security researchers. It highlights the importance of thorough contract audits and implementing secure coding practices to prevent reentrancy and other common vulnerabilities.

Together, we can build a safer and more resilient DeFi ecosystem.

Read more About Pike Finance Exploit $1.6 million

Author : Piyush shukla

Hi AUDIT

Hi AUDIT is a high speed, high quality, best price security audit service, providing automated audit SaaS and consulting for web3 startups.
View More