Platform: Code4rena
Start Date: 08/05/2023
Pot Size: $90,500 USDC
Total HM: 17
Participants: 102
Period: 7 days
Judge: 0xean
Total Solo HM: 4
Id: 236
League: ETH
Rank: 47/102
Findings: 1
Award: $192.11
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: fs0c
Also found by: 0xnev, BPZ, Brenzee, J4de, Team_Rocket, peanuts, rvierdiiev, yongskiws
192.105 USDC - $192.11
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L359-L434
When calculating _startAuction uint256 usdValue in RiskFund, Auction state divides the value of each market in the vToken list (in token list precision). This skew is fine for most tokens but will cause problems with certain token pairs.
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L359-L434
When calculating the user's usdValue ratio, the result is that the list of certain tokens will be completely broken because of this.
Imagine a pair of tokens like USDC and SHIB. USDC has a token precision of 6 and SHIB has 18. If a user has a list balance of 100,001 SHIB (100.001e18) and a loan of 1 USDC (1e6):
1e6 * 1e18 / 100.001e18 = 0
There are two problems with this. First, most of these tokens will not work. Another issue is that because the usdValue user returns 0, there are circumstances where some token lists are impossible to enumerate by violating the protocol's key invariant.
Any token with very high or very low precision will suffer the consequences.
Manual Review
Depending on the precision of each Token, the ratio is calculated dynamically
Decimal
#0 - 0xean
2023-05-17T16:33:49Z
The warden doesn't show how this actually impacts the protocol more than just be a loss of what amounts to dust (< 1 USD of value). Will downgrade and leave open for sponsor comment prior to moving to QA
#1 - c4-judge
2023-05-17T16:33:59Z
0xean changed the severity to 2 (Med Risk)
#2 - c4-judge
2023-05-17T16:45:04Z
0xean marked the issue as duplicate of #468
#3 - c4-judge
2023-06-05T13:58:10Z
0xean marked the issue as satisfactory