CVE-2025-47285: Vyper Package - Side Effects Elision in concat() for Zero-Length Arguments
Summary
CVE-2025-47285: Vyper's concat() builtin may elide side-effects for zero-length arguments. Affects vyper versions < 0.4.2rc1. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Vyper is a Python-based programming language designed for writing smart contracts on the Ethereum blockchain. It emphasizes security, simplicity, and auditability, making it a popular choice among developers in the decentralized finance (DeFi) space. However, like any software, it is not immune to vulnerabilities. This specific issue arises from the behavior of the concat() function, which may inadvertently skip the evaluation of side effects when zero-length arguments are involved.
Vulnerability Detail
The vulnerability in Vyper's concat() function stems from a fastpath implementation that bypasses the evaluation of argument expressions when their length is zero. This can lead to unintended consequences, particularly when side effects are expected from expressions that result in zero-length bytestrings. For example, if a developer uses a conditional expression that includes a side effect, such as incrementing a counter, the side effect may not execute if the result is a zero-length bytestring. This could lead to unexpected behavior in smart contracts, potentially affecting their functionality and security.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
As a workaround, developers should avoid using expressions with side effects when constructing zero-length bytestrings. For example, instead of using a conditional expression that may result in a zero-length bytestring, consider restructuring the code to eliminate side effects in such expressions. Here is an example of a problematic code snippet:
counter: public(uint256)
@external
def test() -> Bytes[256]:
a: Bytes[256] = concat(b"" if self.sideeffect() else b"", b"aaaa")
return a
def sideeffect() -> bool:
self.counter += 1
return True
Instead, ensure that side effects are handled separately from zero-length bytestring constructions.
Conclusion
The vulnerability identified as CVE-2025-47285 in the Vyper package highlights a potential issue with the concat() function that may elide side effects when zero-length arguments are used. While the severity is low, it is crucial for developers to understand the implications and take necessary actions to mitigate risks by updating to the patched version or applying workarounds.
See every vulnerability recorded for vyper →
FAQ
The vulnerability allows the concat() function to skip the evaluation of side effects when zero-length arguments are passed, which can lead to unexpected behavior.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
If immediate updating is not possible, avoid using expressions with side effects when constructing zero-length bytestrings as a temporary measure.
The severity is classified as low, as the pattern leading to this issue is uncommon in user code.
Additional information can be found in the GitHub pull request linked in the vulnerability details: https://github.com/vyperlang/vyper/pull/4644.
References
Related vulnerabilities
Recent vulnerabilities recorded for vyper.