CVE-2024-45056

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

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.

Category

5.9
CVSS
Severity: Medium
CVSS 3.1 •
EPSS 0.03%
Vendor Advisory github.com
Affected: matter-labs era-compiler-solidity
Published at:
Updated at:

References

Frequently Asked Questions

What is the severity of CVE-2024-45056?
CVE-2024-45056 has been scored as a medium severity vulnerability.
How to fix CVE-2024-45056?
To fix CVE-2024-45056, make sure you are using an up-to-date version of the affected component(s) by checking the vendor release notes. As for now, there are no other specific guidelines available.
Is CVE-2024-45056 being actively exploited in the wild?
As for now, there are no information to confirm that CVE-2024-45056 is being actively exploited. According to its EPSS score, there is a ~0% probability that this vulnerability will be exploited by malicious actors in the next 30 days.
What software or system is affected by CVE-2024-45056?
CVE-2024-45056 affects matter-labs era-compiler-solidity.
This platform uses data from the NIST NVD, MITRE CVE, MITRE CWE, First.org and CISA KEV but is not endorsed or certified by these entities. CVE is a registred trademark of the MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. CWE is a registred trademark of the MITRE Corporation and the authoritative source of CWE content is MITRE's CWE web site.
© 2025 Under My Watch. All Rights Reserved.