QA Report #295
Labels
bug
Something isn't working
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
1. Aura - can mint before initialize
Risk
Low
Impact
Contract
Aura.sol
is vulnerable to transaction dependence. Minter is able to mint initial tokens viaminterMint
function beforeinit
function is invoked. This makes it impossible to runinit
function later sincetotalSupply()
will be bigger than0
.Proof of Concept
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to check if
init
function has been run before allowingminterMint
to be executed. This can be achieved in a similar way as formint
function -require(totalSupply() != 0, "Not initialised");
.2. Missing validation value checks
Risk
Low
Impact
Multiple contracts are missing basic validation checks for function arguments which might lead to undefined behavior.
Proof of Concept
Aura.sol
:_amount > 0
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/Aura.sol#L128-L132AuraMinter.sol
:_amount > 0
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraMinter.sol#L31_outputBps <= 10000
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L80AuraVestedEscrow.sol
_recipient.length == _amount.length
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L96Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to check if the passed values are in expected ranges.
3. Not following checks-effects-interactions pattern
Risk
Low
Impact
Multiple contracts do not follow checks-effects-interactions pattern which might lead to reentrancy attacks.
AuraVestedEscrow.cancel
:ClaimFeesHelper.claimFees
:Proof of Concept
AuraVestedEscrow.sol
:ClaimFeesHelper.sol
:Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to first set the effects and then perform interactions such as external calls.
4. Hardcoded decimals
Risk
Low
Impact
Contracts
AuraBalRewardPool.sol
,AuraLocker.sol
andCrvDepositorWrapper.sol
are using hardcoded number of decimals -1e18
. It is better to dynamically read the value of decimals via_decimals
ordecimals()
.Proof of Concept
AuraBalRewardPool.sol
:1e18
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L1091e18
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L115AuraLocker.sol
:1e18
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L7951e18
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L811CrvDepositorWrapper.sol
:1e18
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/CrvDepositorWrapper.sol#L73Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to dynamically read the value of decimals
_decimals
ordecimals()
.5. Missing zero address checks
Risk
Low
Impact
Multiple contracts of
Aura
do not check for zero addresses which might lead to loss of funds, failed transactions and can break the protocol functionality.Proof of Concept
Aura.sol
:_proxy
address - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/Aura.sol#L46AuraBalRewardPool.sol
:_stakingToken
,_rewardToken
,_rewardManager
,_auraLocker
,_penaltyForwarder
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L63-L67AuraClaimZap.sol
:_crv
,_cvx
,_cvxCrv
,_crvDepositWrapper
,_cvxCrvRewards
,_locker
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraClaimZap.sol#L69-L74AuraLocker.sol
:_stakingToken
,_cvxCrv
,_cvxCrvStaking
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L150-L152_rewardsToken
,_distributor
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L195_rewardsToken
,_distributor
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L205-L208_account
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L249_account
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L304_account
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L346_rewardToken
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L848AuraMerkleDrop.sol
:_dao
,_aura
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraMerkleDrop.sol#L53-L61_newDao
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraMerkleDrop.sol#L77AuraMinter.sol
:_aura
,_dao
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraMinter.sol#L20AuraPenaltyForwarder.sol
:_distributor
and_token
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraPenaltyForwarder.sol#L30-L34AuraStakingProxy.sol
:_rewards
,_crv
,_cvx
,_cvxCrv
,_crvDepositorWrapper
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L66-L73_crvDepositorWrapper
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L88_po
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L1078 Missing check for
_rewards
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L137AuraVestedEscrow.sol
:rewardToken
,admin_
,auraLocker_
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L50-L52_admin
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L77_recipient
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L116_claim
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L179BalLiquiudityProvider.sol
:_startToken
,_pairToken
,_dao
,_bVault
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/BalLiquidityProvider.sol#L28-L32ClaimFeesHelper.sol
:_booster
,_voterProxy
,_feeDistro
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ClaimFeesHelper.sol#L31-L33CrvDepositorWrapper.sol
:_crvDeposit
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/CrvDepositorWrapper.sol#L108ExtraRewardsDistributor.sol
:_auraLocker
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ExtraRewardsDistributor.sol#L36_token
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ExtraRewardsDistributor.sol#L47_token
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ExtraRewardsDistributor.sol#L61_account
and_token
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ExtraRewardsDistributor.sol#L117_account
and_token
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ExtraRewardsDistributor.sol#L128-L129_token
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ExtraRewardsDistributor.sol#L170Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add zero address checks for listed parameters.
6. Missing events
Risk
Low
Impact
Multiple contracts are not implementing events for critical functions. Lack of events makes it difficult for off-chain applications to monitor the protocol.
Proof of Concept
AuraClaimZap.sol
:claimReward
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraClaimZap.sol#L127_claimExtras
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraClaimZap.sol#L171AuraStakingProxy.sol
:setCrvDepositorWrapper
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L88setKeeper
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L99setPending
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L107applyPendingOwner
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L115setReward
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L137AuraVestedEscrow.sol
:setAdmin
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L77setLocker
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L86ClaimFeesHelper.sol
:claimFees
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ClaimFeesHelper.sol#L43CrvDepositorWrapper.sol
:deposit
function event - https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/CrvDepositorWrapper.sol#L132Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add missing events to listed functions.
7. Critical address change
Risk
Low
Impact
Changing critical addresses such as ownership should be a two-step process where the first transaction (from the old/current address) registers the new address (i.e. grants ownership) and the second transaction (from the new address) replaces the old address with the new one. This gives an opportunity to recover from incorrect addresses mistakenly used in the first step. If not, contract functionality might become inaccessible.
Proof of Concept
AuraLocker.sol
:owner
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraLocker.sol#L24AuraMerkleDrop.sol
:dao
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraMerkleDrop.sol#L77-L81AuraMinter.sol
:owner
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraMinter.sol#L14AuraVestedEscrow.sol
:admin
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraVestedEscrow.sol#L77-L80Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to implement two-step process for changing critical addresses.
8. The contracts use unlocked pragma
Risk
Non-Critical
Impact
As different compiler versions have critical behavior specifics if the contract gets accidentally deployed using another compiler version compared to one they tested with, various types of undesired behavior can be introduced.
Proof of Concept
Contracts in scope use unlocked pragma:
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
Consider using a single compiler version for compiling both contracts, for example
0.8.11
.9. Contracts use different compiler versions
Risk
Non-Critical
Impact
Using different compiler versions across contracts of the same project might lead to confusion and accidental errors.
Proof of Concept
Examples:
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
Consider using a single compiler version for compiling both contracts, for example 0.8.10
10. Deprecated safeApprove
Risk
Non-Critical
Impact
Functioin
safeApprove
has been deprecated in favor ofsafeIncreaseAllowance()
andsafeDecreaseAllowance()
.Proof of Concept
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to consider using
safeIncreaseAllowance()
andsafeDecreaseAllowance()
functions instead ofsafeApprove
.11. Usage of boolean values in expressions
Risk
Non-Critical
Impact
Protocol uses
false
boolean expression for require statement in functions.Proof of Concept
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to remove
false
expression:require(!hasClaimed[msg.sender], "already claimed");
12. Each event should use three indexed fields if there are three or more fields
Risk
Non-Critical
Impact
Each event should use three indexed fields if there are three or more fields.
Proof of Concept
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add three indexed fields for events if there are three or more fields.
13. Natspec is incomplete
Risk
Non-Critical
Impact
Multiple contracts are missing natspec comments which makes code more difficult to read and prone to errors.
Proof of Concept
Aura.sol
:@params
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/Aura.sol#L88-L91@params
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/Aura.sol#L125-L128AuraBalRewardPool.sol
:@param _startDelay
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L54-L68@return
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L176@return
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L205AuraLocker.sol
:AuraMath.sol
:AuraMerkleDrop.sol
:AuraMinter.sol
:AuraStakingProxy.sol
:@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L107@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L137@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L157@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraStakingProxy.sol#L202AuraVestedEscrow.sol
:BalLiquidityProvider.sol
:@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/BalLiquidityProvider.sol#L42-L46@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/BalLiquidityProvider.sol#L75-L78@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/BalLiquidityProvider.sol#L84-L88ClaimFeesHelper.sol
:@param
- https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/ClaimFeesHelper.sol#L40-L43CrvDepositorWrapper.sol
:Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add missing natspec comments.
14. Lack of using native time units
Risk
Non-Critical
Impact
Contract
AuraLocker.sol
is using number of seconds and multiplying to define time units such as day and week. This might lead to confusion and accidental mistakes.Proof of Concept
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to use native time units such as seconds, minutes, hours, days, weeks and years.
The text was updated successfully, but these errors were encountered: