- Home
- Regulations
- EraLend zkSync Exploit: How a Read-Only Reentrancy Bug Drained $3.4 Million from DeFi Lending Protocol
EraLend zkSync Exploit: How a Read-Only Reentrancy Bug Drained $3.4 Million from DeFi Lending Protocol

On July 25, 2023, the decentralized lending protocol EraLend, operating on the zkSync Era Layer 2 network, fell victim to a sophisticated read-only reentrancy attack that resulted in the loss of approximately $3.4 million worth of cryptocurrency. The exploit, flagged by blockchain security firm CertiK, represents one of the more technically complex DeFi attacks seen in a month already plagued by flash loan exploits and smart contract vulnerabilities across the broader ecosystem.
Table of Contents
The Exploit Mechanics
The attack centered on a read-only reentrancy vulnerability within the Syncswap pair contract, which EraLend relied upon as a price oracle dependency. According to CertiK's incident analysis, the attacker—operating from externally owned address (EOA) 0xf1D07—executed a flash loan attack that manipulated EraLend's price oracle through a carefully constructed sequence of calls. The core mechanism involved burning tokens and triggering a callback function before the _updateReserves function completed execution. This timing exploit caused the oracle to calculate asset prices based on incorrect reserve data, allowing the attacker to extract funds at artificially favorable rates.
Read-only reentrancy attacks differ from standard reentrancy exploits in that they manipulate view functions rather than state-changing functions. The vulnerability exists when a contract reads state during an ongoing transaction that has not yet finalized, creating a window where seemingly accurate data is actually stale or manipulated. In EraLend's case, the Syncswap pair's failure to implement proper reentrancy guards on its callback mechanisms left the oracle exposed to this precise type of manipulation.
Affected Systems
EraLend functioned as the largest lending protocol on the zkSync Era network at the time of the exploit. The protocol allowed users to deposit cryptocurrency as collateral and borrow against it, relying on Syncswap's liquidity pools to determine real-time asset prices. When the oracle was compromised, the attacker was able to borrow significantly more assets than their collateral should have permitted. The stolen funds, primarily in USDC, were rapidly moved across multiple networks. CertiK traced the assets to several EOAs controlled by the exploiter, with the majority consolidated into four wallets on the Ethereum mainnet, and additional funds dispersed to addresses on Arbitrum and Optimism.
The zkSync Era network itself was not compromised—only the EraLend protocol's specific implementation of oracle-dependent lending logic was affected. However, the incident raised broader questions about the security of DeFi protocols building on newer Layer 2 networks, where the maturity of smart contract auditing and battle-testing remains limited compared to Ethereum mainnet deployments.
The Mitigation Strategy
The EraLend team responded quickly to contain the breach. In an official statement, the team confirmed that the attack had been contained and that the threat actor was no longer able to continue exploiting the vulnerability. Users were strongly advised against depositing USDC into EraLend while the investigation was ongoing. The protocol likely paused affected lending pools and implemented emergency measures to prevent further drainage of remaining liquidity.
From a defensive perspective, read-only reentrancy vulnerabilities can be prevented through several approaches. Protocols should implement reentrancy guards not only on state-changing functions but also on view functions that feed into critical price calculations. Using time-weighted average price (TWAP) oracles rather than spot price oracles reduces the attack surface, as TWAP calculations smooth out momentary price distortions. Additionally, adopting multi-oracle architectures that cross-reference prices from multiple independent sources makes it significantly more difficult for an attacker to manipulate the price feed through a single vulnerability.
Lessons Learned
The EraLend exploit is the second largest reentrancy attack that CertiK flagged during July 2023, a month that saw a combined total of $6.4 million lost to reentrancy attacks alone. More broadly, the DeFi ecosystem experienced 128 flash loan attacks in the first seven months of 2023, resulting in cumulative losses of $255 million. These statistics underscore a persistent challenge in decentralized finance: even well-understood vulnerability classes like reentrancy continue to find new attack vectors as protocols compose complex logic across interconnected smart contracts.
The incident also highlights the particular risks facing protocols on newer Layer 2 networks. While zkSync Era offers significant scalability advantages, the ecosystem of audited, battle-tested protocols remains smaller than on Ethereum mainnet. Projects building on L2 networks must invest in comprehensive security audits that specifically test for cross-contract reentrancy scenarios, oracle manipulation vectors, and composability risks that emerge from interacting with other protocols on the same chain.
User Action Required
Users who had funds deposited in EraLend at the time of the exploit should monitor official EraLend communication channels for updates on fund recovery and compensation plans. All DeFi users, regardless of platform, should consider the following security practices: diversify deposits across multiple protocols to limit exposure to any single exploit, prefer protocols that have undergone multiple independent security audits, and stay informed about security incidents affecting the chains and protocols where their funds are deployed. With Bitcoin trading around $29,227 and Ethereum at $1,858 at the time of this incident, the broader market conditions remained stable—but individual protocol risks can result in significant losses regardless of overall market direction.
Disclaimer: This article is for informational purposes only and does not constitute financial or investment advice. Always conduct your own research before engaging with any DeFi protocol.
26 Comments