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

Length mismatched and gas outbound error. #353

Closed
code423n4 opened this issue Sep 19, 2022 · 2 comments
Closed

Length mismatched and gas outbound error. #353

code423n4 opened this issue Sep 19, 2022 · 2 comments
Labels
bug Something isn't working disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) 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/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/distribution/TokenDistributor.sol#L225

Vulnerability details

Impact

The Array length is not checked if they are the same to avoid mismatch which can cost gas and which might revert if not assigned properly and also check the length of the array that is about to be looped is within the gas limit per block which validators can accept in a block.

Proof of Concept

https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/distribution/TokenDistributor.sol#L225

Tools Used

Recommended Mitigation Steps

The length of the arrays pass should be checked to be sure they are of the same length to avoid length mismatch as stated above and also the looping should be checked that it won’t expand to more than the computation a block can take.

@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 Sep 19, 2022
code423n4 added a commit that referenced this issue Sep 19, 2022
@merklejerk merklejerk added the disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) label Sep 22, 2022
@merklejerk
Copy link
Collaborator

If the caller runs out of gas, they can just split their array up across transactions. If they're not of compatible lengths, the indexing operation will revert.

@0xble 0xble added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Sep 26, 2022
@HardlyDifficult
Copy link
Collaborator

Agree RE out of gas and revert, but partyTokenIds too large would simply be ignored. This seems like a NC suggestion to help prevent user error/confusion. Merging with #352

@HardlyDifficult HardlyDifficult 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 Oct 6, 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) 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