Sherlock

QuantstampFiles named in the report

Quantstamp reviewed Sherlock on 10 Aug 2021: 25 findings, 0 critical; 6 marked fixed, 16 acknowledged, 3 open.

No open critical findings
Open the reportOpen Sherlock’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.

SeverityOpenAcknowledgedFixed
Critical000
High001
Medium041
Low3124
HighLast Parameter Can Be SpoofedFixed

The following functions contain parameters, which are not used: 1. The `_token` parameter in the `getCooldownFee` function from `PoolBase.sol` 2. The `_token` parameter in the `getSherXWeight` function from `PoolBase.sol` 3. The `_token` parameter in the `getGovPool` function from `PoolBase.sol` 4. The `_token` parameter in the `isPremium` function from `PoolBase.sol` 5. The `_token` parameter in the `isStake` function from `PoolBase.sol` 6. The `_token` parameter in the `getProtocolBalance` function from `PoolBase.sol` 7. The `_token` parameter in the `getProtocolPremium` function from `PoolBase.sol` 8. The `_token` parameter in the `getLockToken` function from `PoolBase.sol` 9. The `_token` parameter in the `isProtocol` function from `PoolBase.sol` 10. The `_token` parameter in the `getProtocols` function from `PoolBase.sol` 11. The `_token` parameter in the `getUnstakeEntry` function from `PoolBase.sol` 12. The `_token` parameter in the `getFirstMoneyOut` function from `PoolBase.sol` 13. The `_token` parameter in the `getTotalPremiumPerBlock` function from `PoolBase.sol` 14. The `_token` parameter in the `getPremiumLastPaid` function from `PoolBase.sol` 15. The `_token` parameter in the `getSherXUnderlying` function from `PoolBase.sol` 16. The `_token` parameter in the `getUnstakeEntrySize` function from `PoolBase.sol` 17. The `_token` parameter in the `getInitialUnstakeEntry` function from `PoolBase.sol` 18. The `_token` parameter in the `getUnactivatedStakersPoolBalance` function from `PoolBase.sol` 19. The `_token` parameter in the `getStakersPoolBalance` function from `PoolBase.sol` 20. The `_token` parameter in the `getUnallocatedSherXStored` function from `PoolBase.sol` 21. The `_token` parameter in the `getTotalSherXPerBlock` function from `PoolBase.sol` 22. The `_token` parameter in the `getSherXLastAccrued` function from `PoolBase.sol` 23. The `_token` parameter in the `LockToToken` function from `PoolBase.sol` 24. The `_token` parameter in the `TokenToLock` function from `PoolBase.sol` 25. The `_token` parameter in the `setCooldownFee` function from `PoolBase.sol` 26. The `_token` parameter in the `activateCooldown` function from `PoolBase.sol` 27. The `_token` parameter in the `cancelCooldown` function from `PoolBase.sol` 28. The `_token` parameter in the `cancelCooldown` function from `PoolBase.sol` 29. The `_token` parameter in the `unstakeWindowExpiry` function from `PoolBase.sol`. Additionally, there are several functions in `PoolBase.sol`, which use both `_token` and `baseData()`. The latter uses the `bps()`, which is used to retrieve the value of `_token`. This function is overly complex containing inline assembly and assuming that the last parameter of the function where `bps()` is called, is always the `_token`. An attacker could break this assumption by simply passing an arbitrary token when calling any of the aforementioned functions (see enumeration above). The `bps()` function is also cloned in `PoolOpen.sol` and `PoolStrategy.sol`. Same recommendation applies to those contracts.

MediumNon-empty Strategies Can Be Removed Without SweepingFixed

As described in one comment of `strategyRemove()` that says that this function `don't check if the current strategy balance = 0`, in case of faulty strategies there can be financial loss of strategy has tokens.

Low`initializeSherXERC20` May Be Called Multiple TimesFixed

This would re-instantiate `name` and `symbol`. It is not clear why this is allowed.

LowInteger OverflowFixed

