An attacker who transfers directly to the underlying token may control _exchangeRateStored
#445
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-220
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L1476
Vulnerability details
Impact
Proof of Concept
_totalSupply
is 0 and the initialinitialExchangeRateMantissa
is 1:1_totalSupply
is 1,underlying.balanceOf(address(this))
is 1_totalSupply
is 1,underlying.balanceOf(address(this))
is 2cashPlusBorrowsMinusReserves
= 2/1 = 2, and the user gets 1000/2=500 vTokens.Tools Used
manual
Recommended Mitigation Steps
Maintain
totalCash
yourself instead of usingunderlying.balanceOf(address(this))
Assessed type
Other
The text was updated successfully, but these errors were encountered: