Skip to content

Latest commit

 

History

History
52 lines (30 loc) · 2.59 KB

020.md

File metadata and controls

52 lines (30 loc) · 2.59 KB

Scruffy Chartreuse Wolverine

High

{A Malicious Bidder} will {Trap Funds} {for Previous Bidders}

Summary

The partial refund mechanism that does not handle failures in both ETH and WETH transfers will cause funds to become trapped for previous bidders as a malicious bidder will exploit the refund fallback to lock funds within the contract.

Root Cause

The choice to implement a two-tiered refund mechanism using _safeTransferETHWithFallback, which first attempts to refund via ETH and falls back to WETH upon failure, is flawed.

This design does not account for scenarios where both ETH and WETH transfers fail, leaving no alternative pathway for refunds.

Internal pre-conditions

  1. An active auction exists with a previous bidder who is due a refund.
  2. The previous bidder controls a smart contract that:
  • Reverts ETH transfers by failing the receive or fallback functions.
  • Rejects or fails WETH transfers, either intentionally or due to misconfiguration.

External pre-conditions

  1. The WETH contract remains operational and is not paused or compromised.
  2. The recipient's contract does not handle WETH transfers appropriately, causing them to fail.

Attack Path

  1. Attacker deploys a bidder contract that maliciously rejects ETH transfers
  2. The attacker uses this malicious bidder contract to place a bid, becoming the highest bidder in the auction.
  3. A legitimate user places a higher bid, triggering the refund process to the attacker’s MaliciousBidder contract.
  4. The _safeTransferETH function attempts to send ETH to the MaliciousBidder contract, which reverts the transaction.
  5. The fallback to WETH transfer also fails because the MaliciousBidder contract rejects WETH transfers.
  6. Both refund attempts fail, resulting in the refund amount being permanently locked within the auction house contract.

Impact

Funds intended for the previous bidder remain inaccessible.

Deploying a malicious contract that rejects ETH and WETH transfers is straightforward for an attacker. The auction contracts do not impose restrictions or validations on the recipient's ability to handle refunds, making the attack vector easily accessible.

PoC

No response

Mitigation

Transition from actively pushing refunds to maintaining a ledger of pending refunds that bidders can withdraw manually. This approach eliminates reliance on the recipient’s ability to accept ETH or WETH transfers, ensuring that refunds can always be retrieved by the rightful owners.