Closed code423n4 closed 1 year ago
will leave open for sponsor comment, I believe these are both in dollar terms, just not clearly labeled, but would be good for them to confirm
0xean marked the issue as primary issue
chechu marked the issue as sponsor confirmed
Duplicated with issue #468
@chechu - I am not sure this is a duplicate with #468 - can you clarify why you believe they are the same?
0xean marked the issue as duplicate of #468
@chechu - I am not sure this is a duplicate with #468 - can you clarify why you believe they are the same?
I would say the root cause is the same in both issues: we are assuming riskFundBalance
is defined in USD (with 18 decimals), but that's wrong and we should convert it using a price oracle, for example. It's true that #468 put the focus on the decimals, that is not the only problem, but at the same time #468 says The problem is that incentivizedRiskFundBalance variable is in usd, when riskFundBalance is in convertibleBaseAsset
, that is really the root cause, as I said
0xean marked the issue as satisfactory
0xean changed the severity to 2 (Med Risk)
Lines of code
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L406
Vulnerability details
riskFund.poolReserves return the token amount & its compaired with the USD value {units are not same}
poolReserves in RiskFund.sol returns the token amount. But its compaired with the incentivizedRiskFundBalance which is in USD value.
Proof of Concept
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L406
Here incentivizedRiskFundBalance in USD & riskFundBalance is token amount. Due to this its always incentivizedRiskFundBalance < riskFundBalance. Hence else part executed.
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L412
Here auction.seizedRiskFund = riskFundBalance - remainingRiskFundBalance;
This final value is in USD . This is the amount that going to be send after auction finished.
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L248
But on the other hand bidder needs to pay in tokens
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L190
So Finally bidder get small amount of tokens compared to his spend for the bidding.
Tools Used
Manual Auditing
Recommended Mitigation Steps
keep the incentivizedRiskFundBalance in terms of token value not USD value.
Assessed type
Math