Part of CertiK’s series
CertiK reviewed Venus Protocol (Venus - Token Converter) on 7 Nov 2023: 26 findings, 0 critical; 19 marked fixed, 7 open.
Report hosted on skynet.certik.com.
Trustblock does not review code.
Statuses are the security firm’s own, from its report.
| Severity | Open | Acknowledged | Fixed |
|---|---|---|---|
| Critical | 0 | 0 | 0 |
| High | 2 | 0 | 1 |
| Medium | 0 | 0 | 3 |
| Low | 5 | 0 | 15 |
### RiskFundV2 In the contract `RiskFundV2` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and do the following: - Sweep any token, including those that are allocated to reserves. This can be used to drain the contract of all funds. - Set the shortfall contract address, which is allowed to transfer reserves. This can be used to drain the contract of all reserves. - Set the riskFundConverter, which is allowed to increase each pools reserve values. - Set the convertibleBaseAsset, which is the token that is auctioned off in the shortfall contract;  --- ### XVSVaultTreasury In the contract `XVSVaultTreasury` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and change the `xvsVault`, which is called to get the `xvsStore`. The `xvsStore` address is where the function `fundXVSVault` sends `XVS` to, so an attacker can use this to have XVS sent to a contract they control as opposed to the `xvsStore`.  --- In the contract `XVSVaultTreasury`, the role `DEFAULT_ADMIN_ROLE` of the `AccessControlManager` can grant addresses the privilege to call the function `fundXVSVault()`. Any compromise to the `DEFAULT_ADMIN_ROLE` or accounts granted this privilege may allow a hacker to take advantage of this authority and transfer funds from the `XVSVaultTreasury` to the `xvsStore`. --- ### AbstractTokenConverter In the contract `AbstractTokenConverter` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and - remove any token from the contract, including any market assets - change the oracle to a malicious contract, in order to convert tokens for an inflated price - change the destination address to an account they control  In the contract `AbstractTokenConverter`, the role `DEFAULT_ADMIN_ROLE` of the `AccessControlManager` can grant addresses the privilege to call the functions: - `pauseConversion()` - `resumeConversion()` - `setConversionConfig()` Any compromise to the account may allow the hacker to take advantage of this authority and - allow the resumption of token conversion while the contract is vulnerable - pause conversion to prevent swapping during a critical period - allow a conversion configuration that causes damage to the protocol, such as allowing the same token as a `tokenIn` in a pair and a `tokenOut` in a pair, or using a high percentage for the incentive (the cap is 50% incentive). **Note:** Contracts `XVSVaultConverter` and `RiskFundConverter` both inherit `AbstractTokenConverter`, and consequently inherit its centralization risk. --- ### RiskFundConverter In the contract `RiskFundConverter` the role `_owner` has authority over the functions shown in the diagram below. Any compromise to the `_owner` account may allow the hacker to take advantage of this authority and change the `poolRegistry` to a contract which verifies fake comptrollers and assets are part of the Venus protocol. The fake contracts could be used to steal funds from users or make unexpected external calls in the function logic.  In `RiskFundConverter`, the role `DEFAULT_ADMIN_ROLE` of the `AccessControlManager` can grant addresses the privilege to call the function `setPoolsAssetsDirectTransfer()`. Any compromise to the account may allow a hacker to set an asset from a certain comptroller to be sent directly to the `destinationAddress` without being recorded in the mappings `poolsAssetsReserves` and `assetsReserves`.
Contracts `XVSVaultConverter`, `RiskFundConverter`, `XVSVaultTreasury`, and `RiskFundV2` are upgradeable; the corresponding `admin` role in each respective proxy has the authority to update the implementation contract behind each contract. Any compromise to the `admin` account in each proxy may allow a hacker to take advantage of this authority and change the implementation contract the proxy points to, and therefore execute potential malicious functionality in the implementation contract. In particular, they can steal all tokens held by the contract.
The currently deployed `RiskFund` is to be upgraded to `RiskFundV2`. As such a `reinitializer()` can be used to reinitialize the proxy according to the updated logic. In particular, this can be used to initialize the new `riskFundConverter` address as well as update deprecated states to their default.
*Note: This finding concerns the topic of read-only reentrancy. The finding is set as a severity of minor because the Venus protocol does not currently support ERC20 tokens with hooks, and native BNB is not used within the scope of the audited files. The finding is made with consideration to future support of tokens with hooks.* Function `RiskFundConverter` has a function `balanceOf()` which reads the mapping `assetsReserves` for a given `tokenAddress`. Please state all intended uses for this function. The read of `assetsReserves` is being considered under the context of read-only reentrancy, when tokens with hooks are converted: during token conversion logic, the `assetsReserves` mapping is updated in the `postConversionHook()` logic of this contract, after transfer of tokens to an outgoing destination. If the `balanceOf()` function, the `assetsReserves` mapping, or the `poolAssetsReserves` mapping is read by any other part of the protocol, or by a third party, then this value may not accurately represent amounts within the contract in all instances. --- Additionally, please specify what all the current up-to-date intended recipients are for the release of funds through the `ProtocolShareReserve` contract. This contract has a similar issue to that outlined above in that `assetsReserves` and `totalAssetsReserves` are only updated after a transfer of funds. In the event of transferring tokens with a hook, if the destination contracts interact with external accounts, it may be possible to read the state of the `ProtocolShareReserve` before it is consistently updated. If any other part of the protocol relies on reading this information, it is possible that could be manipulated in the future.
Markets `vXVS` and `vUSDC` are handled inefficiently in `RiskFundConverter` and `XVSVaultConverter` respectively. - It is assumed that `XVS` is not directly transferred as an asset from the `RiskFundConverter` to the `RiskFundV2` contract since this is not in line with the specification. - Additionally, since `XVSVaultConverter` has no method of direct transfer, it is assumed that `USDC` is converted for `XVS` within this contract, since `vUSDC` is a market, and since the specification states `XVS` is to be collected by `XVSVaultConverter`. - Consequently, it is assumed that `XVS` will be offered as an incentivized asset in `RiskFundConverter`, to be converted in exchange for a user providing `USDC`. - This allows a user to convert `USDC` to `XVS` via the `RiskFundConverter` and then take the received `XVS` and convert it back to USDC via the `XVSVaultConverter`. - The process can be continued as long as assets are available in each contract, compounding profit by continuously converting between the two Token Converter contracts. Since the protocol already has the desired asset, the logic could be adjusted to directly send funds to the corresponding destination, rather than relying on users to convert.
Currently `convertibleBaseAsset` reserves can also be swept when `sweepToken()` is called. This allows for a scenario where reserves are being auctioned, but while the auction is ongoing and before it is closed they are swept. If this is done, then the auction will not be able to be closed as there will not be enough reserves to transfer.
When a loop allows an arbitrary number of iterations or accesses state variables in its body, the function may run out of gas and revert the transaction. ```solidity=169 for (uint256 i; i < poolsLength; ++i) { ``` Function `RiskFundV2.postSweepToken` contains a loop and its loop condition depends on external calls: `IRiskFundConverter(riskFundConverter).getPools`. --- ```solidity=181 for (uint256 i; i < poolsLength; ++i) { ``` Function `RiskFundV2.postSweepToken` contains a loop and its loop condition depends on external calls: `IRiskFundConverter(riskFundConverter).getPools`. --- ```solidity=220 for (uint256 i; i < poolsLength; ++i) { ``` Function `RiskFundConverter.getPools` contains a loop and its loop condition depends on external calls: `IPoolRegistry(poolRegistry).getPoolsSupportedByAsset`. --- ```solidity=245 for (uint256 i; i < pools.length; ++i) { ``` Function `RiskFundConverter.postConversionHook` contains a loop and its loop condition depends on external calls: `IPoolRegistry(poolRegistry).getPoolsSupportedByAsset`. --- ```solidity=273 for (uint256 i; i < pools.length; ++i) { ``` Function `RiskFundConverter.postSweepToken` contains a loop and its loop condition depends on external calls: `IPoolRegistry(poolRegistry).getPoolsSupportedByAsset`. --- ```solidity=302 for (uint256 i; i < coreMarkets.length; ++i) { ``` Function `RiskFundConverter.isAssetListedInCore` contains a loop and its loop condition depends on external calls: `IComptroller(CORE_POOL_COMPTROLLER).getAllMarkets`.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (9)
1,045 projects reviewed · 1,376 reports · latest May 2025
See CertiK’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