Venus Protocol Isolated Pools - Norah's results

Earn, Borrow & Lend on the #1 Decentralized Money Market on the BNB Chain

General Information

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

Venus Protocol

Findings Distribution

Researcher Performance

Rank: 85/102

Findings: 1

Award: $51.68

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: LokiThe5th

Also found by: 0x8chars, Co0nan, Cryptor, J4de, Josiah, Norah, Parad0x, QiuhaoLi, RaymondFam, bin2chen, fs0c, qpzm, thekmj, volodya, xuwinnie

Awards

51.6843 USDC - $51.68

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
duplicate-220

External Links

Lines of code

https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L180-L185 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L743-L791 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L743-L791 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L1463-L1483 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L1476 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/VToken.sol#L1421-L1424

Vulnerability details

Impact

Attacker can steal funds from normal user under certain condition.

Proof of Concept

Consider following scenario :

When totalSupply = 0,

  • Attacker deposits few underlying to mint themself 1 vTOken, they basically own 100% share of the pool with this 1 vToken.

  • Now Attacker supplies huge amount of underlying tokens to the vToken contract indirectly(with ERC20 transfer, not via mint function).

  • Any, subsequent normal users trying to mint vToken by depositing the underlying won't be minted any share as amount of token to be minted is calculated as mintAmount/exchangeRate, and ExchangeRate is calculated via underlying.balanceOf(address(this)), which has been artificially increased as mentioned in previous step, so the result will be zero for most users. so users underlying will be transfer to contract but they will be zero share.

  • Now after some such transaction, attacker withdraws their and pools only 1 vToken, claiming entire amount of underlying asset own by pool, (which includes their indirect supply as well as victim users funds).

This is pretty common issue in protocol related to lending/borrowing protocol.

Tools Used

Manual Review

Best solution as the protocol is not deployed yet is to burn few shares as soon as first shares are minted, alternatively you can manually few shares to ensure totalsupply never goes to zero.

Assessed type

Other

#0 - c4-judge

2023-05-17T12:03:33Z

0xean marked the issue as duplicate of #314

#1 - c4-judge

2023-06-05T14:08:36Z

0xean marked the issue as satisfactory

#2 - c4-judge

2023-06-05T14:37:43Z

0xean changed the severity to 2 (Med Risk)

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter