Platform: Code4rena
Start Date: 14/07/2022
Pot Size: $25,000 USDC
Total HM: 2
Participants: 63
Period: 3 days
Judge: PierrickGT
Total Solo HM: 1
Id: 147
League: ETH
Rank: 40/63
Findings: 1
Award: $39.13
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: hickuphh3
Also found by: 0x29A, 0x52, 0xNazgul, Chom, Deivitto, ElKu, Funen, IllIllI, Meera, ReyAdmirado, SooYa, TomJ, Trumpero, Waze, __141345__, ak1, asutorufos, c3phas, cRat1st0s, csanuragjain, delfin454000, exd0tpy, fatherOfBlocks, hake, hansfriese, horsefacts, hyh, karanctf, kenzo, kyteg, ladboy233, pashov, peritoflores, rajatbeladiya, rbserver, reassor, rokinot, simon135, wastewa
39.13 USDC - $39.13
Low
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.
Witch.sol
:
Manual Review / VSCode
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.
Low
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.
Witch.sol
:
constructor
for cauldron_
and ladle_
addresses - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L71point
for value
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L83setAnotherWitch
for value
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L141payBase
for to
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L288payFYToken
for to
address - https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L346Manual Review / VSCode
It is recommended to add zero address checks for listed parameters.
Low
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.
Witch.sol
:
auth
inherited from AccessControl
- https://github.com/code-423n4/2022-07-yield/blob/6ab092b8c10e4dabb470918ae15c6451c861655f/contracts/Witch.sol#L19Manual Review / VSCode
It is recommended to implement two-step process for changing ownership.
Non-Critical
Using the latest versions might make contracts susceptible to undiscovered compiler bugs.
Manual Review / VSCode
It is recommended to use more stable and tested solidity version such as 0.8.10
.
Non-Critical
Contract Witch
is missing natspec comments which makes code more difficult to read and prone to errors.
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-L562Manual Review / VSCode
It is recommended to add missing natspec comments.
#0 - alcueca
2022-07-22T14:17:42Z
Thanks for the suggestion for a pause
functionality, and for the natspec check. Nothing else is useful or correct.