Venus protocol (vaults)

QuantstampRepository at commit f1426f0

Audit

Part of Quantstamp’s series

Quantstamp reviewed Venus Protocol (Venus protocol (vaults)) on 19 May 2023: 16 findings, 0 critical; 10 marked fixed, 4 acknowledged, 2 open; 4 more marked mitigated.

No open critical findings
Open the reportOpen Venus Protocol’s security record

Report hosted on certificate.quantstamp.com.

Trustblock does not review code.

Findings25

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixedMitigated
Critical0000
High0030
Medium0040
Low2434
HighStakers in XVS Vault May Be Able to Double Their Voting Power by Re-StakingFixed

Users can deposit XVS into the XVS vault to get voting power. However, according to the implementation, when users request a withdrawal, their voting power is removed only when the pool's reward token is XVS. For pools having a different reward token, the user's voting power will not be removed, and therefore they can re-stake to the pool to gain double voting power with the same amount of XVS deposit.

HighUse of Unsafe Cast Operations Leading to Incorrect Voting PowerFixed

The following functions make use of unsafe cast operations (`uint96()`), exposing them to truncation, when reaching values higher than `type(uint96).max` (`79,228,162,514,264,337,593,543,950,335`): 1. `deposit()`: Depositor could end up with less votes than he is entitled to. 1. `requestWithdrawal()`: Withdrawer is debited a too small amount. 1. `getStakeAmount()`: May return a truncated (too small) staked amount.

HighXVS Vault Users Receive Fewer Rewards if Multiple Pools Have the Same Pool TokenFixed

When updating the rewards for the pools in the XVS vault, `pool.token.balanceOf(address(this))` is used as a pool's `supply` (i.e., the total deposits in the pool). However, if multiple pools have the same type of pool token, using `balanceOf()` returns the total deposits across all the pools instead of a specific one. As a result, the value of `supply` will be overestimated, causing pool users to receive fewer rewards than they should.

Medium`VAIVault` Is Susceptible to MEV BotsFixed

After the XVS rewards are transferred to the VAI vault, someone has to call `updatePendingRewards()` to make the vault update the internal accounting for pending rewards. Typically, when a user operates (e.g., borrow, redeem) on a vToken, the `Comptroller` transfers the XVS tokens to the VAI vault and calls the update function in the same transaction. An attacker can exploit this design to get most of the rewards by depositing a large number of funds, triggering the reward emission, and then withdrawing their deposit. As a result, they do not have to stake VAI in the vault for some period but can still get rewards from it. The attacker might not be incentivized to launch such an attack if the rewards are relatively small. However, this could be an issue if the accumulated XVS rewards are large enough (e.g., a long period has passed, but no one operates on any vToken). In addition to the MEV exploit, the current implementation could lead to improper accounting. After someone sends the XVS reward to the VAI vault, the `updatePendingRewards()` function has to be executed before any other user operations such as `deposit()` or `withdraw()`. Otherwise, users can lose their eligible rewards, which can be locked in the vault permanently. At the beginning of every user operation, the `updateAndPayOutPending()` function is called, which claims the rewards for the user and calls the `safeXVSTransfer()` function. The bug occurs when the `safeXVSTransfer()` function updates the `xvsBalance` state variable according to the current XVS balance. Since the current XVS balance may include pending rewards that are not accounted for, `xvsBalance` should not be overwritten with the current XVS balance.

MediumInitializers Can Be Called More than OnceFixed

`VAIVault.setVenusInfo()` and `XVSVault.setXvsStore()` functions are used to set the different token addresses. However, the admin can call the function again and change the addresses, thereby locking the tokens in the vault.

MediumRe-Entrancy Guards Bypassable by Admins in `XVSVault.sol` and `VAIVault.sol`Fixed

All three vault contracts `XVSVault.sol`, `VRTVault.sol` and `VAIVault.sol` use a custom re-entrancy guard modifier (`nonReentrant`) (i.e. rather than relying on the [well-established one from OpenZeppelin](https://docs.openzeppelin.com/contracts/4.x/api/security#ReentrancyGuard)). While otherwise it works as expected, it is problematic in `XVSVault.sol`, where it is initialized in function `setXvsStore()`, which however can be called multiple times. The same issue applies to `VAIVault.setVenusInfo()`.

MediumVRT Vault Users Can Earn Additional Interests When Depositing After the Last Accrual BlockFixed

When a user deposits into the VRT vault and `lastAccruingBlock` is behind the current block, their `accrualStartBlockNumber` will be set to `lastAccruingBlock`. Although the user deposits at the current block, their interests are accrued starting from the `lastAccruingBlock`. They can claim those interests once the `lastAccruingBlock` has been moved forward to a more recent block.

LowCritical Role Transfer Not Following Two-Step PatternFixed

The `admin` role can be transferred to another address simply by calling the `VAIVault.setNewAdmin()` function. This function immediately transfers a high-level privilege to new addresses in a single transaction, which can be risky from a security perspective, as providing a faulty address may lock out that role from future calls. A more secure pattern for such privilege transfers is to require the new pending addresses to issue an `acceptAdmin()` function call before finalizing the transfer. Note that this pattern is common even with the use of timelocks, such as the [Compound Timelock](https://github.com/compound-finance/compound-protocol/blob/master/contracts/Timelock.sol) contract.

LowInaccurate Calculation of Pending Rewards of XVS Vault PoolsFixed

According to the design of the XVS vault, pending withdrawals after the upgrade are not eligible for accruing rewards. However, the `pendingReward()` function includes every pending withdrawal when calculating the pending rewards. This issue would affect the front end and any third-party protocols integrating with the XVS vault using this function.

LowPool May Be Permanently MisconfiguredFixed

The function `_updatePool()` divides by `totalAllocPoints[_rewardToken]` when calculating the reward. This variable is updated in the `add()` function: ``` totalAllocPoints[_rewardToken] = totalAllocPoints[_rewardToken].add(_allocPoint); ``` `_allocPoint` must be greater than zero the first time a pool is added. Otherwise, `_updatePool()` would revert due to division by zero, which would block users from calling `add()`, `deposit()`, `claim()`, and `requestWithdrawal()` for the corresponding `_rewardToken`. A blocked call to `massUpdatePools()` will prevent fixing the configuration by calling `set()`.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (7)

  • https://github.com/VenusProtocol/venus-protocol/contracts/XVSVault/XVSVaultStorage.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a
  • https://github.com/VenusProtocol/venus-protocol/contracts/Vault/VAIVaultStorage.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a
  • https://github.com/VenusProtocol/venus-protocol/contracts/VRTVault/VRTVaultStorage.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a
  • https://github.com/VenusProtocol/venus-protocol/contracts/Vault/VAIVault.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a
  • https://github.com/VenusProtocol/venus-protocol/contracts/XVSVault/XVSVault.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a
  • https://github.com/VenusProtocol/venus-protocol/contracts/XVSVault/XVSStore.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a
  • https://github.com/VenusProtocol/venus-protocol/contracts/VRTVault/VRTVault.sol at commit f1426f07b44f9b557059a0e364ce5d90e18f997a

Part of Venus Protocol’s security record

Venus Protocol
Audits67 audits by 7 firmsLast audit Sep 2025, by Quantstamp.
Critical findingsNo open critical findingsAcross the 67 reports, 4 critical findings were reported. Each is marked fixed by the firm that reported it.
IncidentIncident 12 May 2022Source: De.Fi incident database.
Open Venus Protocol’s security record

Security firm

Quantstamp

240 projects reviewed · 338 reports · latest Nov 2026

See Quantstamp’s audits

Something wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.

Tell us