Open c4-bot-5 opened 7 months ago
0xA5DF marked the issue as primary issue
TODO: severity
0xA5DF marked the issue as selected for report
0xA5DF marked the issue as satisfactory
Sustaining high severity because this is going to cause a loss of principal to other auctions
Lines of code
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/AuctionWithBuyoutLoanLiquidator.sol#L97
Vulnerability details
Impact
The function
settleWithBuyout()
is used to settle an auction with a buyout from the main lender. This lender needs to repay all other lenders and will receive the NFT collateral. Near the end of the function, thetriggerFee
is also paid to the auction originator. However, the funds used to pay this fee are taken directly from the contract balance, even though the main lender doesn't transfer these funds into the contract.As a result, if the auction contract balance is insufficient to cover the fee, the function will simply revert and prevent the main lender from buying out. In other cases where multiple auctions are running in parallel, the
triggerFee
will be deducted from the other auctions. This could lead to the last auctions being unable to settle due to insufficient balance.Proof of Concept
The function
settleWithBuyout()
is called before anyplaceBid()
so the funds is only from main lender. In thesettleWithBuyout()
, there are 2 transfers asset. One is to pay other lenders and one is to pay thetriggerFee
. As you can see in the code snippet, there is notriggerFee
transfer from sender to originator.Tools Used
Manual Review
Recommended Mitigation Steps
Consider using
safeTransferFrom()
to pay thetriggerFee
from the sender's address, rather than usingsafeTransfer()
to pay thetriggerFee
from the contract balance.Assessed type
Other