---
id: CVE-2023-39363
aliases:
  - GHSA-5824-cm3x-3c38
  - PYSEC-2023-142
title: Vyper has incorrectly allocated named re-entrancy locks
summary: Vyper has incorrectly allocated named re-entrancy locks
severity: high
cvss: 8.7
cvssVector: 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:H'
vendor: vyper
product: vyper
ecosystem: pip
affected:
  - 'vyper >= 0.2.15, < 0.3.1'
patched:
  - vyper 0.3.1
published: '2023-08-09'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T03:49:57.451549676Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-5824-cm3x-3c38'
references:
  - url: 'https://github.com/vyperlang/vyper/security/advisories/GHSA-5824-cm3x-3c38'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2023-39363'
  - url: 'https://github.com/vyperlang/vyper/pull/2439'
  - url: 'https://github.com/vyperlang/vyper/pull/2514'
  - url: >-
      https://github.com/pypa/advisory-database/tree/main/vulns/vyper/PYSEC-2023-142.yaml
  - url: 'https://github.com/vyperlang/vyper'
  - url: 'https://hackmd.io/@LlamaRisk/BJzSKHNjn'
  - url: 'https://hackmd.io/@vyperlang/HJUgNMhs2'
tags:
  - osv
  - pip
epss: 0.00821
epssPercentile: 0.55484
ingestedAt: '2026-09-12T03:13:01.659Z'
---

## Overview

### Impact

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 either of the following `vyper` versions: `0.2.15`, `0.2.16`, `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)
- A secondary function that utilizes the same `key` and would be affected by the improper state caused by the primary function

### Patches
https://github.com/vyperlang/vyper/pull/2439, https://github.com/vyperlang/vyper/pull/2514

### Workarounds
Upgrade to 0.3.1 or higher

### References
Technical post-mortem report: https://hackmd.io/@vyperlang/HJUgNMhs2

## Affected packages

- `vyper >= 0.2.15, < 0.3.1`

## Remediation

Upgrade to a patched release:

- `vyper 0.3.1`
