GHSA-j2x6-9323-fp7h

Suggest an improvement
Source
https://github.com/advisories/GHSA-j2x6-9323-fp7h
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/04/GHSA-j2x6-9323-fp7h/GHSA-j2x6-9323-fp7h.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-j2x6-9323-fp7h
Aliases
Related
Published
2022-04-22T20:24:13Z
Modified
2023-11-01T04:58:10.723424Z
Severity
  • 8.8 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H CVSS Calculator
Summary
Integer bounds error in Vyper
Details

Impact

in the following code, the return of <iface>.returns_int128() is not validated to fall within the bounds of int128. as of v0.3.0, <iface>.returns_int128() is validated in simple expressions, but not complex expressions.

interface iface:
    def returns_int128() -> int128: view
    def returns_Bytes33() -> Bytes[33]: view

x: iface

@external
def call_out():
    x: int128 = self.x.returns_int128()  # affected, &lt;0.3.0
    y: uint256 = convert(self.x.returns_int128(), uint256)  # affected, &lt;0.3.2
    z: Bytes[33] = concat(self.x.returns_Bytes33(), b"")  # affected >= 0.3.0, &lt;0.3.2

Patches

0.3.2 (as of https://github.com/vyperlang/vyper/commit/049dbdc647b2ce838fae7c188e6bb09cf16e470b)

Workarounds

Break up operations involving external calls into multiple statements. For instance, instead of the example above, use

x: int128 = self.x.returns_int128()
y: uint256 = convert(x, uint256)
Database specific
{
    "nvd_published_at": "2022-04-13T22:15:00Z",
    "github_reviewed_at": "2022-04-22T20:24:13Z",
    "severity": "HIGH",
    "github_reviewed": true,
    "cwe_ids": [
        "CWE-190"
    ]
}
References

Affected packages

PyPI / vyper

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.3.2

Affected versions

0.*

0.1.0b1
0.1.0b2
0.1.0b3
0.1.0b4
0.1.0b5
0.1.0b6
0.1.0b7
0.1.0b8
0.1.0b9
0.1.0b10
0.1.0b11
0.1.0b12
0.1.0b13
0.1.0b14
0.1.0b15
0.1.0b16
0.1.0b17
0.2.1
0.2.2
0.2.3
0.2.4
0.2.5
0.2.6
0.2.7
0.2.8
0.2.9
0.2.10
0.2.11
0.2.12
0.2.13
0.2.14
0.2.15
0.2.16
0.3.0
0.3.1