Summary
Vyper's sqrt doesn't define rounding behavior
Vyper's sqrt() builtin uses the babylonian method to calculate square roots of decimals. Unfortunately, improper handling of the oscillating final states may lead to sqrt incorrectly returning rounded up results.
the fix is tracked in https://github.com/vyperlang/vyper/pull/4486
Vulnerability Details
Vyper injects the following code to handle calculation of decimal sqrt. x is the input provided by user.
assert x >= 0.0
z: decimal = 0.0
if x == 0.0:
z = 0.0
else:
z = x / 2.0 + 0.5
y: decimal = x
for i: uint256 in range(256):
if z == y:
break
y = z
z = (x / z + z) / 2.0
Notably, the terminal condition of the algorithm is either z_cur == z_prev, or the algorithm runs for 256 rounds.
However, for certain inputs, z might actually oscillate between N and N + epsilon, where N ** 2 <= x < (N + epsilon) ** 2. This means that the current behavior does not define whether it will round up or down to the nearest epsilon.
The example snippet here returns 0.9999999999, the rounded up result for sqrt(0.9999999998). This is due to the oscillation ending in N + epsilon instead of N.
@external
def test():
d: decimal = 0.9999999998
r: decimal = sqrt(d) #this will be 0.9999999999
Note that sqrt() diverges from isqrt() here -- isqrt() consistently rounds down, so it is not subject to the same issue.
Impact Details
Since sqrt() can be used for determining boundary conditions, rounding down is preferred. However, since sqrt() is used very rarely in the wild, this advisory has been assigned an impact of low.
Impact
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2025-26622? CVE-2025-26622 is a low-severity security vulnerability in vyper (pip), affecting versions <= 0.4.0. It is fixed in 0.4.1.
- Which versions of vyper are affected by CVE-2025-26622? vyper (pip) versions <= 0.4.0 is affected.
- Is there a fix for CVE-2025-26622? Yes. CVE-2025-26622 is fixed in 0.4.1. Upgrade to this version or later.
- Is CVE-2025-26622 exploitable, and should I be worried? Whether CVE-2025-26622 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2025-26622 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2025-26622? Upgrade
vyperto 0.4.1 or later.