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

- Severity: Medium 5.9 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.40%, higher than 36% of CVEs (2026-12-01)
- Published: 2024-08-29T16:55:53.281Z
- Modified: 2026-06-17T07:53:30.333Z
- Weaknesses: CWE-682
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- matter-labs era-compiler-solidity: < 1.5.3; before 1.5.3
- matter-labs zksolc: before 1.5.3

## Every score

- GitHub_M: CVSS:3.1 5.9 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`
- NVD: CVSS:3.1 5.9 Medium `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`

## References

- <https://github.com/matter-labs/era-compiler-solidity/security/advisories/GHSA-fpx7-8vc6-frjj> (vendor-advisory)
- <https://github.com/llvm/llvm-project/commit/e48237df95b49a36b8ffceb78c8a58f4be1b4344> (patch)

## Sources

- CVE List: [CVE-2024-45056](https://www.cve.org/CVERecord?id=CVE-2024-45056), CVE Terms of Use, modified 2024-08-29
- NVD: [CVE-2024-45056](https://nvd.nist.gov/vuln/detail/CVE-2024-45056), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2024-45056 · Whole record: https://cve.day/CVE-2024-45056.json · Rebuilt by cve.day 2026-11-25T22:58:44.870Z
