The listOfferfunction is used to list Bidstock type using custom collateral rate in protectedmode settlement type. When user tries to list the offer using different collateral rate compared to the collateral rate set by pre-offer of the stock, the function fetches wrong deposit amount based on previous collateral rate.
The listOffer function is currently fetching an incorrect deposit amount due to the use of the wrong collateral rate. This issue arises in the context of offers with a Protected settlement type. The function uses OfferLibraries.getDepositAmount to calculate the deposit, but the collateral rate provided to this function is incorrect. It uses the collateral rate of pre-offer instead of using the collateral rate of what the user is listing the offer with.
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/PreMarkets.sol#L345-L362
Due to the above issue, if the takeris listing the offer with higher collateral rate, the offerInfoMapwill list the offer with higher collateral rate but collateral taken from takerwill be less than what needs to be taken. So, the userwho will be buying points from this listedoffer will have wrong impression that the offer have higher collateral deposited. If the taker then doesn't settle the offer, the buyer of points would be able to seize all the taker's collateral by calling closeBidTaker which will be determined at higher collateral rate but collateral deposited by the takerwould be less. This will lead to loss of funds for the protocol.
Manual review
Fix the following in listOfferfunction:
Valid high severity, because the collateral rate utilized when creating an offer is stale and retrieved from a previously set collateral rate, it allows possible manipilation of refund amounts using an inflated collateral rate to drain funds from the CapitalPool contract
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.