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.
Report hosted on certificate.quantstamp.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed | Mitigated |
|---|---|---|---|---|
| Critical | 0 | 0 | 0 | 0 |
| High | 0 | 0 | 3 | 0 |
| Medium | 0 | 0 | 4 | 0 |
| Low | 2 | 4 | 3 | 4 |
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.
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.
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.
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.
`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.
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()`.
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.
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.
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.
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()`.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (7)
240 projects reviewed · 338 reports · latest Nov 2026
See Quantstamp’s auditsSomething 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