Summary
PraisonAI's recipe CLI previously extracted .praison tar archives using tar.extract() without validating or normalizing member paths, enabling path traversal via ../ sequences.
If a user unpacks a malicious bundle, archive entries containing ../../ can escape the target directory and overwrite arbitrary files on the local filesystem, which becomes risky whenever bundles are obtained from untrusted or semi-trusted sources.
Affected context
This vulnerability affects environments where PraisonAI's recipe CLI is used to unpack .praison bundles with the cmd_unpack functionality.
It is relevant whenever:
- Users download or receive
.praisonbundles not fully controlled by themselves, and - The CLI runs with filesystem permissions that give it access to sensitive files or application directories.
The issue manifests specifically when archives contain paths with directory traversal components (e.g., ../) that are not sanitized or constrained to the intended output directory.
Exploit preconditions
- Attack surface: Local CLI usage; triggered when a user runs
praisonai recipe unpackon a crafted.praisonarchive. - Required access: Ability for an attacker to distribute or influence the
.praisonbundle contents (e.g., via public repositories, shared bundles, or supply-chain channels). - Trigger point: Execution of the
cmd_unpackcommand, which callstar.extract()on archive members without validating their resolved paths. - Why exploitation is possible: The extraction logic trusts archive entry names, allowing
../components or absolute-like paths to resolve outside the intended unpack directory, leading to uncontrolled write operations on the filesystem.
Why this happens
The core issue is an unchecked path traversal during archive extraction, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
The implementation uses raw tar.extract() on archive members, implicitly trusting the path information embedded in the archive.
Without normalizing and verifying that each member's final resolved path remains within the designated output directory, the tool permits ../ segments or other crafted paths to escape this directory.
This insecure pattern allows archives to dictate arbitrary write locations on the host filesystem, violating directory confinement expectations.
Potential impact
- Overwriting existing application configuration files that the user has permission to modify.
- Replacing executable scripts or binaries within the user's PATH, potentially enabling subsequent code execution when those programs run.
- Corrupting or replacing project files, build artifacts, or data directories.
- Introducing backdoors or malicious content into development environments by overwriting source files or dependencies.
- Disrupting system or user workflows by clobbering critical files, leading to denial-of-service-like effects.
General mitigation guidance
Effective mitigations focus on constraining archive extraction to a trusted directory and distrusting embedded paths:
- Normalize and join each archive member's path with the chosen output directory, then verify that the resulting absolute path still resides under that directory before extracting.
- Reject archive entries containing
.., absolute paths, or unexpected path prefixes, and log or surface these as errors instead of silently extracting them. - Use safer archive-handling patterns that iterate over members and perform per-entry checks instead of relying on bulk extraction primitives.
- Run CLI tools with the least privileges necessary, avoiding execution with elevated permissions that would broaden the damage from unintended file writes.
- Encourage workflows where
.praisonbundles are obtained from authenticated, integrity-checked sources to reduce the likelihood of malicious content.
How teams detect issues like this
Organizations can detect and monitor for similar issues through multiple approaches:
- Static analysis: Add rules to flag use of generic
tar.extract()or equivalent bulk extraction APIs without surrounding path validation logic. - Code review: During review, look for archive unpacking that:
- Does not normalize and validate paths against a base directory.
- Accepts archive paths directly from untrusted input or external bundles.
- Security testing: Include tests that attempt to extract archives containing
../components and confirm they are rejected or safely handled. - Policy enforcement: Establish internal guidelines requiring per-entry checks when handling compressed or archived content from external sources, and integrate automated linters that enforce these patterns.

