GHSA-7VRM-3JC8-5WWM

Vulnerability from github – Published: 2022-04-04 21:40 – Updated: 2022-04-06 17:39
VLAI?
Summary
Incorrect Comparison in Vyper
Details

Impact

bytestrings can have dirty bytes in them, resulting in the word-for-word comparison to give incorrect results, e.g.

b1: Bytes[32] = b"abcdef"
b1 = slice(b1, 0, 1)
b2: Bytes[32] = b"abcdef"
t: bool = b1 == b2  # incorrectly evaluates to True

even without dirty nonzero bytes, because there is no comparison of the length, two bytestrings can compare to equal if one ends with "\x00".

b1: Bytes[32] = b"abc\0"
b2: Bytes[32] = b"abc"
t: bool = b1 == b2  # incorrectly evaluates to True

Patches

fixed in https://github.com/vyperlang/vyper/commit/2c73f8352635c0a433423a5b94740de1a118e508

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "vyper"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.3.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [],
  "database_specific": {
    "cwe_ids": [
      "CWE-697"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-04-04T21:40:45Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Impact\nbytestrings can have dirty bytes in them, resulting in the word-for-word comparison to give incorrect results, e.g.\n```vyper\nb1: Bytes[32] = b\"abcdef\"\nb1 = slice(b1, 0, 1)\nb2: Bytes[32] = b\"abcdef\"\nt: bool = b1 == b2  # incorrectly evaluates to True\n```\neven without dirty nonzero bytes, because there is no comparison of the length, two bytestrings can compare to equal if one ends with `\"\\x00\"`.\n```vyper\nb1: Bytes[32] = b\"abc\\0\"\nb2: Bytes[32] = b\"abc\"\nt: bool = b1 == b2  # incorrectly evaluates to True\n```\n\n### Patches\nfixed in https://github.com/vyperlang/vyper/commit/2c73f8352635c0a433423a5b94740de1a118e508",
  "id": "GHSA-7vrm-3jc8-5wwm",
  "modified": "2022-04-06T17:39:02Z",
  "published": "2022-04-04T21:40:45Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/vyperlang/vyper/security/advisories/GHSA-7vrm-3jc8-5wwm"
    },
    {
      "type": "WEB",
      "url": "https://github.com/vyperlang/vyper/commit/2c73f8352635c0a433423a5b94740de1a118e508"
    },
    {
      "type": "WEB",
      "url": "https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2022-196.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:N/S:U/C:N/I:H/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Incorrect Comparison 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 observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…