Junglewise Threat Intelligence

Pydantic pydantic-settings local file read in NestedSecretsSettingsSource

Severity: medium · CVSS 5.3 · Published 2026-06-19

Vendors: Pydantic, PyPI.

Executive brief

Pydantic-settings is a Python library used to manage application configuration and secrets. A vulnerability in how it handles secret files allows an attacker with local access to trick the application into reading sensitive files from anywhere on the system by using symbolic links. This could lead to the exposure of system passwords or other private data that the application was not intended to access.

Technical details

The NestedSecretsSettingsSource component in pydantic-settings fails to properly validate symbolic links when 'secrets_nested_subdir=True' is enabled. The vulnerability arises from inconsistent directory traversal: 'validate_secrets_path()' uses 'Path.glob', which ignores symlinked directories for size checks, while 'load_secrets()' uses 'glob.iglob', which follows them. An attacker who can influence the contents of the secrets directory (e.g., via a shared mount) can create a symlink pointing to sensitive files outside the directory. These files are then loaded into the application's settings, bypassing 'secrets_dir_max_size' protections. This is resolved in version 2.14.2 by ensuring all resolved paths remain within the designated secrets directory.

Affected products

  • pydantic pydantic-settings >= 2.12.0, < 2.14.2

Timeline

  • 2026-06-19: disclosed
  • 2026-06-19: advisory
  • 2026-06-19: patched: Fixed in version 2.14.2

References