The goal of the protocol is to facilitate pre-market trading by allowing sellers to list points at their desired prices and enabling buyers to purchase these assets before their official launch. After the Token Generation Event (TGE), sellers are required to deliver the corresponding tokens to buyers at the pre-listed prices, ensuring that pre-market agreements are honored and enhancing overall market liquidity.
Sellers will receive their initial collateral back along with the buyer's funds only after completing the settlement.
Buyers will receive the equivalent tokens, and their funds will be transferred to the sellers.
If sellers fail to complete the settlement within the allotted time, they will forfeit their collateral.
Buyers can claim compensation from the seller’s collateral as stored in the smart contract.
The protocol currently allows sellers to withdraw buyer’s funds and tax fees before completing the settlement, which can lead to sellers avoiding their settlement obligations without losing their collateral, leaving buyers without compensation.
This issue arises because:
When a buyer purchases points, the amount (salesRevenue) and tax fee become immediately available for withdrawal to seller.
The createTaker function processes the deposit and tax fee transfer:
The _depositTokenWhenCreateTaker function transfers funds from the buyer to the capital pool.
The _updateTokenBalanceWhenCreateTaker function then enables the seller to withdraw the trade tax and deposit amount:
The ability for sellers to withdraw these funds before settlement means they can evade their obligations without any penalty, while buyers may not receive the tokens they paid for.
Scenario 1
Alice Creates an Ask Offer in Turbo Mode:
Collateral: 10,000 USDC
Points Listed: 1,000
collateral rate : 10_000 (so alice deposit exactly 10 000 usdc)
Bob Purchases Points:
Points Bought: 500
Collateral Reserved: 5,000 USDC
Dany Purchases Points:
Points Bought: 500
Collateral Reserved: 5,000 USDC
Alice Withdraws Funds:
Amount Withdrawn: 10,000 USDC + 300 USCD (taxFee)
Post-TGE Obligation :
Alice Must Settle: 500 points for Bob and 500 points for Dany.
Issue: If the value of 1,000 points in PointToken increases to 15,000 USDC after the TGE, Alice might choose not to settle her obligations. Having already withdrawn 10,300 USDC, she faces no penalty for failing to deliver the tokens and gains an additional 300 USDC. Meanwhile, Bob and Dany would not receive the tokens they paid for, and they would lose their tax fee and any potential compensation. This undermines the protocol’s integrity and leaves buyers unprotected.
working test case
Scenario 2
Alice Creates an Bid Offer in Turbo Mode:
Collateral: 10,000 USDC
Points Listed: 1,000
Bob Sell Points to alice :
Points sold: 1 000
Collateral Reserved: 10 000 USDC
Bob Withdraws Funds:
Amount Withdrawn: 10,000 USDC
The ability for sellers to withdraw buyer's funds and tax fees before completing the settlement poses a significant risk to the integrity of the Tadle protocol. This vulnerability allows sellers to evade their settlement obligations, leaving buyers without the tokens they paid for and without any form of compensation. This not only compromises the trustworthiness of the platform but also deters potential participants, reducing market liquidity and participation.
Restrict Withdrawal Before Settlement: Modify the smart contract to prevent sellers from withdrawing any funds, including the sales revenue and collateral, before they have successfully completed their settlement obligations or they aborted or canceled their offer.
example
Implement a new mapping and adjust the addTokenBalance function as follows :
In the withdraw function, add a check to enforce this restriction:
Update the withdrawAllowMap in the settlement function to allow users to withdraw their funds only after fulfilling their obligations. If a user fails to settle, they should be prevented from withdrawing any funds they are not allow to.
Valid high severity, given orginal offer makers are not a trusted entity to enforce a settlement. The trade tax set by the maker should be returned back to the takers to avoid abuse of abortion of ask offers to steal trade tax from takers. Note for appeals period: See issue #528 for additional details
Valid high severity, given orginal offer makers are not a trusted entity to enforce a settlement. The trade tax set by the maker should be returned back to the takers to avoid abuse of abortion of ask offers to steal trade tax from takers. Note for appeals period: See issue #528 for additional details
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.