Open code423n4 opened 3 years ago
The finding is valid, there are conditions that would cause feePct
to be greater than BASE
The conditions to trigger this seem to be:
Because this can happen under specific conditions, I will grade this finding as medium severity:
I would highly recommend the sponsor to consider the possibility of capping the licenseFee
to make it easier to predict cases in which the operation can revert
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-09-defiProtocol/blob/main/contracts/contracts/Basket.sol#L110-L129
timeDiff * licenseFee
can be greater thanONE_YEAR
whentimeDiff
and/orlicenseFee
is large enough, which makesfeePct
to be greater thanBASE
so thatBASE - feePct
will revert on underflow.Impact
Minting and burning of the basket token are being disrupted until the publisher update the
licenseFee
.Proof of Concept
licenseFee
of1e19
or 1000% per year and mint 1 basket token;mint
andburn
reverts athandleFees()
.Recommended Mitigation Steps
Limit the max value of
feePct
.