GHSA-375m-5fvv-xq23: VVE-2021-0002 Incorrect `returndatasize` When Using Simple Vulnerability

LOW
CWE-20
Published
Advisory Summary

GHSA-375m-5fvv-xq23 is a LOW incorrect `returndatasize` when using simple vulnerability (CWE-20: Improper Input Validation) affecting VVE-2021-0002 libraries in the PyPI ecosystem. The issue involves incorrect `returndatasize` when using simple forwarder proxies deployed prior to eip-1167 adoption. Remediation is available by upgrading affected packages to version 0.2.9.

GHSA-375m-5fvv-xq23 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-375m-5fvv-xq23
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product VVE-2021-0002
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix GHSA-375m-5fvv-xq23

To remediate this vulnerability, upgrade all affected VVE-2021-0002 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.2.9
pip install vyper>=0.2.9
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 GHSA-375m-5fvv-xq23, inspect your installed packages using pip:

pip show vyper

Analyze the terminal output to locate any version of VVE-2021-0002 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.9), 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In VVE-2021-0002, 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

## Background @tjayrush reported a data handling issue with certain Web3 libraries using Vyper-deploy forwarder proxy contracts using our Vyper's built-in `create_forwarder_to` function prior to our change to support EIP-1167 style forwarder proxies. ### Impact If you are an end user of a forwarder-style proxy deployed using Vyper's built-in `create_forwarder_to` function AND you have a function that returns >4096 bytes AND you do no return data sanitation on the value returned, you could potentially see a data corruption issue. Otherwise, if you are handling the result of a return call AND you expect a specific `RETURNDATASIZE` that is less than 4096 (such as `SafeERC20.safeTransfer`) then the call will fail that check. ### Patches The issue was patched when we upgraded to EIP-1167 style forwarder proxies in #2281. ### Workarounds If you are making a call to a contract method that is expected to return <= 4096 bytes, there is no issue as the ABI decoders in both Solidity and Vyper will truncate the data properly. Web3 libraries will also do this, unless you are doing `eth_call` or `eth_sendTransaction` directly. If you are using a Solidity library that checks `RETURNDATASIZE` of an external call to a forwarder proxy deployed prior to this patch, it will fail on that assertion (such as `SafeERC20.safeTransfer`). The workaround is to always do a greater than or equal to check, rather than a strict equals to check.

GHSA-375m-5fvv-xq23 Affected VVE-2021-0002 Versions

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

References

Frequently Asked Questions

What is GHSA-375m-5fvv-xq23?
GHSA-375m-5fvv-xq23 is a security vulnerability in VVE-2021-0002 involving Incorrect `returndatasize` when using simple forwarder proxies deployed prior to EIP-1167 adoption under CWE-20: Improper Input Validation.
Which VVE-2021-0002 versions are affected?
Affected versions include releases prior to 0.2.9 across affected packages: vyper.
What version fixes GHSA-375m-5fvv-xq23?
Upgrading to 0.2.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vyper affected?
Yes, vyper is affected in releases prior to 0.2.9. Upgrade your dependency to 0.2.9 or later.
What CWE is associated with GHSA-375m-5fvv-xq23?
GHSA-375m-5fvv-xq23 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check PyPI dependencies for GHSA-375m-5fvv-xq23?
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-375m-5fvv-xq23",
  "modified" : "2021-04-16T23:17:39Z",
  "published" : "2021-04-19T15:11:54Z",
  "aliases" : [ ],
  "summary" : "VVE-2021-0002: Incorrect `returndatasize` when using simple forwarder proxies deployed prior to EIP-1167 adoption",
  "details" : "## Background\n\n@tjayrush reported a data handling issue with certain Web3 libraries using Vyper-deploy forwarder proxy contracts using our Vyper's built-in `create_forwarder_to` function prior to our change to support EIP-1167 style forwarder proxies.\n\n### Impact\nIf you are an end user of a forwarder-style proxy deployed using Vyper's built-in `create_forwarder_to` function AND you have a function that returns >4096 bytes AND you do no return data sanitation on the value returned, you could potentially see a data corruption issue.\n\nOtherwise, if you are handling the result of a return call AND you expect a specific `RETURNDATASIZE` that is less than 4096 (such as `SafeERC20.safeTransfer`) then the call will fail that check.\n\n### Patches\nThe issue was patched when we upgraded to EIP-1167 style forwarder proxies in #2281.\n\n### Workarounds\nIf you are making a call to a contract method that is expected to return <= 4096 bytes, there is no issue as the ABI decoders in both Solidity and Vyper will truncate the data properly. Web3 libraries will also do this, unless you are doing `eth_call` or `eth_sendTransaction` directly.\n\nIf you are using a Solidity library that checks `RETURNDATASIZE` of an external call to a forwarder proxy deployed prior to this patch, it will fail on that assertion (such as `SafeERC20.safeTransfer`). The workaround is to always do a greater than or equal to check, rather than a strict equals to check.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "vyper"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vyperlang/vyper/security/advisories/GHSA-375m-5fvv-xq23"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vyperlang/vyper/pull/2281"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/vyper"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-04-16T23:17:39Z",
    "nvd_published_at" : null
  }
}