{"id":4728,"date":"2026-11-26T23:49:16","date_gmt":"2026-11-26T23:49:16","guid":{"rendered":"https:\/\/wyominginvest.com\/?p=4728"},"modified":"2026-11-26T23:49:16","modified_gmt":"2026-11-26T23:49:16","slug":"critical-solidity-compiler-bug-threatens-smart-contracts-using-transient-storage-in-ir-pipeline","status":"publish","type":"post","link":"https:\/\/wyominginvest.com\/?p=4728","title":{"rendered":"Critical Solidity Compiler Bug Threatens Smart Contracts Using Transient Storage in IR Pipeline"},"content":{"rendered":"<p>A high-severity bug within the Solidity code generator has been officially uncovered and patched, affecting compiler versions 0.8.28 through 0.8.33 when utilizing the intermediate representation (IR) compilation pipeline. The vulnerability, first reported by blockchain security firm Hexens on February 11, 2026, causes the compiler to emit incorrect EVM opcodes when a smart contract clears both persistent storage and transient storage variables of matching types. Because generated Yul helper functions share identical naming conventions regardless of storage location, one function inevitably overwrites the other, leading to severe state corruption risks on Ethereum and other EVM-compatible networks.<\/p>\n<p>The bug specifically stems from the way the Solidity compiler handles helper function deduplication during the code generation phase under the <code>--via-ir<\/code> compilation flag. Projects that do not explicitly opt into the IR pipeline remain completely unaffected, as does the legacy <code>evmasm<\/code> pipeline. Furthermore, because the <code>--via-ir<\/code> flag is not enabled by default across standard development frameworks, the vast majority of projects utilizing these compiler versions experienced no exposure. The Solidity development team swiftly addressed the vulnerability, introducing a comprehensive fix in Solidity version 0.8.34 that properly distinguishes storage locations within Yul helper function names.<\/p>\n<p>To understand the mechanics of the vulnerability, developers must look closely at how the IR pipeline optimizes code generation. When a contract utilizes the <code>delete<\/code> keyword or related operations, the compiler generates reusable Yul helper functions designed to clear storage slots. Historically, these functions derived their names exclusively from the Solidity value type being cleared, such as <code>storage_set_to_zero_t_address<\/code> for an address type. Crucially, the storage kind\u2014whether persistent storage via <code>sstore<\/code> or transient storage via <code>tstore<\/code>\u2014was omitted from the function identifier.<\/p>\n<p>This design choice created a major collision risk. Because the compiler deduplicates Yul functions by name, only a single function could exist for a given type-based identifier. Whichever clearing operation the compiler encountered first during code generation dictated the implementation for that entire session. If a persistent storage clearing operation was processed first, the generated helper function utilized the <code>sstore<\/code> opcode. A subsequent transient deletion operation would then reuse that same function, erroneously executing an <code>sstore<\/code> instruction instead of a <code>tstore<\/code> instruction. Conversely, if the transient deletion was encountered first, subsequent persistent clearing operations would mistakenly execute <code>tstore<\/code> instructions, failing to remove data from permanent storage.<\/p>\n<p>The order in which the compiler encounters these clearing operations depends heavily on the structure of the syntax tree and the arrangement of function selectors. Because this ordering is determined during code generation rather than optimization, running optimizers does not alter or mitigate the behavior. <\/p>\n<p>The conditions required to trigger the bug are specific. A contract is only vulnerable if it explicitly uses the <code>delete<\/code> keyword on a transient state variable while also performing a clearing operation on a persistent storage variable or mapping that shares a matching underlying value type within the same Yul object. Explicitly assigning zero values, such as assigning <code>_lock = 0<\/code>, bypasses the shared clearing helper entirely and does not trigger the bug. Additionally, cross-type collisions can occur due to array clearing mechanics. Operations on arrays are performed at slot granularity, treating every storage slot as a <code>uint256<\/code> value rather than clearing elements individually. Consequently, clearing a boolean array or a fixed-size address array will utilize the exact same clearing helper as a <code>uint256<\/code> variable, introducing collision risks even when declared types differ.<\/p>\n<p>The consequences of this bug can be deceptive and difficult to diagnose. The compiler emits no warning messages during the build process, and the resulting bytecode does not trigger runtime reverts. Instead, transactions execute successfully while silently modifying unintended state variables. In scenario simulations involving persistent storage collisions, a transient lock mechanism intended to prevent reentrancy might inadvertently overwrite a core ownership variable with zero, transferring contract control or breaking administrative functions while simultaneously failing to release the transient lock. In the reverse scenario, attempts to revoke user approvals from persistent storage mappings might execute <code>tstore<\/code> instructions instead, leaving permanent approvals entirely intact on-chain.<\/p>\n<p>Despite the high internal severity rating assigned by the Solidity team, comprehensive ecosystem audits revealed a remarkably low real-world impact. Following the disclosure, a coordinated security effort involving SEAL 911, Etherscan, Dedaub, and Hexens was launched to scan all EVM-compatible chains for deployed contracts matching the vulnerable pattern. The investigation identified only three deployed contracts across the entire ecosystem. The respective development teams were immediately notified, and mitigating measures were deployed. None of the affected contracts were associated with prominent public applications operating in active production environments with external user interactions, and the total value of funds at risk was negligible.<\/p>\n<p>Project maintainers seeking to determine whether their codebases are affected can review their build configurations for the <code>--via-ir<\/code> flag across versions 0.8.28 to 0.8.33. Developers utilizing these versions who rely on transient storage deletion are strongly advised to upgrade their compiler toolchain to Solidity 0.8.34 or later immediately. Furthermore, teams can inspect unoptimized Yul outputs generated via the <code>--ir<\/code> flag to verify whether persistent and transient clearing operations share unified helper functions. Upgrading to the patched compiler version automatically resolves the naming collision by establishing distinct Yul function identifiers for persistent and transient storage operations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A high-severity bug within the Solidity code generator has been officially uncovered and patched, affecting compiler versions 0.8.28 through 0.8.33 when utilizing the intermediate representation (IR) compilation pipeline. The vulnerability, first reported by blockchain security firm Hexens on February 11, 2026, causes the compiler to emit incorrect EVM opcodes when a smart contract clears both<\/p>\n","protected":false},"author":27,"featured_media":4727,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[366],"tags":[401,1184,1316,201,2259,5,1551,400,402,517,2686,2465,685],"class_list":["post-4728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-smart-contract-auditing","tag-auditing","tag-compiler","tag-contracts","tag-critical","tag-pipeline","tag-security","tag-smart","tag-smart-contracts","tag-solidity","tag-storage","tag-threatens","tag-transient","tag-using"],"_links":{"self":[{"href":"https:\/\/wyominginvest.com\/index.php?rest_route=\/wp\/v2\/posts\/4728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wyominginvest.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wyominginvest.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wyominginvest.com\/index.php?rest_route=\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/wyominginvest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4728"}],"version-history":[{"count":0,"href":"https:\/\/wyominginvest.com\/index.php?rest_route=\/wp\/v2\/posts\/4728\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wyominginvest.com\/index.php?rest_route=\/wp\/v2\/media\/4727"}],"wp:attachment":[{"href":"https:\/\/wyominginvest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wyominginvest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wyominginvest.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}