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

Lack of zero address check in stakeFor() can lead to loss of funds #237

Closed
code423n4 opened this issue May 24, 2022 · 5 comments
Closed
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-aura/blob/4989a2077546a5394e3650bf3c224669a0f7e690/contracts/AuraBalRewardPool.sol#L138

Vulnerability details

Impact

In AuraBalRewardPool.sol, the stakeFor() function is lacking a crucial check against address(0). An incorrect input or wallet defaulting to the zero address will immediately cause loss of funds upon deposit.

A previous submission similar to this can be found here

Proof of Concept

If AuraBalRewardPool.stakeFor() is called with _for equal to address(0), the amount will be staked for the zero address, not any real user. This amount will not be able to be withdrawn.

Tools Used

Manual review

Recommended Mitigation Steps

Add a simple zero-address check on the stakeFor() function.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels May 24, 2022
code423n4 added a commit that referenced this issue May 24, 2022
@0xMaharishi 0xMaharishi added invalid This doesn't seem right sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue labels May 27, 2022
@0xMaharishi
Copy link

Any sort of dead address will have the same effect, not just address(0)

@0xahtle7
Copy link
Collaborator

similar to similar to #223

@dmvt
Copy link
Collaborator

dmvt commented Jun 22, 2022

The difference between this issue and #223 is that this function is callable by anyone. As a result the likelihood that a zero address check will prevent a pebkac user error or even a frontend code bug is much higher. Also, funds are at direct risk here given external factors. That makes it textbook medium risk.

@dmvt
Copy link
Collaborator

dmvt commented Jul 11, 2022

Per #364 (comment) I have decided to downgrade this to QA.

@dmvt dmvt closed this as completed Jul 11, 2022
@dmvt dmvt added duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Jul 11, 2022
@dmvt
Copy link
Collaborator

dmvt commented Jul 11, 2022

Grouping this with the warden’s QA report, #246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

4 participants