CVE-2023-42460: Vyper Vyper's `_abi_decode` Input Not Validated Vulnerability

MODERATE
Advisory Identifier: GHSA-cx2q-hfxr-rj97
CVSS 5.3
CWE-682
Published
Advisory Summary

CVE-2023-42460 is a MODERATE (CVSS 5.3) vyper's `_abi_decode` input not validated vulnerability (CWE-682: Incorrect Calculation) affecting Vyper libraries in the PyPI ecosystem. The issue involves vyper's `_abi_decode` input not validated in complex expressions. Remediation is available by upgrading affected packages to version 0.3.10.

CVE-2023-42460 at a Glance

CVE Identifier CVE-2023-42460
GHSA Identifier GHSA-cx2q-hfxr-rj97
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-682: Incorrect Calculation
Affected Product Vyper
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2023-42460

To remediate this vulnerability, upgrade all affected Vyper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

vyper fixed: 0.3.10
pip install vyper>=0.3.10
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show vyper

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-42460, inspect your installed packages using pip:

pip show vyper

Analyze the terminal output to locate any version of Vyper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.3.10), your application is affected.

Note: The pip show vyper command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-682: Incorrect Calculation, where the product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management. In Vyper, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact `_abi_decode()` does not validate input when it is nested in an expression. the following example gets correctly validated (bounds checked): ```vyper x: int128 = _abi_decode(slice(msg.data, 4, 32), int128) ``` however, the following example is not bounds checked ```vyper @external def abi_decode(x: uint256) -> uint256: a: uint256 = convert(_abi_decode(slice(msg.data, 4, 32), (uint8)), uint256) + 1 return a # abi_decode(256) returns: 257 ``` the issue can be triggered by constructing an example where the output of `_abi_decode` is not internally passed to `make_setter` (an internal codegen routine) or other input validating routine. ### Patches https://github.com/vyperlang/vyper/pull/3626 ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ ### References _Are there any links users can visit to find out more?_

CVE-2023-42460 Affected Vyper Versions

1 component(s)
Fixed Versions:
0.3.10
Product / Package Ecosystem Affected Versions Fixed Version
vyper
PyPI
≥ 0.3.4
< 0.3.10
0.3.10

References

Frequently Asked Questions

What is CVE-2023-42460?
CVE-2023-42460 is a security vulnerability in Vyper involving Vyper's `_abi_decode` input not validated in complex expressions under CWE-682: Incorrect Calculation.
Which Vyper versions are affected?
Affected versions include releases prior to 0.3.10 across affected packages: vyper.
What version fixes CVE-2023-42460?
Upgrading to 0.3.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vyper affected?
Yes, vyper is affected in releases prior to 0.3.10. Upgrade your dependency to 0.3.10 or later.
What is the CVSS score of CVE-2023-42460?
CVE-2023-42460 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2023-42460?
CVE-2023-42460 is classified under CWE-682: Incorrect Calculation (The product performs a calculation that generates incorrect or unintended results that are later used in security-critical decisions or resource management.).
How can I check PyPI dependencies for CVE-2023-42460?
Run the dependency tree command: 'pip show vyper'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-cx2q-hfxr-rj97",
  "modified" : "2024-11-19T17:23:02Z",
  "published" : "2023-09-26T19:34:53Z",
  "aliases" : [ "CVE-2023-42460" ],
  "summary" : "Vyper's `_abi_decode` input not validated in complex expressions",
  "details" : "### Impact\n`_abi_decode()` does not validate input when it is nested in an expression. the following example gets correctly validated (bounds checked):\n```vyper\nx: int128 = _abi_decode(slice(msg.data, 4, 32), int128)\n```\n\nhowever, the following example is not bounds checked\n```vyper\n@external\ndef abi_decode(x: uint256) -> uint256:\n    a: uint256 = convert(_abi_decode(slice(msg.data, 4, 32), (uint8)), uint256) + 1\n    return a  # abi_decode(256) returns: 257\n```\n\nthe issue can be triggered by constructing an example where the output of `_abi_decode` is not internally passed to `make_setter` (an internal codegen routine) or other input validating routine.\n\n### Patches\nhttps://github.com/vyperlang/vyper/pull/3626\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\n### References\n_Are there any links users can visit to find out more?_\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "vyper"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.3.4"
      }, {
        "fixed" : "0.3.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vyperlang/vyper/security/advisories/GHSA-cx2q-hfxr-rj97"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-42460"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vyperlang/vyper/pull/3626"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2023-191.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vyperlang/vyper"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-682" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-09-26T19:34:53Z",
    "nvd_published_at" : "2023-09-27T15:19:32Z"
  }
}