Closed code423n4 closed 1 year ago
Zero address checks should be rated as QA issues. Although loss of funds may occur, it is an admin function which requires setting an operator to zero.
kirk-baird changed the severity to QA (Quality Assurance)
I agree, my negligence
kirk-baird marked the issue as grade-b
Lines of code
https://github.com/code-423n4/2023-05-xeth/blob/main/src/CVXStaker.sol#L43-L53 https://github.com/code-423n4/2023-05-xeth/blob/main/src/CVXStaker.sol#L78-L82 https://github.com/code-423n4/2023-05-xeth/blob/main/src/CVXStaker.sol#L170-L179
Vulnerability details
Impact
Lack of zero address check about the
operator
address in the setOperator and withdrawAllAndUnwrap funtions can cause the permanent loss of the lp tokens. Lack of zero address check about immutable varclpToken
andbooster
in the constructor can cause the contract not to work properly and must be re-deployed to a new address.Proof of Concept
setOperator
set the operator address directly without any 0 address check.But the
operator
is used as the withdrawing target directly in thewithdrawAllAndUnwrap
. And it also has not any check about whether theoperator
is 0 address.If the owner calls the
withdrawAllAndUnwrap
function without setting a valid operator address before, all the clp token will be lost.A similar lack of check occurs in constructor:
The constructor sets the immutable vars clpToken and booster directly, which can cause the contract not to work properly and must be re-deployed to a new address.
Tools Used
Manual review
Recommended Mitigation Steps
Add zero address check.
Assessed type
Invalid Validation