When new higher bids are placed on an NFT in the market, the previous highest bidder is refunded and the new bidder becomes the highest bidder. If the transfer of funds fail, the protocol provides a means for user to withdraw their funds themselves, by calling the withdrawAllFailedCredits function, which essentialy tries to send to the intended _receiver. However there is logic error in that the balance of the passesd-in _receiver is queried instead of msg.sender. This enables user to receive an ether anount that belongs to another to another user, and essentially steal from the protocol.
Likelihood:
Reason 1 : It happens whenever any user wants to withdraw a failed credit
Impact:
Users can steal funds from the protocol
Users can wreck the protocol as the queried amount is never cleared and can be withdrawn until the protocol bankrupts.
The smart contract places a bid on an NFT
Reverts when refunded
and withdraw another user's amount which is more than it's owed
Place the following code in BidBeastsNFTMarketTest.t.sol
Refactor withdrawAllFailedCredits to reflect these changes:
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.