code-423n4 / 2023-11-shellprotocol-findings

7 stars 7 forks source link

owner can brick unwrapping by setting unwrap devisor = 0 #262

Closed c4-bot-9 closed 10 months ago

c4-bot-9 commented 10 months ago

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

c4-pre-sort commented 10 months ago

raymondfam marked the issue as insufficient quality report

c4-pre-sort commented 10 months ago

raymondfam marked the issue as duplicate of #27

c4-judge commented 10 months ago

0xA5DF marked the issue as unsatisfactory: Invalid