Improper Input Validation Affecting vyper package, versions [0.3.4,0.4.0)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.04% (10th 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 ID SNYK-PYTHON-VYPER-6674048
  • published 26 Apr 2024
  • disclosed 25 Apr 2024
  • credit cyberthirst

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 Improper Input Validation due to the use of slice builtin can result in a double eval vulnerability when the buffer argument is either msg.data, self.code or

.code and either the start or length arguments have side-effects.

PoC


l: DynArray[uint256, 10]

@external
def foo(cs: String[64]) -> uint256:
    for i in range(10):
        self.l.append(1)
    assert len(self.l) == 10
    s: Bytes[64] = b""
    s = slice(msg.data, self.l.pop(), 3)
    assert len(self.l) == 10 - 2
    return len(self.l)

CVSS Scores

version 3.1
Expand this section

Snyk

Recommended
5.3 medium
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    None
  • Integrity (I)
    Low
  • Availability (A)
    None