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

wrong out of range check #79

Open
code423n4 opened this issue May 7, 2022 · 2 comments
Open

wrong out of range check #79

code423n4 opened this issue May 7, 2022 · 2 comments
Labels
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 disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-factorydao/blob/main/contracts/MerkleIdentity.sol#L124
https://github.com/code-423n4/2022-05-factorydao/blob/main/contracts/MerkleIdentity.sol#L98

Vulnerability details

require(merkleIndex <= numTrees, 'merkleIndex out of range');

This line checks that the index is valid.
However, the trees start at index 1, therefore index 0 should fail this check, but it doesn't.

Recommended Mitigation Steps

change to:

require(merkleIndex <= numTrees && merkleIndex > 0, 'merkleIndex out of range');
@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 7, 2022
code423n4 added a commit that referenced this issue May 7, 2022
@illuzen
Copy link
Collaborator

illuzen commented May 10, 2022

Technically valid, but the next line will revert, unless you think someone has the keccak pre-image of zero bytes and this pre-image is a set of valid arguments to this function...

@illuzen illuzen closed this as completed May 10, 2022
@illuzen illuzen added sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) labels May 11, 2022
@itsmetechjay itsmetechjay reopened this May 12, 2022
@illuzen
Copy link
Collaborator

illuzen commented Jun 3, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants