When specific input values are used, these functions can produce incorrect results due to exceeding the representation range of the int256 data type. This can lead to inaccurate debt calculations, which might cause financial discrepancies or issues in the application.
Lines of code
https://github.com/open-dollar/od-contracts/blob/v1.5.5-audit/src/contracts/proxies/actions/BasicActions.sol#L58-L65
Vulnerability details
Impact
When specific input values are used, these functions can produce incorrect results due to exceeding the representation range of the int256 data type. This can lead to inaccurate debt calculations, which might cause financial discrepancies or issues in the application.
Proof of Concept
_coinAmount / _rate equals 2.5. When we cast 2.5 to int256, it becomes 2. This is a loss of precision.
This example has equivalent variations,It can happen at any time in this financial system and if this problem is not fixed, losses will result.
Tools Used
VSCode
Recommended Mitigation Steps
Assessed type
Math