code-423n4 / 2021-11-fairside-findings

0 stars 0 forks source link

Missing SafeMath & SafeCasts #71

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

cmichel

Vulnerability details

Some calculations don't use SafeMath or do unsafe casts:

Examples:

Impact

Not using SafeMath could lead to under-/overflows in certain cases. It also makes it hard to reason about the code, as the reverts only happen at a place that is far from the original overflow/unsafe cast. Updating to a newer Solidity version will break a lot of the code.

Recommendation

Use SafeMath by default. Even if it seems like it's not needed in some places, it could still be that there is some code path that leads to issues that one didn't think of, or gets implemented in the future.

YunChe404 commented 2 years ago

58

pauliax commented 2 years ago

While many wardens submitted about potential overflow/underflow issues, none were able to provide a concrete attack path and examples of exploit. Nevertheless, I agree with the approach of better safe than sorry and SafeMath operations should be applied where possible or clearly documented why they are not needed, where there is a 100% certainty it will not cause any harm.

Grouping these issues together and assigning a severity of low. Marking this as a primary issue, as it contains the most general and concise description.