Please Read This First: https://tadle.gitbook.io/tadle/how-tadle-works/mechanics-of-tadle/protected-mode
In Protected Mode, all sellers, whether they are the original or subsequent ones, are required to deposit cryptocurrency as collateral
Read This Also: Transaction #3: Bob’s Relisting
: https://tadle.gitbook.io/tadle/how-tadle-works/mechanics-of-tadle/protected-mode#for-sell-offers
Bob, now a maker, lists the 500 points he purchased at a price of $1.10 per point and deposits $550 as collateral.
A critical issue has been identified where the system uses an outdated collateral rate during the calculation
of transfer amounts in transactions. Although users specify a new collateral rate when listing or relisting assets,
the system mistakenly calculates transferAmount using old collateralRate.
According to the Tadle documentation, during the process of relisting assets, the user can specify a new collateral rate _collateralRate.
For example, if Bob specifies a _collateralRate
of 15000, the system should use this rate for all subsequent calculations.
However, during the transfer amount calculation, the system erroneously uses the old collateral rate offerInfo.collateralRate, which may still be set at 10000. This incorrect rate is used for calculating the transferAmount
, leading to a miscalculation.
After the transaction, the offerInfoMap[offerAddr]
is updated with the new _collateralRate
15000.
This inconsistency results in a refund to the user based on the new collateral rate, causing discrepancies between the transferred amount and the refund.
POC: add this in file test/PreMarkets.t.sol
file: PreMarkets.sol
forge test --mt test_Wrong_CollateralRate -vvv
Result:
As we see the transferAmount is 1000000000000000000
which is wrong it should be 1500000000000000000
and this is the right amount for 15000 collateral rate.
The transferAmount will be calculated using outdated collateral rate, this will lead to incorrect collateral deposits and refunds.
But when it comes to refund the new collateralRate
15000 will be used.
Ensure that the transferAmount
calculation uses the new collateral rate specified by the user _collateralRate
rather than the old offerInfo.collateralRate
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.