CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-4XGF-CPJX-PC3J

GHSA-4xgf-cpjx-pc3j: Directory Traversal and Symlink Following in Pydantic Settings

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 20, 2026·7 min read·15 visits

Executive Summary (TL;DR)

Discrepant globbing behaviors in Pydantic Settings allow directory traversal and symlink resolution bypasses, leading to arbitrary local file read and infinite loops.

A directory traversal and symlink following vulnerability exists in Pydantic Settings when using the NestedSecretsSettingsSource with nested subdirectory lookups enabled. An attacker capable of writing to the secrets directory can bypass size limitations, read arbitrary host files, or cause a denial-of-service condition via cyclic symlinks.

Vulnerability Overview

The library pydantic-settings is a widely adopted configuration management framework for Python applications, building upon Pydantic to parse environment and filesystem values. Inside this framework, the NestedSecretsSettingsSource class handles the resolution of secrets from a designated directory, mapping on-disk files to configuration properties. When the secrets_nested_subdir option is enabled, the library reads these subdirectories recursively, which maps complex directory hierarchies into nested model structures.

The security model of the secrets directory loader assumes that files are strictly retrieved from the directory designated by the secrets_dir parameter. To prevent uncontrolled system resource consumption, developers can define a size ceiling using the secrets_dir_max_size setting. This check is designed to prevent the application from reading arbitrarily large files into active process memory during startup.

However, a serious security discrepancy exists within the directory-traversal and file-scanning operations of this component. The library fails to validate whether resolved file paths remain within the boundary of the configured root directory. Consequently, local privilege escalation or arbitrary file disclosure can occur if an attacker can manipulate files or insert symbolic links in the target directory.

Root Cause Analysis

The core vulnerability arises from a logic discrepancy between the validation routines and the file loading mechanisms. During the validation phase, NestedSecretsSettingsSource executes a size check using pathlib.Path.glob('**/*') to verify that the total directory size does not exceed the limit. In standard Python runtime environments, pathlib.Path.glob does not descend into symbolic links that reference external directories.

Directly following this check, the loading phase is initiated using glob.iglob with recursive=True to retrieve configuration keys. Unlike the validation routine, glob.iglob automatically follows symbolic links pointing to external directories on the host filesystem. This inconsistent behavior allows symbolic links to bypass the maximum file size validation checks entirely.

An attacker can exploit this behavior by placing a directory symbolic link pointing to a sensitive system folder inside the designated secrets directory. The size check calculates the symbolic link size as zero bytes, bypassing the secrets_dir_max_size safety boundary. The loader subsequently resolves the link and reads the targeted external files into the application memory space.

In addition to information leakage, this logic flaw exposes the application to a denial-of-service condition. Because glob.iglob does not maintain a history of visited directories, cyclic symbolic links trigger infinite recursive loops during loading. This behavior leads to excessive CPU and memory consumption, eventually crashing the application process.

Code Analysis

To analyze the implementation discrepancy, we examine the vulnerable code path inside nested_secrets.py. The validation step computes the total directory size using path.glob:

# Vulnerable validation implementation
secrets_dir_size = sum(f.stat().st_size for f in path.glob('**/*') if f.is_file())

Directly after the size validation check, the file loading pass uses the standard glob.iglob function:

# Vulnerable file loader implementation
return {
    str(p.relative_to(path)): p.read_text().strip()
    for p in map(Path, iglob(f'{path}/**/*', recursive=True))
    if p.is_file()
}

The patch resolves this discrepancy by replacing the differing glob libraries with a custom directory walker named _iter_secret_files. This custom walker explicitly tracks visited directories in a set named seen_dirs and computes canonical paths using Path.resolve(). If a directory has already been visited, the loop terminates immediately, preventing cyclic symlink loops.

# Patched recursive walker preventing traversal and cyclic loops
seen_dirs: set[Path] = set()
 
def walk(directory: Path) -> Iterator[Path]:
    resolved_dir = directory.resolve()
    if resolved_dir in seen_dirs:
        return
    seen_dirs.add(resolved_dir)
    try:
        entries = sorted(directory.iterdir())
    except OSError:
        return
    for entry in entries:
        resolved = entry.resolve()
        if resolved.is_dir():
            if resolved == path or path in resolved.parents:
                yield from walk(entry)
        elif resolved.is_file() and path in resolved.parents:
            yield entry

Both the size validation engine and the loader call this unified iterator, ensuring that the processed file sets are identical. Symbolic links pointing to files outside the designated secrets_dir are rejected because the condition path in resolved.parents is not met. This prevents out-of-bounds files from contributing to the size computation or being read during initialization.

Exploitation Methodology

Exploitation requires that an attacker have sufficient local permissions to create or modify files inside the configured secrets_dir path. This scenario frequently occurs in multi-tenant environments, shared hosting platforms, or systems where container volumes are exposed to unprivileged users. The attacker must also target an application with secrets_nested_subdir enabled on NestedSecretsSettingsSource.

To initiate the exploit, the attacker maps out the physical layout of the application's configuration directory. They inject a symbolic link pointing to a sensitive file or directory located elsewhere on the host machine:

ln -s /etc/passwd secrets_dir/database_config

When the host application initializes, the size validation check processes database_config as a zero-byte entry, bypassing the limit. The loader then processes the virtual relative path database_config and executes p.read_text().strip() on the target /etc/passwd. The contents of the target file are loaded directly into the Pydantic schema parameter assigned to the database configuration.

To execute a denial-of-service attack, the attacker constructs a self-referential directory structure. By running ln -s ../ secrets_dir/loop, the loader enters an infinite traversal cycle. This recursion consumes execution resources, causing CPU exhaustion and memory inflation that terminates the parent process.

Impact Assessment

The confidentiality impact of this vulnerability is moderate depending on the access controls of the execution environment. If the application runs under a privileged user context, an attacker can extract sensitive system files such as password databases or service tokens. This information leakage occurs silently during startup, making detection difficult without structural filesystem auditing.

The integrity of file loading mechanisms is compromised because the size constraints set by developers are bypassed. Large external files are loaded into memory without throwing size validation exceptions, which can result in heap fragmentation or out-of-memory errors. This behavior invalidates the effectiveness of configuration safeguards.

Availability threats are high due to the lack of cyclic path detection in the older loader implementation. A single cyclic symbolic link can cause a persistent denial-of-service state on application startup. In automated container environments, this crash behavior can trigger infinite restart loops, leading to cluster instability.

The CVSS score of 5.3 reflects the requirement of local filesystem write privileges to execute the attack. However, in containerized deployments or cloud infrastructure where secrets directories are shared across pods, this vulnerability can serve as a vector for container escape or lateral movement.

Remediation and Mitigation

The definitive remediation path is upgrading the pydantic-settings dependency to version 2.14.2 or later. This version introduces the unified custom directory walker that restricts symbolic links and prevents recursive loops. Upgrading can be verified by checking that _iter_secret_files is present in the NestedSecretsSettingsSource class.

If upgrading is not immediately possible, disabling nested subdirectory configuration is an effective workaround. Setting the parameter secrets_nested_subdir=False stops the recursive scanning behavior and prevents the loader from descending into directory symbolic links. This configuration effectively neutralizes the primary traversal vector.

Additionally, administrators should apply strict filesystem permissions to the secrets_dir path. Restricting directory access with a 0700 permission mask ensures that only the application runtime user can read or write configuration files. This permission restriction prevents lower-privileged local users from injecting malicious symbolic links.

Finally, deployment workflows should integrate automated filesystem scanning to identify illegal symbolic links in configuration directories. Running file auditing commands during container startup can detect symlinks pointing to paths outside the deployment root. If external links are detected, the container initialization sequence should be aborted.

Official Patches

PydanticPull Request with Fix for Nested Secrets Symlink Following

Technical Appendix

CVSS Score
5.3/ 10
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L

Affected Systems

pydantic-settings

Affected Versions Detail

