Usage of not well-tested solidity version might contain undiscovered vulnerabilities
Missing/incomplete natspec comments
1. Missing pause functionality
Risk
Low
Impact
Contract Witch is missing pause functionality that could be used in case of security incidents and would block executing selected functions while the contract is paused.
It is recommended to add functionality for pausing contract Witch and go through all publicly/externally accessible functions to decide which one should be forbidden from running while the contract is paused.
2. Missing zero address checks
Risk
Low
Impact
Multiple functions of Witch contract do not check for zero addresses which might lead to loss of funds, failed transactions and can break the protocol functionality.
It is recommended to add zero address checks for listed parameters.
3. 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.
Low Risk
Non-Critical
1. Missing pause functionality
Risk
Low
Impact
Contract
Witch
is missing pause functionality that could be used in case of security incidents and would block executing selected functions while the contract is paused.Proof of Concept
Witch.sol
:Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add functionality for pausing contract
Witch
and go through all publicly/externally accessible functions to decide which one should be forbidden from running while the contract is paused.2. Missing zero address checks
Risk
Low
Impact
Multiple functions of
Witch
contract do not check for zero addresses which might lead to loss of funds, failed transactions and can break the protocol functionality.Proof of Concept
Witch.sol
:constructor
forcauldron_
andladle_
addresses - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L71point
forvalue
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L83setAnotherWitch
forvalue
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L141payBase
forto
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L288payFYToken
forto
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L346Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add zero address checks for listed parameters.
3. 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
Witch.sol
:auth
inherited fromAccessControl
- https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L19Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to implement two-step process for changing ownership.
4. Usage of not well-tested solidity version might contain undiscovered vulnerabilities
Risk
Non-Critical
Impact
Using the latest versions might make contracts susceptible to undiscovered compiler bugs.
Proof of Concept
Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to use more stable and tested solidity version such as
0.8.10
.5. Missing/incomplete natspec comments
Risk
Non-Critical
Impact
Contract
Witch
is missing natspec comments which makes code more difficult to read and prone to errors.Proof of Concept
Witch.sol
:@param vaultId
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L214@param
and@return
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L220-L223@param
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L266-L268@param
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L385-L386@param
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L407-L409@param
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L461-L463@param
and@return
natspec - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L561-L562Tools Used
Manual Review / VSCode
Recommended Mitigation Steps
It is recommended to add missing natspec comments.