This is assuming the vulnerability mentioned with title is fixed:
Title: Incorrect Authorization Logic in settleAskTaker Function
Link: https://codehawks.cyfrin.io/c/2024-08-tadle/s/clzqqzg79000712ra6bf6pb95
The settleAskMaker
function in DeliveryPlace
contract has a critical issue where it inappropriately allows sellers operating in turbo mode to settle their offers and receive refunds, even when they have relisted their offer without any collateral. Turbo mode sellers, who do not post collateral, should not be allowed to settle and receive refunds in the same way as regular sellers. In turbo
mode, settlement needs to be done by original maker
.
The settleAskMaker
function does not distinguish between regular sellers and those operating in turbo mode. This allows turbo mode sellers, who relisted their offers without collateral, to settle their offers and receive refunds. This behavior is incorrect because turbo mode is designed to operate without collateral, and these sellers should not be able to settle in the same manner as collateralized offers.
https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/DeliveryPlace.sol#L276-L307
Scenario based POC:
Maker M1
creates ASK
offer to sell 1000 points for 1000 USDC
in Turbo mode
with some collateral 120% collateral rate
.
Taker T1
buys 1000 points for 1000 USDC
from M1
.
Taker T1
lists the offer for the stock he bought. He listed 1000 points for 1500 USDC
without any collateral.
Taker T2
buys 1000 points for 1500 USDC
from T1
's listed offer.
Owner
of marketplace updates the status to AskSettling
setting tge
time and tokenPerPoint as 1
.
Taker T2
calls settleAskMaker
and gets 1500 USDC
again which he hasn't even deposited.
Code POC:
setUp
function is also updated for a bit of clarity
Check the emitted log in the POC.
_makerRefundAmount
is 1800 USDC
which is added to taker T2
balance. 1800 USDC = 1500 * 120% collateral rate
Loss of funds for the protocol as user who hasn't supplied any collateral can claim full collateral from the protocol.
Manual review, foundry POC
Implement additional logic to detect whether the seller is operating in turbo mode. If the seller is in turbo mode and has relisted the offer without collateral, they should be prevented from settling the offer and receiving a refund.
Valid high severity, this allows resellers listing offers via `listOffer/relistOffer` to game the system. Based on the inherent design of Turbo mode not requiring takers making ask offers for the original maker offer to deposit collateral, the wrong refund of collateral to takers even when they did not deposit collateral due to turbo mode during settleAskMaker allows possible draining of pools.
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.