Closed c4-bot-9 closed 10 months ago
https://github.com/code-423n4/2023-11-shellprotocol/blob/485de7383cdf88284ee6bcf2926fb7c19e9fb257/src/ocean/Ocean.sol#L196
The protocol does not handle when Ocean.changeUnwrapFee() sets unwrapFeeDivisor = 0 gracefully.
unwrapFeeDivisor = 0
When setting unwrapFeeDevisor = 0, the function Ocean._calculateUnwrapFee() will revert due to a division by 0.
unwrapFeeDevisor = 0
This function is used in the callstacks related to:
Note that users will still be able to wrap tokens as the contract only accumulates dust from rounding on these transactions.
Either prevent changeUnwrapFee from setting a value of 0 or gracefully handle a zero in callstacks where the _calculateUnwrapFee() function is used.
changeUnwrapFee
_calculateUnwrapFee()
Invalid Validation
raymondfam marked the issue as insufficient quality report
raymondfam marked the issue as duplicate of #27
0xA5DF marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-11-shellprotocol/blob/485de7383cdf88284ee6bcf2926fb7c19e9fb257/src/ocean/Ocean.sol#L196
Vulnerability details
Impact
The protocol does not handle when Ocean.changeUnwrapFee() sets
unwrapFeeDivisor = 0
gracefully.When setting
unwrapFeeDevisor = 0
, the function Ocean._calculateUnwrapFee() will revert due to a division by 0.This function is used in the callstacks related to:
Note that users will still be able to wrap tokens as the contract only accumulates dust from rounding on these transactions.
Recommended Mitigation Steps
Either prevent
changeUnwrapFee
from setting a value of 0 or gracefully handle a zero in callstacks where the_calculateUnwrapFee()
function is used.Assessed type
Invalid Validation