Classic Buffer Overflow Affecting vyper package, versions [0.3.2,0.4.0)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.1% (43rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-VYPER-6179658
  • published19 Jan 2024
  • disclosed18 Jan 2024
  • creditcyberthirst

Introduced: 18 Jan 2024

CVE-2024-22419  (opens in a new tab)
CWE-120  (opens in a new tab)

How to fix?

Upgrade vyper to version 0.4.0 or higher.

Overview

vyper is a Pythonic Smart Contract Language for the EVM.

Affected versions of this package are vulnerable to Classic Buffer Overflow via the concat built-in function. An attacker can alter the contract's intended behavior, that may overwrite valid data, leading to unexpected outcomes.

PoC

@internal
def bar() -> uint256:
    sss: String[2] = concat("a", "b") 
    return 1


@external
def foo() -> int256:
    a: int256 = -1
    b: uint256 = self.bar()
    return a 

@external
def __init__():
    i = -1
    s: String[2] = concat("a", "b")

@external
def foo() -> int256:
    return i

CVSS Scores

version 3.1