Language:

🔒 Safe Proxy Contract Attack Demo 🔒

Challenge: Identify and Prevent Proxy Contract Attacks

Educational Purpose Only - Attack Simulation

⚠️ Educational Purpose Warning

This demonstration is for educational purposes only, showcasing potential vulnerabilities in proxy contracts. Do not use these attack methods in real environments.

Real-World Case Study: Bybit Incident (February 2025)

On February 21, 2025, Bybit's Safe multisig wallet was compromised through a proxy contract attack. The attacker executed transaction 0x46deef...7882, which led to unauthorized access to the wallet.

Attack Analysis:

  • The attacker exploited the proxy contract's upgrade mechanism
  • A malicious implementation contract was deployed to gain control
  • The attack resulted in potential access to the wallet's assets

Transaction Verification Tool

You can use the Safe Transaction Verifier tool to analyze suspicious transactions:

  • Paste the transaction hash to decode the execution data
  • Review the actual function calls and parameters
  • Identify potential malicious patterns in proxy contract interactions

Attack Principle Explanation

  • Attackers modify the proxy contract's masterCopy through carefully crafted calls
  • The new masterCopy contains malicious code that can transfer assets from the proxy contract
  • Through the proxy contract's delegate call mechanism, attackers can execute malicious logic

Prevention Measures

  • Use UUPS or Transparent proxy patterns
  • Implement appropriate access control mechanisms
  • Carefully audit proxy contract logic and permission settings
  • Use audited proxy contract libraries

Step 1: Connect Wallet

Current Network: Not Connected

Wallet Status: Not Connected

Attack Tips

Before proceeding with the attack demonstration, please check the tips in the image . Pay special attention to the first parameter of the execTransaction function, as it contains crucial information for understanding the attack mechanism.

Attack Tips

Step 2: Attack Process Demonstration - Multi-signature Authorization

// 1. Construct execTransaction call data const signatures = "0xd0afef78a52fd504479dc2af3dc401334762cbd05609c7ac18db9ec5abf4a07a5cc09fc86efd3489707b89b0c729faed616459189cb50084f208d03b201b001f1f"; const data = "0xa9059cbb000000000000000000000000bdd077f651ebe7f7b3ce16fe5f2b025be29695160000000000000000000000000000000000000000000000000000000000000000"; // 3. Call execTransaction through proxy contract await proxy.execTransaction( TARGET_ADDRESS, 0, data, 1, 45746, 0, 0, "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", signatures );

Step 3: Transaction Observation

🔍 Find the TARGET_ADDRESS

Enter the TARGET_ADDRESS you found in the transaction:

← Back to Challenges