The DeliveryPlace.closeBidTaker
function is used to allow the taker to receive the purchased point tokens after the maker's offer has been settled. However, there is a flow in the function that allows more point tokens to be created than the maker had put up for sale through the re-listing of the purchased tokens. As a result, after the offer is settled and closeBidTaker
is executed for the respective takers, the balance in the tokenManager
will show more point tokens than it should. Consequently, some users may be unable to withdraw the purchased tokens because there will not be enough available, or tokens intended for a different offer may be sent instead. Both cases lead to a loss of funds for users.
The problem stems from this line in the closeBidTaker
function where, if offerSettleType
is Protected
, usedPoints
are not taken into account as they are in turbo mode.
I am attaching a proof of concept (POC) that demonstrates the issue.
It can be seen that 800 points are initially created with the maker's offer but at the end of the test there are 1000 in the balances of the users.
Loss of funds for the users and profit for the exploiter.
Manual review
Get into consideration usedPoints like did for the turbo mode.
Valid high, regardless for turbo or protected mode, partial settlements are possible as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L286-L299). For protected mode, partial settlements are not accounted for, allowing more then intended points to be sent to users even when maker only performed a partial settlement Note for invalidation: Agree with the discussions above that this issue is invalid. Protected Mode is a step-by-step process. Example: > A created a purchase order for 800 points, B bought 300 points of it, and C bought 500 points of it. C re-listed 500 points, and D bought 200 points of them. > Settlement phase. A settles with B and C. C settles with D. A pays 800 point tokens, and C pays 200 point tokens to D, so the total Balance will have 1000 point tokens. Additionally, for any maker that does not settle, they will lose their original collateral posted in protected mode as it will force the admin to step in to settle.
Valid high, regardless for turbo or protected mode, partial settlements are possible as seen [here](https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/DeliveryPlace.sol#L286-L299). For protected mode, partial settlements are not accounted for, allowing more then intended points to be sent to users even when maker only performed a partial settlement Note for invalidation: Agree with the discussions above that this issue is invalid. Protected Mode is a step-by-step process. Example: > A created a purchase order for 800 points, B bought 300 points of it, and C bought 500 points of it. C re-listed 500 points, and D bought 200 points of them. > Settlement phase. A settles with B and C. C settles with D. A pays 800 point tokens, and C pays 200 point tokens to D, so the total Balance will have 1000 point tokens. Additionally, for any maker that does not settle, they will lose their original collateral posted in protected mode as it will force the admin to step in to settle.
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.