{"id":"GHSA-7vrm-3jc8-5wwm","summary":"Incorrect Comparison in Vyper","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","aliases":["CVE-2022-24787","PYSEC-2022-196"],"modified":"2024-12-05T05:47:08.393067Z","published":"2022-04-04T21:40:45Z","database_specific":{"nvd_published_at":null,"cwe_ids":["CWE-697"],"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"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"}],"affected":[{"package":{"name":"vyper","ecosystem":"PyPI","purl":"pkg:pypi/vyper"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.3.2"}]}],"versions":["0.1.0b1","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.1.0b2","0.1.0b3","0.1.0b4","0.1.0b5","0.1.0b6","0.1.0b7","0.1.0b8","0.1.0b9","0.2.1","0.2.10","0.2.11","0.2.12","0.2.13","0.2.14","0.2.15","0.2.16","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.3.0","0.3.1"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/04/GHSA-7vrm-3jc8-5wwm/GHSA-7vrm-3jc8-5wwm.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"}]}