A critical vulnerability has been identified in the PreMarkets and DeliveryPlace contracts, specifically in the abort process for Turbo Mode offers. This vulnerability can lead to permanent locking of funds in partial abort scenarios, with no user-accessible mechanism to retrieve the locked collateral.
The vulnerability arises from the interaction between the abortAskOffer function in the PreMarkets contract and the settlement processes in the DeliveryPlace contract, specifically for Turbo Mode offers.
In Turbo Mode, the original offer creator deposits collateral for the entire offer, while subsequent takers can trade without additional collateral.
The abortAskOffer function in PreMarkets calculates a refund based on the remaining amount of the offer:
After calculating the refund, it sets the offer status to Settled:
Any function in the contract suite that allows for the retrieval of the remaining collateral needs for the OfferStatus to be either Virgin or canceled.
Users can permanently lose access to a portion of their collateral in partial abort scenarios. This could potentially amount to significant sums depending on the offer size and the aborted portion.
Alice creates a Turbo Mode Ask offer for 1,000,000 points at 1 USDC each, depositing 1,100,000 USDC as collateral (110% collateral rate).
Bob takes 500,000 points without depositing additional collateral.
Alice attempts to abort the offer.
The abort function calculates the refund based on the remaining 500,000 points, potentially refunding Alice only half of her original collateral.
The other half of the collateral remains locked in the contract, as there's no mechanism to return it to Alice or distribute it to Bob (who didn't deposit any collateral).
the following poc shows that the refundedAmount is less than the collateralAmount put by Alice (user)
Manual Review, Foundry
Modify the abortAskOffer
function to handle partial aborts in Turbo Mode correctly.
Valid high, for cancelled offers, the unused collateral should be returned back to the maker. The `remainingAmount` is calculated wrongly with regards to usedPoints instead of unused points. Note: See comments under 826 and 907 for invalidation reasons
Valid high, for cancelled offers, the unused collateral should be returned back to the maker. The `remainingAmount` is calculated wrongly with regards to usedPoints instead of unused points. Note: See comments under 826 and 907 for invalidation reasons
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.