Product
Affected Versions
Fixed Version
pydantic-settings
Pydantic
>= 2.12.0, < 2.14.22.14.2
AttributeDetail
CWE IDCWE-59
Attack VectorLocal
CVSS Score5.3
Exploit StatusProof-of-Concept
EPSS PercentileN/A
CISA KEV StatusNot Listed
Affected ComponentNestedSecretsSettingsSource

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
T1499Endpoint Denial of Service
Impact
CWE-59
Improper Link Resolution Before File Access ('Link Following')

The application follows symbolic links to files outside the designated directory structure, leading to unauthorized access to files.

Vulnerability Timeline

Vulnerability reported privately and patch merged under PR 889
2026-06-19
Security advisory GHSA-4xgf-cpjx-pc3j published
2026-06-19
Pydantic Settings v2.14.2 released on PyPI containing the fix
2026-06-19

References & Sources

  • [1]GitHub Advisory Database Record
  • [2]Pydantic Settings Repository
  • [3]Vulnerability Resolution Pull Request (PR 889)
  • [4]Raw Patch/Diff Stream
  • [5]Pydantic-Settings Release Tag (v2.14.2)

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 9 hours ago•CVE-2026-54068
5.9

CVE-2026-54068: Unauthenticated Server-Side Template Injection and SQLite Exfiltration in SiYuan PKM

An authentication bypass in the SiYuan personal knowledge management system before version 3.7.0 exposes a dynamic icon rendering endpoint. This endpoint processes client-supplied Go template directives. By submitting a crafted request, an unauthenticated remote attacker can leverage registered database template functions to execute arbitrary read-only SQL queries and exfiltrate workspace contents.

Amit Schendel
Amit Schendel
5 views•5 min read
•about 9 hours ago•CVE-2026-54069
9.1

CVE-2026-54069: Authentication Bypass in SiYuan Note via Origin Header Spoofing

CVE-2026-54069 is a critical authentication bypass vulnerability in the SiYuan Note personal knowledge management system. The flaw is located in the HTTP server's middleware handling API authorization, which unconditionally trusts requests carrying a 'chrome-extension://' scheme in the Origin HTTP header, granting administrative access without validating API tokens.

Alon Barad
Alon Barad
4 views•5 min read
•about 10 hours ago•CVE-2026-54089
9.1

CVE-2026-54089: Authentication Bypass by Spoofing in File Browser

CVE-2026-54089 is a critical authentication bypass vulnerability in File Browser affecting instances configured with proxy-based authentication. An unauthenticated remote attacker with direct network access can impersonate arbitrary users or register new accounts by spoofing configured HTTP headers.

Amit Schendel
Amit Schendel
4 views•7 min read
•about 10 hours ago•GHSA-99J7-FHR2-XFJ4
10.0

GHSA-99J7-FHR2-XFJ4: Malicious Remote Code Execution Payload in 'exploration' Cargo Crate

The malicious Cargo package 'exploration' was uploaded to the crates.io registry. During compilation or package import, the crate executes code designed to establish an outbound TCP/HTTP connection, download an external second-stage binary, and execute the binary locally on the host machine. This creates an unauthenticated remote code execution vector impacting developer environments and continuous integration pipelines.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 11 hours ago•CVE-2026-54088
9.3

CVE-2026-54088: Pre-Authentication Remote Code Execution in File Browser Hook Authentication

CVE-2026-54088 is a critical command injection vulnerability in File Browser prior to version 2.63.6. When Hook Authentication is enabled, the application interpolates unsanitized credentials into a shell command, allowing unauthenticated remote code execution.

Alon Barad
Alon Barad
6 views•6 min read
•about 11 hours ago•GHSA-QV4M-M73M-8HJ7
8.8

GHSA-qv4m-m73m-8hj7: Authenticated Arbitrary File Upload leading to Remote Code Execution in NotrinosERP

An authenticated remote code execution vulnerability exists in NotrinosERP (versions up to and including 1.0.0) within the Human Resource Management (HRM) module. Users with employee management permissions can upload arbitrary file types, including PHP scripts, which are written directly to a web-accessible directory. This allows for arbitrary code execution in the context of the web-server user.

Alon Barad
Alon Barad
5 views•6 min read