Open code423n4 opened 1 year ago
Best because it has a simple POC and is concise
GalloDaSballo marked the issue as primary issue
We are aware of that, we are not planning on adding any token that has more than 18 dec.
TriHaz marked the issue as sponsor acknowledged
The Warden has shown how, due to an underflow, the system in-scope can revert when using tokens with more than 18 decimals.
Because of how scope was defined, I believe the finding to be valid, I believe a nofix is acceptable as long as the sponsor keeps in mind this risk.
Because of the risk shown, I agree with Medium Severity
GalloDaSballo marked the issue as selected for report
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/Trading.sol#L650 https://github.com/code-423n4/2022-12-tigris/blob/main/contracts/Trading.sol#L675
Vulnerability details
Impact
In
Trading.sol
a deposit or withdrawal of tokens with decimals higher than 18 will always revert.This is the case e.g. for
NEAR
which is divisible into 10e24yocto
Proof of Concept
Change 00.Mocks.js#L33 to:
Then in 07.Trading.js:
are going to fail with:
Tools Used
Visual Studio Code
Recommended Mitigation Steps
Update calculations in the contract to account for tokens with decimals higher than 18.