Closed code423n4 closed 1 year ago
Invalid, because fee setter function makes sure the values are set in a way that it wouldn't underflow.
TriHaz marked the issue as sponsor disputed
I mostly agree with the sponsor, but because of other reports concerning fees having an uncapped value, as well as this report pointing to the usage of unchecked
, I believe this report to be valid, but of Low Severity as it requires setting the fees to an unreasonable value, which can only be done by governance
L
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/588c84b7bb354d20cbca6034544c4faa46e6a80e/contracts/Trading.sol#L689-L810
Vulnerability details
Impact
When fee calculation underflow, the calculated fee value would be very huge. The fee could be at the value of max of uint 256.
Proof of Concept
both
_handleOpenFees
and_handleCloseFees
hanlde calcualtion inside the unchecked block. I believe that the protocol team is aware of the underflow/overflow and revert due to this.In case underflow happen, the fee value would shoot up to max of uint256.
in one of the case the blow line will be executed and the
_daoFeesPaid
would be max of unit256IStable(_tigAsset).mintFor(address(this), _daoFeesPaid);
minting for max uint256 would be meaningless.
Tools Used
Manual review
Recommended Mitigation Steps
It is suggested to check the each fee value for a max of some threshold limit. If it exceeds that limit, update the codes to set pre-determined value.