Platform: Code4rena
Start Date: 23/06/2023
Pot Size: $60,500 USDC
Total HM: 31
Participants: 132
Period: 10 days
Judge: 0xean
Total Solo HM: 10
Id: 254
League: ETH
Rank: 59/132
Findings: 2
Award: $119.28
🌟 Selected for report: 0
🚀 Solo Findings: 0
109.3508 USDC - $109.35
The getBadCollateralRatio
function may lead to a potential underflow if vaultSafeCollateralRatio[pool]
is not set before performing the subtraction. This issue can result in unexpected behavior and compromise the correctness of the calculations.
vaultSafeCollateralRatio[pool]
is not set (i.e., equals zero), subtracting 1e19
from it can result in an underflow.To demonstrate the issue, consider the following scenario:
vaultSafeCollateralRatio[pool]
is not set, resulting in a value of zero.In this scenario, when executing the function, the subtraction vaultSafeCollateralRatio[pool] - 1e19
will result in an underflow, producing a potentially large and incorrect value as the return. The function execution will revert.
Manual review
To address this issue, it is recommended to perform a check to ensure that vaultSafeCollateralRatio[pool] is not zero before performing the subtraction.
Under/Overflow
#0 - c4-pre-sort
2023-07-11T17:25:37Z
JeffCX marked the issue as duplicate of #926
#1 - c4-judge
2023-07-28T15:36:05Z
0xean marked the issue as satisfactory
🌟 Selected for report: 0xnev
Also found by: 0xRobocop, 0xbrett8571, 0xkazim, 0xnacho, 3agle, 8olidity, ABAIKUNANBAEV, Bauchibred, Co0nan, CrypticShepherd, D_Auditor, DelerRH, HE1M, Iurii3, Kaysoft, MrPotatoMagic, RedOneN, RedTiger, Rolezn, SanketKogekar, Sathish9098, Timenov, Toshii, Vagner, bart1e, bytes032, codetilda, devival, halden, hals, kutugu, m_Rassska, naman1778, nonseodion, seth_lawson, solsaver, squeaky_cactus, totomanov, y51r, yudan, zaevlad
9.931 USDC - $9.93
The setSafeCollateralRatio
function contains a potential issue where the requirement for newRatio >= vaultBadCollateralRatio[pool] + 1e19
may not be handled correctly if vaultBadCollateralRatio[pool]
does not exist in the mapping. This issue affects the reliability and functionality of the code.
vaultBadCollateralRatio[pool]
does not exist, any newRatio value greater than or equal to 1e19
will bypass the requirement check.To demonstrate the issue, consider the following scenario:
vaultBadCollateralRatio[pool]
does not have a value for the given pool.1e19
.
In this scenario, the requirement check newRatio >= vaultBadCollateralRatio[pool] + 1e19
will pass, regardless of the actual value of newRatio
. This could allow the setting of an invalid vaultSafeCollateralRatio[pool]
without the appropriate constraint.Manual review
To address this issue, it is recommended to perform a check to ensure that vaultBadCollateralRatio[pool]
exists before evaluating the requirement.
Invalid Validation
#0 - c4-pre-sort
2023-07-11T18:18:45Z
JeffCX marked the issue as primary issue
#1 - c4-sponsor
2023-07-18T08:26:28Z
LybraFinance marked the issue as sponsor disputed
#2 - LybraFinance
2023-07-18T08:26:39Z
We will ensure that the relevant configurations are in place when the system is running.
#3 - c4-judge
2023-07-27T18:10:31Z
0xean changed the severity to QA (Quality Assurance)
#4 - c4-judge
2023-07-28T18:07:53Z
0xean marked the issue as grade-b
#5 - c4-sponsor
2023-07-29T11:15:29Z
LybraFinance marked the issue as sponsor acknowledged