Normal Behavior: The withdrawAllFailedCredits function is intended to allow a user to withdraw their own funds that were credited to them after a failed refund or payment.
The Issue: The function contains two critical flaws. First, it lacks access control, allowing any attacker (msg.sender) to withdraw the credits of another user (_receiver). Second, it incorrectly resets the attacker's balance to zero instead of the victim's, which allows the victim's funds to be drained repeatedly by multiple attackers.
Likelihood:
The vulnerability will occur whenever a user's refund fails (creating a credit balance) and an attacker identifies that user's address. The exploit requires no special conditions or permissions.
Impact:
This flaw leads to the direct and permanent loss of user funds. Because the victim's balance is never decremented, the attack can be repeated until the entire credit balance is stolen.
Explanation: The Proof of Concept test first creates the vulnerable condition by using a special ToggleRefundBidder contract whose refund is designed to fail, causing funds to be credited. It then demonstrates that the fix is effective by showing that an attacker's attempt to withdraw the victim's credits is now correctly reverted with a "Not receiver" error.
Vulnerable Code: https://github.com/CodeHawks-Contests/2025-09-bid-beasts/blob/main/src/BidBeastsNFTMarketPlace.sol#L238-L247
Proof of Concept Test: https://github.com/Sagarchhetri83/2025-09-bid-beasts/blob/main/test/BidBeastsMarketPlaceTest.t.sol#L167-L205
Explanation: The fix remediates the vulnerability by adding a require(msg.sender == _receiver) check, which ensures only the owner of the credits can initiate a withdrawal. It also corrects the logic to zero out the _receiver's balance instead of the msg.sender's, preventing the replay attack.
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.