`fold (xor (shl 1, x), -1) -> (rotl ~1, x)` misoptimization in zksolc
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | ||||||
|---|---|---|---|---|---|---|---|---|---|
| matter-labs | era-compiler-solidity | affected |
|
No data.
No data available yet.
| Source | ID | Title |
|---|---|---|
EUVD |
EUVD-2024-41287 | 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. |
No CVSS v4.0
No CVSS v3.0
No CVSS v2
This CVE is not in the KEV list.
Exploit prediction score: < 1% (0.403% probability within 30 days)
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Matter-labs zksolc
|
|
| CPEs | cpe:2.3:a:matter-labs:zksolc:*:*:*:*:*:*:*:* | |
| Vendors & Products |
Matter-labs zksolc
|
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Matter-labs
Matter-labs era-compiler-solidity |
|
| CPEs | cpe:2.3:a:matter-labs:era-compiler-solidity:*:*:*:*:*:*:*:* | |
| Vendors & Products |
Matter-labs
Matter-labs era-compiler-solidity |
|
| Metrics |
ssvc
|
| Type | Values Removed | Values Added |
|---|---|---|
| Description | 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. | |
| Title | `fold (xor (shl 1, x), -1) -> (rotl ~1, x)` misoptimization in zksolc | |
| Weaknesses | CWE-682 | |
| References |
| |
| Metrics |
cvssV3_1
|