Part of CertiK’s series
CertiK reviewed Venus Protocol (Venus - Liquidator Contract) on 4 Jul 2023: 11 findings, 0 critical; 9 marked fixed, 2 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 | 0 |
| Medium | 0 | 0 | 1 |
| Low | 0 | 0 | 8 |
If the redemption of a `vToken` fails when liquidating, then that `vToken` is added to the `pendingRedeem` array. Thus if multiple liquidations happen with the same `vTokenCollateral` and all redemptions fail, the same `vToken` will be added to the `pendingRedeem` array multiple times. Thus when `_reduceReservesInternal()` is called it will reference the same `vToken` at different indexes. However, this function uses the contracts balance of `vToken`, so that if it redeems for one of the indexes the `vTokenBalance` of the contract will become zero. Then when any of the other indexes are attempted, the redemption will revert as it will have a zero amount. In this way the `pendingRedeem` array will grow with no ability to remove some of its elements, which can be used to prevent the contract from being able to redeem `vToken` and transfer the underlying asset to the protocol share reserve.
The function `markets()` in the comptroller returns a triple `(bool, uint256, bool)`, however the interface only has a `bool` return value. Currently this will function as intended as it will reference the correct memory to return the first `bool` in the triple which corresponds to if the market is listed. However, it is possible that in future iterations of the virtual machine that this behavior will not remain the same.
The function `_reduceReservesInternal()` has a for loop that starts with the `index` at `range - 1` and decreases by 1 as long as the `index` is greater than or equal to 0. Thus at the final step the `index = 0` is decremented so that it must be a signed integer. However, in the logic of the for loop, the index is only used when it is an unsigned integer and the loop can be refactored to only use unsigned integers.
The function `liquidateBorrow()` takes an input `vToken` and `vTokenCollateral` which are never checked to be supported `vToken`. Thus a malicious user can input a malicious contracts address for them so that it will fail on redemption and `vTokenCollateral` will be added to the `pendingRedeem` array. This leads to a potential denial of service as enough `vToken` can be added to the array so that other pending redemptions will not be executed. In addition, this allows an entry point for a hacker as whenever `liquidateBorrow()` is called, it will call `_reduceReservesInternal()` which will make an external call to a potentially malicious address.
The function `setAccessControl()` and the inherited function `setAccessControlManager()` for `AccessControlledV8` both call the inherited internal function `_setAccessControlManager` to set the `_accessControlManager`.
The functions `liquidateBorrow()` and `reduceReserves()` are external and can be called by anyone. While `liquidateBorrow()` has the `nonReentrant` modifier, `reduceReserves()` does not and may allow an attacker to re-enter the contract. In particular, the external calls made to the inputs `vToken` and `vTokenCollateral` of `liquidateBorrow()` may be used to call `reduceReserves()` and re-enter the contract. *This finding is considered minor because the reentrancy only causes out-of-order events.*
In the function `_distributeLiquidationIncentive()`, `siezedAmount` should be spelled as `seizedAmount`.
In the function `reduceReservesInternal()`, the for loop `index` can be decremented inside an unchecked block to save gas as `index >= 0` ensures it will not underflow.
The custom error `UnderlyingTransferFailed` is declared but never used.
The report names a repository or files. Open the report to see its scope.
Repository and files the report names (2)
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