CVE-2024-35229

5.3 MEDIUM

📋 TL;DR

This vulnerability in ZKsync Era's Yul compiler involves incorrect evaluation order of function arguments in specific patterns like f(a(),b()); check_if_a_executed_last(). This could allow smart contracts to execute in unexpected ways, potentially leading to logic errors or security issues. Affected users are those running ZKsync Era smart contracts compiled with vulnerable versions.

💻 Affected Systems

Products:
  • ZKsync Era compiler for Solidity
Versions: Versions prior to 1.3.10
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects contracts using the specific Yul pattern f(a(),b()); check_if_a_executed_last()

⚠️ 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 could execute with incorrect state or logic, potentially allowing unauthorized state changes, fund manipulation, or contract logic bypass in deployed applications.

🟠

Likely Case

Smart contracts may exhibit unexpected behavior or logic errors when using the specific vulnerable Yul pattern, potentially causing application failures or incorrect calculations.

🟢

If Mitigated

With proper controls and monitoring, impact is limited to specific contract patterns, allowing for detection and remediation before significant damage occurs.

🌐 Internet-Facing: HIGH
🏢 Internal Only: LOW

🎯 Exploit Status

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

Exploitation requires specific vulnerable Yul patterns in smart contracts and understanding of contract logic to trigger malicious behavior.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.3.10

Vendor Advisory: https://github.com/matter-labs/era-compiler-solidity/security/advisories/GHSA-jf9w-7f5g-j95p

Restart Required: No

Instructions:

1. Update ZKsync Era compiler to version 1.3.10 or later. 2. Recompile all affected smart contracts with the updated compiler. 3. Redeploy recompiled contracts to replace vulnerable versions.

🔧 Temporary Workarounds

Update and Redeploy

all

Update compiler and redeploy affected contracts as temporary measure

npm update @matterlabs/hardhat-zksync-solc
npx hardhat compile --force
npx hardhat deploy-zksync

🧯 If You Can't Patch

  • Audit all smart contracts for the vulnerable Yul pattern f(a(),b()); check_if_a_executed_last() and manually fix affected code sections.
  • Implement enhanced monitoring and alerting for unexpected contract behavior or state changes in production systems.

🔍 How to Verify

Check if Vulnerable:

Check compiler version in package.json or run: npx hardhat --version | grep zksolc

Check Version:

npx hardhat --version | grep zksolc

Verify Fix Applied:

Verify compiler version is 1.3.10 or later and recompile contracts to ensure no vulnerable patterns remain.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected contract execution patterns
  • Contract state changes that violate expected logic
  • Compiler version logs showing pre-1.3.10 versions

Network Indicators:

  • Unusual transaction patterns to affected contracts
  • Contract calls that trigger the specific vulnerable Yul pattern

SIEM Query:

source="smart_contract_logs" AND (message="unexpected execution order" OR message="contract logic violation")

🔗 References

📤 Share & Export