Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Array out-of-bounds access

Relevant GitHub Links

https://github.com/Cyfrin/2025-01-pieces-protocol/blob/4ef5e96fced27334f2a62e388a8a377f97a7f8cb/src/TokenDivider.sol#L261-L268

Summary

The buyOrder() function doesn't have any mechanism to prevent a Dos attack and doesn't follow the Check-effects-interactions pattern

Vulnerability Details

  • No bounds check on orderIndex

  • No validation if seller has any orders

  • Could lead to out-of-bounds access or returning empty/invalid data

Impact

Potential array out-of-bounds access leading to DoS or contract revert

Tools Used

Manual review

Recommendations

add a check

require(s_userToSellOrders[seller].length > orderIndex, "Invalid order index");
Updates

Lead Judging Commences

fishy Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.