Summary
A path traversal vulnerability in PraisonAI's MentionsParser can cause file-mention values to resolve outside the intended workspace. When prompt input from users, bots, or workflows is processed, an attacker may read sensitive files accessible to the application process, including credentials, keys, source code, and system configuration.
Affected context
The issue occurs in deployments that use PraisonAI agent workflows with file mentions and permit untrusted or insufficiently constrained prompt content to influence file paths. Risk increases when the process can access sensitive files and the parser falls back to direct path resolution without enforcing workspace boundaries, traversal protections, or symlink restrictions.
Exploit preconditions
- Attack surface: File-mention processing in agent prompts, bots, or workflows
- Required access: Ability to supply or influence file-mention values accepted by the application
- Trigger point: Resolution and processing of a file mention
- Why exploitation is possible: The parser may resolve a path outside the intended workspace without consistently enforcing traversal, symlink, or boundary validation
Why this happens
The underlying bug is insufficient validation of user-influenced filesystem paths. After workspace-relative resolution does not produce the expected result, the parser falls back to a general path representation without proving that the resulting path remains within an approved directory. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because attacker-controlled path input can escape the intended filesystem boundary.
Potential impact
- An attacker may read credentials, private keys, or environment files
- The application could disclose source code or internal configuration
- Sensitive system or service information may be exposed
- Disclosed secrets could enable follow-on compromise of connected systems
General mitigation guidance
Mitigation generally focuses on treating file-mention values as untrusted filesystem input and enforcing a narrow, explicit access boundary.
Common defensive patterns include:
- Resolving paths against a fixed workspace and verifying the canonical result remains within that workspace
- Rejecting traversal components, absolute paths, and symlink escapes where they are not required
- Allowing access only to explicitly approved files or directories
- Separating user-provided references from privileged filesystem operations
- Running agents with least-privilege filesystem permissions and minimal access to secrets
- Returning controlled errors instead of exposing filesystem details
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis for path construction using user-controlled values
- Code review checks for direct path fallbacks and missing canonical-boundary validation
- Tests covering traversal components, absolute paths, symlinks, and workspace escape attempts
- Runtime monitoring for unusual reads of credential, environment, key, or system configuration files
- Policy enforcement that restricts agent processes to dedicated, least-privilege workspaces
- Neutral automated code review rules targeting CWE-22 patterns

