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 optimizati…
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.
The product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management.
https://cwe.mitre.org/data/definitions/682.html →Open in CWE collection →An attacker takes advantage of the structure of integer variables to cause these variables to assume values that are not expected by an application. For example, adding one to the largest positive integer in a signed integer variable results in a negative number. Negative numbers may be illegal in an application and the application may prevent an attacker from providing them directly, but the application may not consider that adding two positive numbers can create a negative number do to the structure of integer storage formats.
https://capec.mitre.org/data/definitions/128.html →Open in CAPEC collection →This attack pattern involves an adversary manipulating a pointer within a target application resulting in the application accessing an unintended memory location. This can result in the crashing of the application or, for certain pointer values, access to data that would not normally be possible or the execution of arbitrary code. Since pointers are simply integer variables, Integer Attacks may often be used in Pointer Attacks.
https://capec.mitre.org/data/definitions/129.html →Open in CAPEC collection →| Product | Vendor | Status |
|---|---|---|
| llvm-toolchain-10 | Tracked | |
| llvm-toolchain-11 | Tracked | |
| llvm-toolchain-11 | Tracked | |
| llvm-toolchain-12 | Tracked | |
| llvm-toolchain-12 | Tracked | |
| llvm-toolchain-13 | Tracked | |
| llvm-toolchain-14 | Tracked | |
| llvm-toolchain-14 | Tracked | |
| llvm-toolchain-15 | Tracked | |
| llvm-toolchain-15 | Tracked | |
| llvm-toolchain-16 | Tracked | |
| llvm-toolchain-17 | Tracked | |
| llvm-toolchain-18 | Tracked | |
| llvm-toolchain-18 | Tracked | |
| llvm-toolchain-19 | Tracked | |
| llvm-toolchain-6.0 | Tracked | |
| llvm-toolchain-7 | Tracked | |
| llvm-toolchain-8 | Tracked | |
| llvm-toolchain-9 | Tracked | |
| zksolc | * | Tracked |