ghsa-j2x6-9323-fp7h
Vulnerability from github
Published
2022-04-22 20:24
Modified
2022-04-22 20:24
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. ```vyper 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, <0.3.0 y: uint256 = convert(self.x.returns_int128(), uint256) # affected, <0.3.2 z: Bytes[33] = concat(self.x.returns_Bytes33(), b"") # affected >= 0.3.0, <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)

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "vyper"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.3.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2022-24845"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-190"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-04-22T20:24:13Z",
    "nvd_published_at": "2022-04-13T22:15:00Z",
    "severity": "HIGH"
  },
  "details": "### Impact\nin the following code, the return of `\u003ciface\u003e.returns_int128()` is not validated to fall within the bounds of `int128`. as of v0.3.0, `\u003ciface\u003e.returns_int128()` is validated in simple expressions, but not complex expressions.\n```vyper\ninterface iface:\n    def returns_int128() -\u003e int128: view\n    def returns_Bytes33() -\u003e Bytes[33]: view\n\nx: iface\n \n@external\ndef call_out():\n    x: int128 = self.x.returns_int128()  # affected, \u003c0.3.0\n    y: uint256 = convert(self.x.returns_int128(), uint256)  # affected, \u003c0.3.2\n    z: Bytes[33] = concat(self.x.returns_Bytes33(), b\"\")  # affected \u003e= 0.3.0, \u003c0.3.2\n```\n\n### Patches\n0.3.2 (as of https://github.com/vyperlang/vyper/commit/049dbdc647b2ce838fae7c188e6bb09cf16e470b)\n\n### Workarounds\nBreak up operations involving external calls into multiple statements. For instance, instead of the example above, use\n```\nx: int128 = self.x.returns_int128()\ny: uint256 = convert(x, uint256)\n```",
  "id": "GHSA-j2x6-9323-fp7h",
  "modified": "2022-04-22T20:24:13Z",
  "published": "2022-04-22T20:24:13Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/vyperlang/vyper/security/advisories/GHSA-j2x6-9323-fp7h"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-24845"
    },
    {
      "type": "WEB",
      "url": "https://github.com/vyperlang/vyper/commit/049dbdc647b2ce838fae7c188e6bb09cf16e470b"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2022-198.yaml"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/vyperlang/vyper"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Integer bounds error in Vyper"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.