5.9

CVE-2024-45056: `fold (xor (shl 1, x), -1) -> (rotl ~1, x)` misoptimization in zksolc

Analyzed
Published 29-08-2024Last modified 29-08-2024

Vulnerability summary

CVE-2024-45056 is a medium (CVSS 5.9) Incorrect Calculation vulnerability in matter-labs era-compiler-solidity. EPSS estimates a 0.40% chance of exploitation in the next 30 days, higher than 34.6% of scored vulnerabilities.

Priority
Routine

Not severe (CVSS 5.9, network access); no exploitation reported by the 5 checked sources

Source freshness unavailable

How is this decided?
CVSS score
5.9/10
010
Medium · v3.1 (CVE.org)
EPSS score
0.40%
0%100%
Low · 0.00 pp in 30 days
KEVNot listedNot listed by any tracked catalog.
RansomwareNot flaggedNo ransomware use recorded.
Public exploits0No public exploits recorded

Advisory lineage

Upstream 0 · Downstream 0 · Related 1

Timeline

  1. 29-08-2024
    PublishedVulnerability first disclosed.
  2. 29-08-2024
    Last modifiedVulnerability information updated.

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.

CVSS metrics

2 scores · 2 sources · 1 version

EPSS trend

Probability

0.40%

Chance of exploitation in the next 30 days

Percentile

35%

Versus all other CVEs

30-day change

No change 0.00 pp

From 0.40% on 04-10-2026

04-10-202603-11-2026

Known exploited

Compare KEV catalogs
CISA KEV

Not in the CISA KEV catalog.

ENISA CNW

Not in the ENISA CNW catalog.

CIRCL

Not in the CIRCL catalog.

Public exploits

0 found

No public exploits indexed.

Weaknesses

CWE · root cause

Affected systems

Version check

Known conditions: network-reachable, no authentication, no user interaction (CVSS vector). Other conditions: not stated in public data.

Matter-labs2 products

1 vendor · 2 products

References

2 links