{"id":"CVE-2022-24787","aliases":["GHSA-7vrm-3jc8-5wwm","PYSEC-2022-196"],"url":"https://o3.security/vulnerability/CVE-2022-24787","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","published":"2022-04-04T17:35:10Z","modified":"2026-08-12T03:51:48.002768354Z","cvss":{"score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"PyPI","name":"vyper","fixedVersion":"0.3.2"}],"fix":{"url":"https://github.com/vyperlang/vyper/commit/2c73f8352635c0a433423a5b94740de1a118e508","label":"vyperlang/vyper@2c73f83"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/24xxx/CVE-2022-24787.json"},{"type":"ADVISORY","url":"https://github.com/vyperlang/vyper/security/advisories/GHSA-7vrm-3jc8-5wwm"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24787"},{"type":"FIX","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"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:48.002768354Z"}}