Venus - RiskFund & Shortfall

CertiKFiles named in the report

Audit

Part of CertiK’s series

CertiK reviewed Venus Protocol (Venus - RiskFund & Shortfall) on 24 Aug 2023: 13 findings, 0 critical; 7 marked fixed, 6 open.

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

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings13

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

SeverityOpenAcknowledgedFixed
Critical000
High200
Medium001
Low406
Medium`_transferOutOrTrackDebt()` Is Not Used When ClosFixed

The function `_transferOutOrTrackDebt()` was added to avoid auctions becoming locked if a user tokens are supported that may revert when transferring to certain addresses. For example tokens that revert when transferring to a blacklisted address or tokens that implement hooks that call the receiver allowing them to force the transaction to revert. However, the function `closeAuction()` uses `safeTransfer()` and not `_transferOutOrTrackDebt()` when transferring tokens to the winner of the auction. Thus if the winner of the auction can cause the transfer of tokens to revert, they can prevent the auction from being closed and future auctions from being started.

LowCheck on Auction Status Can Be SimplifiedFixed

The following check in `_startAuction()` can be streamlined: ```solidity require( (auction.startBlock == 0 && auction.status == AuctionStatus.NOT_STARTED) ``` There is never an instance in which both `auction.startBlock` is 0 and `auction.status` is not `NOT_STARTED`. There is never an instance in which both `auction.status` is `NOT_STARTED` and `auction.startBlock` is nonzero. Therefore, the two conditions are equivalent, and the conjunction can be reduced to just one of the checks. The following check in `_isStarted()` can be streamlined: ```solidity return auction.startBlock != 0 && auction.status == AuctionStatus.STARTED; ``` The check that the `auction.startBlock` is nonzero is not necessary. If `auction.status` is `STARTED` then it is implicitly true that `auction.startBlock` is nonzero. Therefore, the check that `auction.status` is `STARTED` is sufficient, and the conjunction can be reduced to just check the status.

LowIneffectual Use of Reentrancy GuardFixed

The reentrancy guard `nonReentrant` is applied to the following locations: - `sweepToken()` in `ReserveHelpers` - `placeBid()` in `Shortfall` - `closeAuction()` in `Shortfall` Applying the `nonReentrant` modifier to only one of the user-facing functions within each contract limits its effectiveness and use as vulnerability protection within each contract. The only case in which the guard provides protection is if the external call is initiated within a function that includes the modifier and attempts to exploit a function that includes the modifier. For example, since `sweepToken()` is inherited by `ProtocolShareReserve()` and user-facing function `releaseFunds()` includes multiple external calls without using the reentrancy guard, there is potential for cross-function reentrancy that begins in `releaseFunds()` and is exploited via function `sweepToken()`. Likewise, since only `placeBid()` and `closeAuction()` have the `nonReentrant` modifier and `startAuction()` and `restartAuction()` are user-facing and exclude the modifier, reentrancy is possible, starting from `closeAuction()` moving into either `startAuction()` or `restartAuction()`. ## Locations where `nonReentrant` Can Be Added Adding a `nonReentrant` modifier to the following locations will increase the effectiveness of the reentrancy guard. ### `ProtocolShareReserve` - `releaseFunds()` ### `Shortfall` - `startAuction()` - `restartAuction()` ### `RiskFund` - `swapPoolsAssets()` - `transferReserveForAuction()` --- ## Locations where Check-Effect-Interaction Pattern Can Be Applied In general, check-effect-interaction can be followed, where possible, to prevent more general forms of reentrancy. - Function `sweepToken()` in `ReserveHelpers` can emit event `SweepToken` before external call to `IERC20Upgradeable(_token)`. - Function `releaseFunds()` in `ProtocolShareReserve` can emit event `FundsReleased` before external call to `IERC20Upgradeable(asset)`. - Function `transferReserveForAuction()` in `RiskFund` can emit event `TransferredReserveForAuction` before external call to `IERC20Upgradeable(convertibleBaseAsset)`.

LowIssue With `_swapAsset()` Depending On `convertibFixed

The variable `minAmountToConvert` stores the minimum amount assets must be worth to convert into base asset. If the intent is to ensure that the value in USD of the received `convertibleBaseAsset` is at least the `minAmountToConvert`, then the logic does not ensure this. This is because the logic ensures that the swap gives at least the `amountOutMin` of the convertible base asset and that the `amountOutMin` is at least the `minAmountToConvert`. However, the value of the convertible base asset is not taken into account and may be less than 1 USD. Alternatively, if it is not desired to ensure that the value in USD of the received `convertibleBaseAsset` is at least the `minAmountToConvert`, then the check that `amountOutMin >= minAmountToConvert` will prevent valid swaps. This can happen if the `convertibleBaseAsset` is worth more than 1 USD or if the USD value of `underlyingAsset` is close to the `minAmountToConvert` as swap fees and slippage must be accounted for.

LowRedundant Check on `amountOutMin`Fixed

The input `amountOutMin` in function `_swapAsset()` of contract `RiskFund` includes two checks: ```solidity require(amountOutMin != 0, "RiskFund: amountOutMin must be greater than 0 to swap vToken"); require(amountOutMin >= minAmountToConvert, "RiskFund: amountOutMin should be greater than minAmountToConvert"); ``` Only the latter check is needed, since after initialization of the contract, `minAmountToConvert` is necessarily a positive integer. Therefore, checking that `amountOutMin` is at least the `minAmountToConvert` ensures that the value is nonzero, and the explicit check is not required.

LowTypos and InconsistenciesFixed

- In the contract `Shortfall`, the comment above `nextBidderBlockLimit` states: "Time to wait for next bidder. initially waits for 10 blocks". However, the `DEFAULT_NEXT_BIDDER_BLOCK_LIMIT` is now 100 instead of 10. - In the contract `Shortfall`, the comment above `updateIncentiveBPs()` contains a typo where the word "incentive" is misspelled as "inventive"; - In the contract `RiskFund`, the comment at the start of the contract states: "@title ReserveHelpers". However, the title should be "RiskFund".

LowView Function Equivalent to Compiler-Generated GeFixed

Mapping `poolsAssetsReserves` has been changed to `public` visibility, which includes a compiler-generated getter function for the mapping. However, function `getPoolAssetReserve()` returns the same information and is still used in many locations throughout the codebase. The only difference in these functions is that `getPoolAssetReserve()` includes checks on the `comptroller` and `asset` address used.

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 (8)

  • contracts/lib/TokenDebtTracker.sol
  • contracts/Shortfall/Shortfall.sol
  • contracts/RiskFund/ReserveHelpers.sol
  • contracts/Shortfall/IShortfall.sol
  • contracts/RiskFund/RiskFund.sol
  • contracts/RiskFund/IProtocolShareReserve.sol
  • contracts/RiskFund/IRiskFund.sol
  • contracts/RiskFund/ProtocolShareReserve.sol

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

CertiK

1,045 projects reviewed · 1,376 reports · latest May 2025

See CertiK’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