CVE-2023-42441: Vyper reentrancy lock bypass with empty string key

CVE-2023-42441 · Severity: low · CVSS 3.1 · Published 2023-09-18

Vyper is a Python-based smart contract programming language for Ethereum. The @nonreentrant decorator is designed to prevent reentrancy attacks, a critical security vulnerability in blockchain contracts. When developers accidentally use an empty string as the lock key (e.g., @nonreentrant("")), the decorator fails silently and provides no reentrancy protection, leaving smart contracts vulnerable to exploitation.

Technologies: vyper (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2023-42441 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-42441 being exploited in the wild.
How severe is CVE-2023-42441?
Low severity, with a CVSS score of 3.1, published 18 September 2023.
Which products and versions are affected?
vyper (PyPI) ECOSYSTEM:introduced=0.2.9,fixed=0.3.10, GIT:introduced=0,fixed=0b740280c1e3c5528a20d47b29831948ddcc6d83|ECOSYSTEM:introduced=0.2.9,fixed=0.3.10.
Is there a fix for CVE-2023-42441?
Yes. vyper (PyPI): upgrade to 0.3.10 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2023-42441 attacked?
It is attacked over the network.
Am I affected by CVE-2023-42441?
Check whether you run vyper (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • vyper (PyPI): upgrade to 0.3.10 or later
    pip install "vyper>=0.3.10"

Technical details

The vulnerability is a logic error in Vyper's reentrancy lock implementation where empty-string lock keys are not validated. When @nonreentrant("") or @nonreentrant('') is used, the decorator does not generate any runtime reentrancy checks, contrary to the developer's intent. The attack vector requires network access to call the unprotected function, with no authentication required. An attacker can invoke the vulnerable function multiple times in the same transaction context to perform reentrancy attacks and manipulate contract state or steal funds. The vulnerability was patched in Vyper 0.3.10 (PR #3605), and the workaround is to use a non-empty string for lock keys.

Affected products

  • Vyper Vyper >=0.2.9, <0.3.10

Identifiers

  • CVE-2023-42441
  • GHSA-3hg2-r75x-g69m
  • PYSEC-2023-305

Timeline

  • 2023-09-18: disclosed
  • 2023-09-18: patched: Patched in version 0.3.10

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.