Home / Smart Contract Auditing / Solidity Compiler Bug in IR Pipeline Risks Silent Storage Overwrites Across Versions 0.8.28 to 0.8.33

Solidity Compiler Bug in IR Pipeline Risks Silent Storage Overwrites Across Versions 0.8.28 to 0.8.33

On February 11, 2026, blockchain security firm Hexens reported a critical compiler bug affecting the Solidity code generator when utilizing the intermediate representation (IR) pipeline. The issue, which impacts compiler versions 0.8.28 through 0.8.33, arises when a smart contract clears both a persistent storage variable and a transient storage variable of the same type. Under these specific conditions, the compiler emits the wrong low-level opcode—substituting an sstore instruction instead of a tstore, or vice versa—for one of the operations. This malfunction occurs because the Yul helper functions generated during compilation share identical names, causing one to inadvertently overwrite the other.

Assigned a severity rating of high on the internal scale of the Solidity development team, the vulnerability is strictly confined to the --via-ir compilation pipeline. Projects relying on the legacy evmasm pipeline remain completely unaffected. Furthermore, because the --via-ir flag is not enabled by default in Solidity projects, codebases that have not explicitly opted into the IR pipeline are safe from the bug. The issue has been fully addressed and resolved in Solidity version 0.8.34, urging all developers utilizing the vulnerable range to update their toolchains immediately.

In a joint ecosystem response, a coordinated containment effort was launched following the disclosure, involving security groups such as SEAL 911, Etherscan, Dedaub, and Hexens. Analysts scanned all EVM-compatible chains to identify deployed contracts matching the risky pattern. Out of thousands of deployed contracts, only three matched the exact vulnerability criteria across all networks. The respective development teams were promptly notified, and precautionary measures were taken. Investigators confirmed that none of the affected deployments were part of active, public-facing production applications handling external user funds, meaning potential risk and capital exposure were negligible.

To understand how the bug manifests, developers must examine the underlying mechanics of Yul helper functions in the Solidity compiler. During code generation, the IR pipeline builds reusable helper functions to handle tasks like clearing storage slots, such as when a delete statement is executed. These helper functions are deduplicated by name, meaning the compiler assumes that a given function name completely and uniquely defines its execution behavior.

However, the naming convention for storage-clearing operations derived the function name solely from the Solidity type being cleared, entirely omitting the storage location context. As a result, clearing a persistent variable and clearing a transient variable of the same type would generate identical function identifiers, such as storage_set_to_zero_t_address. Whichever operation the compiler encountered first during code generation dictated the implementation for that name. If a persistent clearing operation was processed first, the helper would be built using the sstore opcode. When a transient delete operation was subsequently encountered, it would reuse the existing function, mistakenly executing sstore on transient variables or, conversely, executing tstore on persistent variables.

The specific order in which these operations are encountered depends heavily on the structure of the syntax tree, function selectors, and the layout of the contract code. Because this deduplication step happens before the optimizer runs, optimization settings do not alter the outcome. The fix implemented in Solidity 0.8.34 rectifies this design flaw by explicitly incorporating the data location into the helper function’s name—generating distinct identifiers like storage_set_to_zero_t_address for persistent storage and transient_storage_set_to_zero_t_address for transient storage—thereby guaranteeing that every operation emits the correct EVM opcode.

The practical consequences of this name collision can lead to bizarre and severe contract failures. For instance, in a contract where a persistent mapping value is cleared via delete before a transient lock variable is deleted, the compiler might generate an sstore helper first. When the transient lock variable is subsequently cleared, the generated code executes an sstore targeting persistent storage slot zero instead of clearing the transient variable. This can lead to critical state variables, such as a contract owner address, being silently overwritten with zeros. Additionally, because the transient variable is never actually cleared, security locks meant to prevent reentrancy or restrict transaction execution can become permanently stuck, rendering the contract unusable for the remainder of the transaction.

Conversely, if a transient delete operation is encountered first by the compiler, the shared helper defaults to using tstore. When a developer attempts to delete a persistent mapping value later in the code, the operation erroneously executes a tstore instead of an sstore. Consequently, the persistent state data remains completely intact on-chain, defying the expected behavior of the delete keyword and leaving unauthorized data or approvals active in persistent storage.

Despite the severity of these potential state corruptions, the bug features characteristics that make it difficult to detect through standard compilation warnings. The compiler emits no warnings during the build process, and the compiled bytecode does not trigger runtime reverts. Instead, the failure manifests entirely as unexpected state transformations. Nevertheless, development teams that rigorously execute their automated test suites using the --via-ir flag prior to mainnet deployment would likely spot the anomalous state changes, even if the root cause remained obscure initially. Unlike many compiler-level vulnerabilities of the past, this bug could be triggered using standard Solidity syntax without resorting to inline assembly, raising the statistical probability of accidental developer exposure.

Project maintainers seeking to verify whether their codebases are impacted can perform comparative analyses of the unoptimized Yul output generated via the --ir flag between their current vulnerable compiler version and version 0.8.34. In affected contracts, diffing the outputs will reveal a single shared helper function handling both storage types, with call sites pointing to unified functions rather than distinct persistent and transient routines.

The Solidity engineering team has confirmed that no other helper functions in the compiler architecture suffer from similar naming collisions. Furthermore, broader refactoring initiatives are already planned for future releases to structurally prevent this category of design oversight from recurring. The prompt collaboration between core compiler developers, auditors, and security alliances underscores the resilience and responsiveness of the broader Ethereum security ecosystem in mitigating sophisticated supply-chain risks before they can cause widespread harm in production environments.

Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *