BidBeastsNFTMarketPlace::withdrawAllFailedCredits may result in loss of fundsThis function is intended to manage failed payouts, enabling the recipient—or even third parties—to invoke it later on to withdraw bid funds back to the rightful owner. That owner would be someone who had previously submitted a bid but got overridden by a higher one from another bidder.
That said, there's a coding mistake where msg.sender is used instead of what should be _reciever. This opens the door for funds to be claimed by unauthorized parties, not just the legitimate recipient. And since the function is marked as external, literally anyone can call it.
Likelihood: High
Reason 1:
It's incredibly straightforward for anyone to invoke the withdrawAllFailedCredits function, given its external visibility.
Reason 2:
An attacker simply has to check the failedTransferCredits state or the second-most-recent BidPlaced event.
Impact: High
Impact 1:
All funds belonging to the rightful recipients could be drained away by the attacker.
Impact 2:
The protocol may face significant hurdles in recovering or refunding these lost assets.
This Foundry test demonstrates a critical security vulnerability in the function where any attacker can steal funds intended for legitimate bidders.
Output:
Replace msg.sender with _receiver in two places in the function.
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.