`fold (xor (shl 1, x), -1) -> (rotl ~1, x)` misoptimization in zksolc
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- —
- Confidentiality · integrity · availability
- None · High · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA.
Summary
zksolc is a Solidity compiler for ZKsync. All LLVM versions since 2015 fold `(xor (shl 1, x), -1)` to `(rotl ~1, x)` if run with optimizations enabled. Here `~1` is generated as an unsigned 64 bits number (`2^64-1`). This number is zero-extended to 256 bits on EraVM target while it should have been sign-extended. Thus instead of producing `roti 2^256 - 1, x` the compiler produces `rotl 2^64 - 1, x`. Analysis has shown that no contracts were affected by the date of publishing this advisory. This issue has been addressed in version 1.5.3. Users are advised to upgrade and redeploy all contracts. There are no known workarounds for this vulnerability.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| matter-labs | era-compiler-solidity | before 1.5.3 | 1.5.3 | Patch available | CNA |
- era-compiler-solidity Vendormatter-labs Affected before 1.5.3 Fixed in 1.5.3 Patch available CNA
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:matter-labs:zksolc:*:*:*:*:*:*:*:* | before 1.5.3 | Vulnerable | matter-labs |
- cpe:2.3:a:matter-labs:zksolc:*:*:*:*:*:*:*:* Versions before 1.5.3 Vulnerable ·matter-labs
Remediation
- Fix · CNA era-compiler-solidity (matter-labs) Fixed in 1.5.3
Timeline
- 2026-10-02 Threatist record created from CVE-2024-45056
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences