# CVE-2023-49297: Unsafe YAML deserialization in PyDrive2

> A malicious YAML file in the working directory allows arbitrary code execution when initializing GoogleAuth in PyDrive2.

- **Severity:** Low 3.3 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 5 Dec 2023
- **Updated:** 13 Feb 2025
- **Also known as:** GHSA-v5f6-hjmf-9mc5, PYSEC-2023-291, UBUNTU-CVE-2023-49297, openSUSE-SU-2024:13493-1, openSUSE-SU-2026:12030-1

## What is CVE-2023-49297?

CVE-2023-49297 is a low-severity unsafe deserialization vulnerability in iterative PyDrive2, published on 5 Dec 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

PyDrive2 is a wrapper library of google-api-python-client that simplifies many common Google Drive API V2 tasks. Unsafe YAML deserilization will result in arbitrary code execution. A maliciously crafted YAML file can cause arbitrary code execution if PyDrive2 is run in the same directory as it, or if it is loaded in via `LoadSettingsFile`. This is a deserilization attack that will affect any user who initializes GoogleAuth from this package while a malicious yaml file is present in the same directory. This vulnerability does not require the file to be directly loaded through the code, only present. This issue has been addressed in commit `c57355dc` which is included in release version `1.16.2`. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2023-49297?

5 open source packages ship an affected version, including pydrive2 and PyDrive2. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pydrive2` | PyPI | All versions | None |
| `pydrive2` | PyPI | All versions | 1.16.2 |
| `pydrive2` | PyPI | All versions | 1.16.2 |
| `PyDrive2` | PyPI | All versions | None |
| `PyDrive2` | PyPI | All versions | 1.16.2 |
| `python-pydrive2` | openSUSE:Tumbleweed | All versions | 1.18.1-2.4 |

Products: Iterative Pydrive2.

## How do I fix CVE-2023-49297?

Upgrade pydrive2 to 1.16.2 or later.

## Is CVE-2023-49297 being exploited?

There is no known exploitation of CVE-2023-49297 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-49297 and fix it if it is affected.

What it is: CVE-2023-49297 is a low-severity unsafe deserialization vulnerability in iterative PyDrive2, published on 5 Dec 2023. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2023-49297 in the wild and no public exploit code.

Affected packages and fixed versions:
- pydrive2 (PyPI): affected all versions; no fix listed
- pydrive2 (PyPI): affected all versions; fixed in 1.16.2
- pydrive2 (PyPI): affected all versions; fixed in 1.16.2
- PyDrive2 (PyPI): affected all versions; no fix listed
- PyDrive2 (PyPI): affected all versions; fixed in 1.16.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-49297/ (Markdown: https://insights.sbomify.com/CVE-2023-49297/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-49297
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-49297
- OSV: https://osv.dev/vulnerability/CVE-2023-49297

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-49297/
Summaries are generated and may contain mistakes; the official description above is the record.
