Summary
Prompty loaders expanded ${file:...} references in .prompty frontmatter without validating that referenced paths remained within the intended prompt directory or other allowed roots.
In environments where attackers can supply or influence .prompty files, this behavior can be abused to read arbitrary local files via absolute paths, directory traversal, or symlink escapes.
Affected context
The vulnerability appears in Prompty-based workflows that automatically load and expand .prompty files containing ${file:...} references.
It is most relevant where:
- Prompt definitions are loaded from user-controlled or workspace-shared locations, and
- The Prompty loader runs on a host that has access to sensitive local files, configuration, or secrets.
In such setups, the loader trusts the ${file:...} paths embedded in frontmatter without restricting them to a safe prompt directory or explicit allowlist.
Exploit preconditions
- Attack surface: The Prompty loading mechanism that parses
.promptyfrontmatter and expands${file:...}references. - Required access: Ability to create, modify, or supply
.promptyfiles that the application or tooling will load (e.g., via repository contribution, plugin input, or shared workspace). - Trigger point: Loading or rendering of a malicious
.promptyfile that contains${file:...}directives pointing outside the intended prompt directory. - Why exploitation is possible: The loader resolves file references without enforcing a canonical path check or root constraint, allowing absolute paths,
..traversal, or symlinks to escape the expected directory and access arbitrary readable files.
Why this happens
The underlying issue is an insufficient validation of file paths derived from partially untrusted metadata, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
Prompty's loader accepts ${file:...} references in frontmatter and resolves them directly against the filesystem, without normalizing the resulting paths and confirming they remain under a designated root.
Because the abstraction treats frontmatter as configuration and assumes the embedded paths are safe, it fails to enforce directory boundaries or an allowlist, effectively turning prompt metadata into a primitive for local file inclusion and information exposure, which also relates to CWE-200: Information Exposure.
Potential impact
- An attacker-controlled
.promptyfile could read arbitrary local files that the Prompty process can access. - Sensitive configuration files, API keys, or credentials may be exposed through prompt expansion or logs.
- Proprietary prompt libraries, system prompts, and internal documentation can be disclosed.
- Local environment details (paths, OS-specific files, or application configs) can be revealed and used to support further attacks.
General mitigation guidance
Mitigation focuses on reducing trust in file-based references and constraining filesystem access:
- Normalize and canonicalize all
${file:...}paths, then enforce that resolved paths stay within a configured root directory (e.g., the prompt project root or an explicit allowlist of directories). - Treat frontmatter as untrusted input; apply strict validation rules to file-reference fields and reject or sanitize unsafe patterns such as absolute paths or
..segments. - Run prompt-loading tools with least-privilege file access so that even if traversal occurs, accessible data is limited.
- Provide secure configuration defaults that restrict file includes to a known safe set of locations rather than requiring users to opt in to safety.
How teams detect issues like this
Detection can be approached through both code-centric and operational views:
- Use static analysis or code search to identify file-include logic that concatenates user- or metadata-controlled paths without canonicalization and root checks.
- During code review, flag any
${file:...}or similar include features that resolve filesystem paths, and verify that they enforce directory constraints and handle symlinks safely. - Add unit and integration tests that attempt to include files via
..traversal, absolute paths, and symlink escapes, and assert that such references are rejected. - Employ security scanning or SAST tools configured to detect CWE-22 patterns, such as unsanitized path resolution in file-reading APIs.

