ghsa-7vrm-3jc8-5wwm
Vulnerability from github
Published
2022-04-04 21:40
Modified
2022-04-06 17:39
Severity ?
VLAI Severity ?
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.
vyper
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".
vyper
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
{
"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"
}
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.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- 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.
Loading…
Loading…