Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. vcrpy
  4. ›
  5. GHSA-rpj2-4hq8-938g

GHSA-rpj2-4hq8-938g: VCR.py: Arbitrary code execution via unsafe YAML deserialization of cassette files

June 19, 2026

vcrpy deserializes YAML cassette files with PyYAML’s object-constructing loader (yaml.CLoader / yaml.Loader) instead of the safe loader (yaml.CSafeLoader / yaml.SafeLoader). A cassette containing a !!python/object/apply: (or similar) tag therefore executes arbitrary Python code the moment the cassette is loaded — including through the normal VCR().use_cassette() path, before any HTTP interaction is replayed.

This is not limited to environments lacking the libYAML C extension. CLoader uses the C parser but PyYAML’s full Python constructor, so Python object tags execute under CLoader exactly as under the pure-Python Loader. Confirmed against vcrpy 8.1.1 + PyYAML 6.0.3 with CLoader active.

References

  • github.com/advisories/GHSA-rpj2-4hq8-938g
  • github.com/kevin1024/vcrpy/security/advisories/GHSA-rpj2-4hq8-938g

Code Behaviors & Features

Detect and mitigate GHSA-rpj2-4hq8-938g with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 8.2.1

Fixed versions

  • 8.2.1

Solution

Upgrade to version 8.2.1 or above.

Impact 7.8 HIGH

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-502: Deserialization of Untrusted Data

Source file

pypi/vcrpy/GHSA-rpj2-4hq8-938g.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sat, 20 Jun 2026 12:17:13 +0000.