A critical software flaw affecting the Solidity code generator has been officially disclosed following a report submitted through the Ethereum Foundation’s bug bounty program. Discovered by developer Shaheen Fazim on August 14, 2026, the vulnerability resides within how the compiler handles memory management when the delete operator is applied to specific elements of dynamic byte arrays. The issue leads to unintended memory overwrites, posing a potential risk to data integrity within smart contracts compiled under affected versions. Fortunately, a fix has been swiftly developed and released, with developers urged to update their toolchains.
The underlying flaw manifests when the delete instruction is invoked on an element of a bytes or string array located in memory. Instead of correctly clearing solely the designated element, the code generated by the default evmasm pipeline writes 32 zero bytes starting precisely at the target index. This expansive write operation inadvertently clears up to 31 bytes following the targeted element. Depending on the array’s layout, this overflow can destroy subsequent data residing elsewhere within the same array or spill over into adjacent memory allocations located immediately after the array. Interestingly, the equivalent manual assignment operation, such as setting b[i] = 0, remains completely unaffected and correctly clears exactly one byte as intended.
Ethereum Foundation maintainers have assessed this vulnerability as having a low-to-medium severity rating on their internal scale. Crucially, the defect is strictly confined to the default evmasm compilation pipeline; the alternative IR pipeline remains entirely unaffected. Furthermore, the activation of the optimizer is not required for the bug to trigger. The vulnerable code path has a remarkably long history, predating the very first public release of Solidity itself. Consequently, all compiler versions up to and including version 0.8.36 are vulnerable. The issue has been officially addressed and resolved in Solidity version 0.8.37.
To gauge the real-world impact of the vulnerability, the development team conducted a comprehensive scan of the Sourcify database, analyzing approximately 870,000 verified smart contract compilations to search for the specific source pattern that triggers the bug. The problematic pattern was identified in a mere 17 compilations, encompassing only two distinct functions. A deeper security assessment revealed that neither of these functions was actually compromised in practice. In both instances, the bytes overwritten inside the array were either immediately discarded or deleted anyway, while allocations sitting beyond the arrays were either protected by structural design or pointed to completely unused memory space. To date, no deployed production contracts are known to have suffered malicious exploitation or unintended corruption as a result of this bug.
Which Contracts Are Affected?
Understanding the precise conditions under which a smart contract becomes vulnerable is vital for developers auditing existing codebases. A contract is only susceptible to this memory corruption issue if a precise combination of factors aligns during compilation and execution.
First and foremost, the contract must be compiled using an affected version of Solidity, spanning versions 0.8.36 and all prior iterations. Second, the compilation must utilize the default evmasm pipeline rather than the IR pipeline. Third, the contract must explicitly apply the delete operator to an element of a memory-resident bytes array or a converted string variable. If a smart contract never applies the delete operation to individual elements of memory byte arrays or strings, it remains completely safe from this defect.
It is worth noting that neither the compiler optimizer nor the target Ethereum Virtual Machine (EVM) version alters how the bug manifests. The defect is baked directly into the machine instructions emitted during the code generation stage, and the optimizer merely preserves these faulty semantics.
A closer examination of the compiler behavior clarifies several operational boundaries. Only individual element deletions are impacted; invoking delete b on an entire array routes through a separate, fully functioning code path. Furthermore, the array must reside in memory. Byte arrays stored in persistent storage operate through entirely independent routines and are completely unaffected, while calldata arrays cannot accept the delete operator at all. Additionally, arrays whose elements each occupy a full 32-byte word in memory, such as bytes1[] memory, are immune because only dynamic bytes and string types pack their underlying elements tightly back-to-back without spacing.
String values are equally vulnerable due to their underlying representation. While standard syntax prevents direct index deletion on a string memory variable, developers frequently cast strings to bytes type for manipulation. Executing delete bytes(s)[i] on a cast string triggers the exact same faulty code path, modifying the string’s internal memory in place. Conversely, fixed-size byte types like bytes32 are unaffected because indexing them yields an isolated copy of the byte rather than a mutable reference to underlying memory.
Technical Details and Compiler Internals

To fully comprehend why this memory corruption occurs, it is helpful to examine the low-level memory layout utilized by the Solidity compiler. Most complex values in memory occupy standardized, full 32-byte words. Dynamic byte arrays represent a major exception to this rule. A memory byte array consists of a 32-byte length header followed immediately by raw data bytes packed back-to-back without internal padding gaps.
Solidity manages memory allocation by sequentially advancing a global free memory pointer, ensuring that each new allocation begins exactly where the previous one concluded. As a result, consecutive declarations sit flush against one another, meaning any write operation that overshoots the boundaries of one allocation spills directly into the next.
For many common allocations, such as arrays initialized via new bytes(n) or static literals, the compiler appends up to 31 zero bytes of padding at the conclusion of the data so that subsequent allocations always align cleanly on a 32-byte word boundary. These are classified as padded arrays. However, the legacy evmasm pipeline does not pad the output of dynamic routines like bytes.concat, string.concat, or family variants of abi.encode. In these cases, the array data terminates abruptly where the next memory allocation begins, creating unpadded arrays where any overflow immediately endangers adjacent variables.
Because individual elements within a packed byte array occupy only a single byte, storing data to memory deviates from standard full-word operations. The compiler ordinarily handles this by issuing a single-byte store instruction (mstore8) whenever it recognizes the precise element width. However, the internal implementation of the delete operation bypasses this safety check.
While both delete b[i] and b[i] = 0 share the ultimate goal of assigning a zero value to a specific index, they diverged significantly in the evmasm pipeline. Standard assignment correctly resolves to a single-byte store (mstore8), whereas the delete routine incorrectly routed through a full 32-byte zero-write instruction (mstore). Because this 32-byte write initiates directly at the element index rather than aligning to a word boundary, it stretches far beyond the target element.
Crucially, the array’s length header—which resides immediately before the data block—is untouched by this process. Consequently, the array retains its original length value. Any subsequent operations relying on the array contents, such as hashing via keccak256, ABI encoding routines, or returning data to an external caller, silently process the corrupted byte sequence without throwing errors. Meanwhile, the IR pipeline correctly shares the single-byte store mechanism across both assignment and deletion paths, insulating it from the bug.
Real-World Manifestation and Demonstration
The practical consequences of this compiler defect can be observed by examining how memory corruption manifests both internally within an array and externally beyond its boundaries.
When an element is deleted near the start or middle of an array, every subsequent element up to 31 positions ahead is forcefully overwritten with zeroes. Unless the array happens to naturally contain all-zero values beyond the deletion point, this alters the array’s contents immediately upon execution.
When the deletion targets one of the final elements of an array, the 32-byte write overflows past the array’s allocated space. For padded arrays, the trailing padding absorbs a portion of the overflow, limiting the damage depending on the array’s precise length. Arrays with lengths that are exact multiples of 32 lack padding entirely, leaving them fully exposed. When an overflow reaches an adjacent memory variable, the extent of the corruption depends on the data type stored there. Left-aligned values lose their most significant bytes, while right-aligned values like integers or memory pointers experience partial or total erasure depending on how far the write reaches.
The discovery of this issue underscores the complex challenges inherent in compiler engineering, particularly within legacy code paths designed to optimize EVM execution. By closing the gap between the assignment and deletion code paths in version 0.8.37, the Solidity development team has restored strict type and memory safety to dynamic byte array operations. Developers maintaining active smart contract projects are advised to review their toolchains, verify compiler configurations, and upgrade to version 0.8.37 or later to ensure complete protection against unintended memory mutations.






