Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateOperator() can be called before an operator is set in proxy #34

Open
code423n4 opened this issue May 14, 2022 · 3 comments
Open
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) G (Gas Optimization) resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-aura/blob/main/contracts/Aura.sol#L82

Vulnerability details

Impact

In Aura.sol the updateOperator() function can be called by anyone and it sets a new operator based on the address returned from IStaker(vecrvProxy).operator(). The problem is that anyone can call this function even if the operator on vecrvProxy is not yet set. If this is the case the operator in Aura.sol would be set to a zero address breaking the contract since functions like init() and mint() rely on the msg.sender being the operator. Even the minterMint() function relies on the operator since only the operator can set the minter which is the only one who can call minterMinter().

Proof of Concept

https://github.com/code-423n4/2022-05-aura/blob/main/contracts/Aura.sol#L82

Tools Used

Manual code review

Recommended Mitigation Steps

The updateOperator() function should not be a public function and should only be callable by an admin or the operator inside Aura.sol. Also in the updateOperator() function, there should be a check ensuring that the newOperator address is not a zero address to prevent breaking the contract by setting the operator to a zero address.

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels May 14, 2022
code423n4 added a commit that referenced this issue May 14, 2022
@phijfry phijfry added the invalid This doesn't seem right label May 24, 2022
@phijfry
Copy link
Collaborator

phijfry commented May 24, 2022

The voter proxy is already deployed and the operator is not set to address(0). So this can't happen.

@0xMaharishi 0xMaharishi added disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") labels May 25, 2022
@0xMaharishi
Copy link

This is certainly not a high severity issue, I would say a 1 at most.

The only problem that could happen here is if someone is watching the Aura deployment, and then calls updateOperator immediately after Aura has been deployed, but before the init fn has been called.

Solution is to add some protections.. a) checking system has been initialised and b) non zero address

@0xMaharishi 0xMaharishi removed the invalid This doesn't seem right label May 25, 2022
@0xMaharishi 0xMaharishi added the resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) label May 30, 2022
@dmvt
Copy link
Collaborator

dmvt commented Jun 20, 2022

Agree that this is not high severity. I'm going to downgrade it to gas, since the impact would be that they would need to redeploy the contracts. No fund loss is possible with this issue.

@dmvt dmvt added G (Gas Optimization) and removed 3 (High Risk) Assets can be stolen/lost/compromised directly labels Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) G (Gas Optimization) resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

4 participants