Open code423n4 opened 1 year ago
minhquanym marked the issue as primary issue
0xRektora marked the issue as sponsor confirmed
dmvt marked the issue as selected for report
dmvt changed the severity to 2 (Med Risk)
Downgrading to medium because the amounts leaked / lost in the two reports are almost always very small.
Thanks for judging the contest!
I agree with the judge's comments
the amounts leaked / lost in the two reports are almost always very small.
but I think whether the unhandled amount is small depends on slippage + the leak of value can always happen
it is possible that in one transaction, a tiny amount of Surplus of collateral is not refunded, but in 10000 transaction, all surplus does not refund to user and the amount add up
so the leak value is relatively large as more user use the application
so I politely think the severity is high
I respect judge's final decision and will have no further dispute!
I disagree. The leak would almost certainly be noticed and the contract replaced before the values got very high. Medium stands.
Lines of code
https://github.com/Tapioca-DAO/tapioca-bar-audit/blob/2286f80f928f41c8bc189d0657d74ba83286c668/contracts/markets/bigBang/BigBang.sol#L394 https://github.com/Tapioca-DAO/tapioca-bar-audit/blob/2286f80f928f41c8bc189d0657d74ba83286c668/contracts/markets/bigBang/BigBang.sol#L417-L419
Vulnerability details
Impact
In both Singularity and BigBang, the remainder of removed collateral is never returned to the user in sellCollateral after repayment of the loan
Proof of Concept
A user can call sellCollateral with a bigger
share
than the amount she borrowed.The whole collateral share is first removed:
The swap determines the
shareOut
value, and then this condition is executed:Which means that only the part borrowed by the user is repaid, and the rest of asset obtained after swap only stays in
BigBang
. This means that the user actually lost the remainder of what was swapped, and the call does not revert unless the user is notsolvent
Tools Used
Manual review
Recommended Mitigation Steps
Add the surplus of asset to the balance of the user selling collateral
Assessed type
Other