Vulnerability · Published May 13, 2024 · Assigned by GitHub_M

CVE-2024-34704era-compiler-solidity contains a `xor(zext(cmp), -1)` misoptimization

Medium 5.9

In plain English

A medium-severity security flaw in era-compiler-solidity from matter-labs. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.5% (higher than 41% of all known vulnerabilities).

Severity (CVSS 3.1)5.9Medium
Exploit odds (30 days)0.5%top 59.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official description

era-compiler-solidity is the ZKsync compiler for Solidity. The problem occurred during instruction selection in the `DAGCombine` phase while visiting the XOR operation. The issue arises when attempting to fold the expression `!(x cc y)` into `(x !cc y)`. To perform this transformation, the second operand of XOR should be a constant representing the true value. However, it was incorrectly assumed that -1 represents the true value, when in fact, 1 is the correct representation, so this transformation for this case should be skipped. This vulnerability is fixed in 1.4.1.

Affected products (as reported)

VendorProductVersions
matter-labs era-compiler-solidity >= 1.2.0, <= 1.4.0

Weakness: CWE-682 · Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

References