CVE-2024-34704

5.9 MEDIUM

📋 TL;DR

This vulnerability in the era-compiler-solidity ZKsync compiler for Solidity could cause incorrect compilation of smart contracts when XOR operations are optimized. Developers using this compiler to build smart contracts for ZKsync are affected, potentially leading to contract logic errors.

💻 Affected Systems

Products:
  • era-compiler-solidity
Versions: Versions before 1.4.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects compilation of Solidity smart contracts for ZKsync using the era-compiler-solidity toolchain.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Smart contracts compiled with the vulnerable compiler could execute incorrect logic, potentially leading to financial losses, contract failures, or security breaches in decentralized applications.

🟠

Likely Case

Compiled smart contracts may behave unexpectedly or produce incorrect results due to improper optimization of XOR operations during compilation.

🟢

If Mitigated

With proper testing and verification of compiled contracts, the impact is limited to potential compilation errors that can be caught before deployment.

🌐 Internet-Facing: MEDIUM
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: HIGH

Exploitation requires understanding of compiler internals and ability to craft specific Solidity code patterns that trigger the vulnerable optimization.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.4.1

Vendor Advisory: https://github.com/matter-labs/era-compiler-solidity/security/advisories/GHSA-22pj-7cvw-r3gc

Restart Required: No

Instructions:

1. Update era-compiler-solidity to version 1.4.1 or later. 2. Recompile any smart contracts that were compiled with vulnerable versions. 3. Verify the compiled contracts function correctly.

🔧 Temporary Workarounds

Disable DAGCombine optimization

all

Temporarily disable the DAGCombine optimization phase during compilation to avoid the vulnerable code path

Check compiler documentation for optimization flags to disable DAGCombine

🧯 If You Can't Patch

  • Thoroughly test all smart contracts compiled with vulnerable versions before deployment
  • Implement additional contract verification and auditing steps for contracts compiled during the vulnerable period

🔍 How to Verify

Check if Vulnerable:

Check the era-compiler-solidity version. If it's below 1.4.1, you are vulnerable.

Check Version:

era-compiler-solidity --version

Verify Fix Applied:

Verify era-compiler-solidity version is 1.4.1 or higher and test compilation of contracts containing XOR operations.

📡 Detection & Monitoring

Log Indicators:

  • Compiler error messages related to XOR operations or optimization failures
  • Unexpected contract behavior after compilation

Network Indicators:

  • N/A - This is a compilation issue, not a network vulnerability

SIEM Query:

N/A - This vulnerability doesn't generate network traffic or system events

🔗 References

📤 Share & Export