# CVE-2026-58203: pydantic-settings: NestedSecretsSettingsSource follows symlinks outside secrets_dir, enabling local file read and bypassing secrets_dir_max_size

> Attackers with write access to the secrets directory can use symlinks to read arbitrary local files and bypass size limits in pydantic-settings.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Jul 2026
- **Updated:** 6 Jul 2026
- **Also known as:** CLEANSTART-2026-OQ12985, CLEANSTART-2026-UR05991, DEBIAN-CVE-2026-58203, ECHO-c128-4f87-8dda, GHSA-4xgf-cpjx-pc3j, MGASA-2026-0260, MINI-2j6g-5jp8-5f5q, MINI-46xm-7qx5-6qv7, MINI-55j6-fpf6-w4pg, MINI-56m4-3h7f-fr84, MINI-5f98-5r5p-26jg, MINI-5jg6-42p3-fv5g, MINI-6pp3-65rc-h84f, MINI-7hp3-qmq8-hw2p, MINI-8g7w-8x9q-jpwf, MINI-9xrc-w34r-mmhf, MINI-c9qw-hc4m-pj99, MINI-chrr-vqgp-47w8, MINI-fv4j-xr45-7jrf, MINI-m35r-m6r5-2jrv, MINI-pc9x-pv8g-g98r, MINI-pg37-vppx-w2gr, MINI-r2vm-c8m9-wpp7, ROOT-APP-PYPI-GHSA-4xgf-cpjx-pc3j, UBUNTU-CVE-2026-58203

## What is CVE-2026-58203?

CVE-2026-58203 is a medium-severity path traversal vulnerability in pydantic-settings, published on 6 Jul 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

pydantic-settings provides settings management using Pydantic. From 2.12.0 until 2.14.2, NestedSecretsSettingsSource reads secret values from files in a configured secrets_dir. When secrets_nested_subdir=True, a directory entry inside secrets_dir that is a symbolic link pointing outside secrets_dir is followed, so files outside the configured directory are read into settings values. The same code path bypasses the documented secrets_dir_max_size protection. An attacker or lower-privileged component able to influence entries in the configured secrets directory (for example, a writable or shared secrets mount) can turn this into an unintended local file read into settings and can defeat the advertised loading-size cap.  This vulnerability is fixed in 2.14.2.

Weakness: CWE-59 (Improper Link Resolution Before File Access), CWE-400 (Uncontrolled Resource Consumption), CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2026-58203?

2 open source packages ship an affected version, including pydantic-settings. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pydantic-settings` | PyPI | From 2.12.0 | 2.14.2 |
| `pydantic-settings` | PyPI | From 2.12.0 | 2.14.2 |

Products: Pydantic Pydantic-Settings.

## How do I fix CVE-2026-58203?

Upgrade pydantic-settings to 2.14.2 or later.

## Is CVE-2026-58203 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-58203 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-58203 and fix it if it is affected.

What it is: CVE-2026-58203 is a medium-severity path traversal vulnerability in pydantic-settings, published on 6 Jul 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-58203 exists.

Affected packages and fixed versions:
- pydantic-settings (PyPI): affected from 2.12.0; fixed in 2.14.2
- pydantic-settings (PyPI): affected from 2.12.0; fixed in 2.14.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-2026-58203/ (Markdown: https://insights.sbomify.com/CVE-2026-58203/index.md)
```

## Sources

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

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