NFTBridge
60,000 USDC
View results
Submission Details
Severity: medium
Invalid

Out-of-Bounds Memory Access at cairoStringPack in Cairo library

Hello ArkProject,

The function cairoStringPack uses inline assembly to access and manipulate memory (mload(add(strBytes, offset))). There is a risk that the offset value might exceed the length of strBytes, especially when the string length is less than the expected 32 bytes (0x20). This could lead to out-of-bounds memory access, resulting in incorrect data being packed or potentially triggering a contract crash.

Specifically, the loop increases offset by CAIRO_STR_LEN (31), which is not necessarily aligned to 32 bytes, and the assembly code shifts the value by 8 bits (shr(8, v)), which assumes that the string is a multiple of 32 bytes, but this might not always be true.

Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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