The `_watsons` and `_weights` input parameters of the `SherX.setWeights` function are `uint256` and `uint256[]` respectively. However, both input parameters are cast to `uint16` on L221 and L215, respectively. This can cause an integer overflow/truncation of the actual value passed in as input.

LowUnchecked Assumption In `Payout`Fixed

The `LibPool.payOffDebtAll(tokens[i])` function is called on L80 in `Payout.sol` if `amounts[i] > ps.sherXUnderlying`. The assumption here is that the following condition will hold after this function call: `amounts[i] <= ps.sherXUnderlying`. However, there is no proof or clear guarantee that it will hold. This is partially handled by the .sub in the else branch below (ps.sherXUnderlying = ps.sherXUnderlying.sub(amounts[i]);), but missed in the if-branch.

LowUnlocked Pragma and Different Solidity VersionsFixed

All affected contracts have an unlocked pragma, but removing the `^` is not sufficient to fix the problem, because different files use different versions. The following versions were observed: * 0.7.0 * 0.7.1 * 0.7.4 * 0.7.6

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

  • contracts/facets/Manager.sol
  • contracts/interfaces/aaveV2/IProposalValidator.sol
  • contracts/facets/Payout.sol
  • contracts/interfaces/IManager.sol
  • contracts/util/RemoveMock.sol
  • contracts/ForeignLock.sol
  • contracts/interfaces/IGovDev.sol
  • contracts/interfaces/aaveV2/IAaveIncentivesController.sol
  • contracts/interfaces/aaveV2/IStakeAave.sol
  • contracts/facets/Gov.sol
  • contracts/interfaces/aaveV2/IAaveGovernanceV2.sol
  • contracts/NativeLock.sol
  • contracts/interfaces/IPoolBase.sol
  • contracts/interfaces/aaveV2/IGovernanceV2Helper.sol
  • contracts/interfaces/ISherXERC20.sol
  • contracts/util/StrategyMock.sol
  • contracts/interfaces/IGov.sol
  • contracts/interfaces/aaveV2/ILendingPoolAddressesProvider.sol
  • contracts/interfaces/aaveV2/IAaveDistributionManager.sol
  • contracts/interfaces/IRemove.sol
  • contracts/libraries/LibPool.sol
  • contracts/interfaces/ISherlock.sol
  • contracts/facets/PoolStrategy.sol
  • contracts/facets/SherX.sol
  • contracts/libraries/LibSherXERC20.sol
  • contracts/interfaces/aaveV2/IAToken.sol
  • contracts/storage/SherXERC20Storage.sol
  • contracts/interfaces/ISherX.sol
  • contracts/interfaces/IPoolStrategy.sol
  • contracts/facets/SherXERC20.sol
  • contracts/libraries/LibSherX.sol
  • contracts/facets/PoolOpen.sol
  • contracts/util/Import.sol
  • contracts/interfaces/aaveV2/MockAave.sol
  • contracts/interfaces/aaveV2/IExecutorWithTimelock.sol
  • contracts/facets/PoolBase.sol
  • contracts/facets/PoolDevOnly.sol
  • contracts/interfaces/IPayout.sol
  • contracts/util/ERC20Mock.sol
  • contracts/storage/GovStorage.sol
  • contracts/strategies/AaveV2.sol
  • contracts/interfaces/ILock.sol
  • contracts/storage/PoolStorage.sol
  • contracts/facets/GovDev.sol
  • contracts/storage/PayoutStorage.sol
  • contracts/interfaces/IPoolStake.sol
  • contracts/interfaces/aaveV2/ILendingPool.sol
  • contracts/interfaces/IStrategy.sol
  • contracts/storage/SherXStorage.sol
  • contracts/interfaces/aaveV2/DataTypes.sol

Part of Sherlock’s security record

Sherlock
Audits1 audit by 1 firmLast audit Aug 2021, by Quantstamp.
Critical findingsNo open critical findingsIn 1 report.
Open Sherlock’s security record

Security firm

Quantstamp

236 projects reviewed · 332 reports · latest Oct 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