Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-114115 Overview
CVE-2026-114115 is a compiler miscompilation vulnerability in the Vyper smart contract language affecting versions 0.3.8 through 0.5.0b1. The flaw resides in the parse_IfExp code generation path, which handles ternary expressions. When a ternary selects between nested arrays with differing inner bounds, the compiler reads the narrower array using the wider result type's memory layout. This mismatch causes inner arrays after the first element to be read at incorrect memory offsets. Deployed contracts may silently store corrupted values or revert unexpectedly, undermining contract correctness and asset integrity. The issue is classified under [CWE-843] (Access of Resource Using Incompatible Type, also known as type confusion).
Critical Impact
Smart contracts compiled with vulnerable Vyper versions can silently corrupt stored values when ternary expressions operate on nested arrays with mismatched bounds.
Affected Products
- Vyper compiler versions 0.3.8 through 0.5.0b1
- Ethereum smart contracts compiled with affected Vyper versions that use ternary expressions returning nested arrays (DynArray or SArray) with differing inner bounds
- Downstream protocols and dApps relying on contracts emitted by affected compiler versions
Discovery Timeline
- 2026-10-21 - CVE-2026-114115 published to the National Vulnerability Database
- 2026-10-22 - Last updated in NVD database
Technical Details for CVE-2026-114115
Vulnerability Analysis
The defect lives in Vyper's code generation for ternary (if/else) expressions. When a ternary returns an array type, the compiler computes a result type wide enough to hold either arm. However, when one arm holds a narrower nested array, the generated code reads that arm using the strides and offsets of the wider result type. For nested containers such as DynArray[Bytes[10], 5] versus DynArray[Bytes[512], 5], the element stride differs significantly. Reading the narrower layout with wider strides produces values pulled from unrelated memory. Depending on content, the contract either stores corrupted data or reverts due to invalid bounds. The error is purely at the compiler level, so source code review of the Vyper contract cannot surface the flaw.
Root Cause
The root cause is a missing type-layout compatibility check in parse_IfExp within vyper/codegen/expr.py and supporting helpers in vyper/codegen/core.py. The compiler assumed that any two types reaching a common result type were layout-compatible. For nested arrays this assumption is false because element width determines stride and inner offsets.
Attack Vector
Exploitation does not require a direct network payload against the Vyper toolchain. Instead, an attacker interacts with a deployed contract whose compiled bytecode contains the miscompiled ternary. Any caller invoking a function that returns, assigns, or stores the result of such a ternary can trigger the misread. The outcome is contract-defined: silent state corruption, incorrect transfer amounts, or denial of service through unexpected reverts.
# Patch excerpt - vyper/codegen/core.py
# Adds punnable() to verify layout compatibility between source and destination types.
def punnable(src_typ, dst_typ):
"""
Return True if memory laid out as `src_typ` can be read (punned) as `dst_typ`.
Compatible types can differ in element or member layout, e.g.
DynArray[Bytes[10], 5] vs DynArray[Bytes[512], 5] (element stride 64
vs 544). A wider bytestring bound or DynArray capacity at the top level
does not change the layout of the data that is present.
"""
if isinstance(dst_typ, (DArrayT, SArrayT)):
assert isinstance(src_typ, (DArrayT, SArrayT))
pairs = [(src_typ.value_type, dst_typ.value_type)]
elif isinstance(dst_typ, TupleT):
assert isinstance(src_typ, TupleT)
n = len(dst_typ.member_types)
assert len(src_typ.member_types) == n
pairs = [(src_typ.member_types[i], dst_typ.member_types[i]) for i in range(n)]
else:
# primitive words, bytestrings ([length][data]) and (nominal) structs
return True
# nested values also need equal sizes: they determine strides and offsets
return all(
s.memory_bytes_required == d.memory_bytes_required and punnable(s, d) for s, d in pairs
)
Source: GitHub commit 1fb7dfe2. The patch introduces a punnable() helper that walks nested array and tuple types, verifying each pair has equal memory_bytes_required. When types are not punnable, the compiler now widens the arm into a fresh buffer using create_memory_copy rather than reading in place.
Detection Methods for CVE-2026-114115
Indicators of Compromise
- Unexpected revert events emitted from contract functions that return or assign nested arrays via ternary expressions.
- On-chain state transitions where stored array elements contain non-zero bytes that do not match any user-supplied input.
- Transactions reverting at opcodes associated with memory copy or array access rather than business logic checks.
Detection Strategies
- Enumerate deployed Vyper contracts and extract the compiler version from the metadata hash or deployment pipeline logs; flag any version in the 0.3.8 to 0.5.0b1 range.
- Perform static analysis of Vyper source for if/else expressions whose arms return DynArray or SArray types with differing inner bounds.
- Re-compile affected contracts with a patched Vyper release and diff the resulting bytecode to confirm the ternary code path has changed.
Monitoring Recommendations
- Instrument transaction monitoring to alert on anomalous revert rates for contracts identified as vulnerable.
- Monitor contract storage slots for silent writes that do not correlate with legitimate business events.
- Track dependency manifests in CI/CD so that any merge introducing a vulnerable Vyper version triggers a build-time alert.
How to Mitigate CVE-2026-114115
Immediate Actions Required
- Upgrade Vyper to a version containing commit 1fb7dfe2 and recompile all affected contracts before redeployment.
- Inventory every production contract compiled with versions 0.3.8 through 0.5.0b1 and prioritize those using ternary expressions on nested arrays.
- For contracts that cannot be redeployed, pause privileged functions that rely on nested-array ternary results until a migration path exists.
Patch Information
The fix is published in commit 1fb7dfe2 and tracked in GitHub Security Advisory GHSA-cw3h-xwxq-8cx2. Additional analysis is available in the VulnCheck advisory. The patch widens ternary arms to the result-type layout by introducing a punnable() layout check and using create_memory_copy when the narrower arm cannot be read in place.
Workarounds
- Refactor affected Vyper source to replace ternary expressions on nested arrays with explicit if/else statements that assign to a single typed variable.
- Normalize array bounds across both arms of a ternary so that source and destination layouts are identical.
- Pin build systems to a patched Vyper release and reject compilation when a vulnerable version is detected.
# Example CI guard: fail the build if a vulnerable Vyper version is in use
VYPER_VERSION=$(vyper --version | awk '{print $1}')
case "$VYPER_VERSION" in
0.3.8|0.3.9|0.3.10|0.4.*|0.5.0b1)
echo "ERROR: Vyper $VYPER_VERSION is vulnerable to CVE-2026-114115"
exit 1
;;
esac
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

