Summary
A path traversal weakness in how parameters.pathPattern is handled allows a malicious user to influence where PersistentVolumes are created on the host node.
By crafting a pathPattern that escapes the intended directory, an attacker may create volumes in arbitrary filesystem locations, potentially overwriting sensitive files or accessing unintended host directories.
Affected context
This vulnerability arises in Kubernetes or containerized storage integrations where a parameters.pathPattern value from user-controlled or semi-trusted configuration is used to compute host filesystem paths for PersistentVolumes.
It is most relevant when:
- Volume provisioning logic concatenates pathPattern directly into host paths
- There is an assumption that pathPattern stays within a specific base directory
- The underlying host filesystem is shared with sensitive system or application data
Exploit preconditions
- Attack surface: Storage or volume provisioning API that accepts parameters.pathPattern (e.g., StorageClass, provisioner configuration, or similar).
- Required access: Ability to define or modify resources that influence pathPattern (such as StorageClass parameters or PVC annotations, depending on deployment).
- Trigger point: Volume creation or provisioning workflow where the provisioner resolves pathPattern into a host filesystem path.
- Why exploitation is possible: The value of pathPattern is not normalized, validated, or restricted to a safe base directory, allowing traversal sequences (such as ../) or absolute paths to escape the intended storage root.
Why this happens
The core issue maps to CWE-23: Relative Path Traversal.
Application logic constructs filesystem paths for PersistentVolumes by combining a trusted base directory with a partially or fully untrusted pathPattern without:
- canonicalizing and normalizing the resulting path, and
- enforcing that the final path remains within a designated directory boundary.
This insecure pattern allows specially crafted path components to traverse the directory structure, targeting arbitrary locations on the host node.
Potential impact
- Creation of PersistentVolumes that map to unintended directories on the host node
- Overwriting or truncating sensitive configuration or application files on the host
- Gaining read/write access to system directories that should not be exposed to workloads
- Escalation of privileges within the cluster if critical host files are modified
- Lateral movement opportunities by accessing data belonging to other tenants or workloads
General mitigation guidance
Effective mitigation focuses on strict path handling and constraining filesystem access:
- Normalize and canonicalize any derived paths that include pathPattern before use.
- Enforce that the resolved path always resides within a predefined, immutable base directory (e.g., by checking that the canonical path has the expected prefix).
- Reject pathPattern values containing traversal tokens, absolute path markers, or other disallowed constructs.
- Use a whitelist of allowed patterns or template variables rather than accepting free-form path strings.
- Isolate storage directories for dynamic volumes on dedicated, least-privilege paths separate from host system data.
- Combine filesystem-level permissions and container runtime security controls so that even misconfigured volumes have limited blast radius.
How teams detect issues like this
Detection typically combines code-level analysis with configuration review:
- Static analysis and manual review targeting any code that:
- concatenates user-controlled strings into filesystem paths, or
- uses pathPattern-like parameters without canonicalization and boundary checks.
- Cluster policy or admission controllers that:
- inspect StorageClass and related custom resources for unsafe or unconstrained pathPattern usage, and
- block patterns containing traversal sequences or absolute paths.
- Runtime monitoring for unusual mount points or volumes that map outside expected storage roots.
- Periodic configuration and filesystem audits to identify volumes or directories created outside approved storage locations.

