withdrawAllFailedCredits Allows Theft of Arbitrary User FundsThe contract includes a mechanism to credit users whose ETH transfers fail. The withdrawAllFailedCredits function is intended to let users withdraw these credits.
The function incorrectly uses _receiver to determine which balance to withdraw but uses msg.sender as the recipient and the address to clear credits for. This allows an attacker (msg.sender) to specify a victim (_receiver) and drain their failed transfer credits. The victim's credit balance is never cleared, allowing the attacker to repeat the theft.
Likelihood: High
The function is public and can be called directly by any address.
An attacker can monitor the contract for failedTransferCredits balances to appear and immediately exploit the vulnerability.
Impact: High
Direct theft of funds: Any funds accrued in the failedTransferCredits mapping are directly at risk of being stolen.
Consider the following test case:
Consider the following fix:
withdrawAllFailedCredits allows any user to withdraw another account’s failed transfer credits due to improper use of msg.sender instead of _receiver for balance reset and transfer.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.