Summary
PraisonAI's template installation mechanism was vulnerable to a Zip Slip path traversal issue that could allow arbitrary file writes during archive extraction from external sources.
If an attacker supplies or controls a malicious ZIP template, they can cause files to be written outside the intended templates directory, potentially overwriting sensitive or executable files on the host system.
Affected context
This vulnerability affects environments where PraisonAI installs templates by downloading ZIP archives from external locations such as GitHub and then extracting them on the local filesystem.
The risk is highest when:
- Template sources are user-specified, community-contributed, or otherwise untrusted
- PraisonAI runs with elevated filesystem permissions
- The host system contains sensitive or executable files reachable via relative paths from the extraction directory
Exploit preconditions
- Attack surface: PraisonAI template installation feature that downloads and extracts ZIP archives.
- Required access: Ability to cause PraisonAI to download and extract a crafted ZIP file (e.g., by pointing it to a malicious repository or compromising a template source).
- Trigger point: Invocation of the template installation workflow that calls
zipfile.extractall()on the attacker-controlled archive. - Why exploitation is possible: The extraction logic does not validate or normalize file paths inside the ZIP, allowing
../traversal or absolute paths to escape the intended destination directory and overwrite arbitrary files.
Why this happens
The root cause is the direct use of zipfile.extractall() on untrusted ZIP archives without validating the contained file paths.
Malicious archives can include entries with relative path components (such as ../../) or absolute paths that, when extracted, resolve outside the designated template directory.
This behavior maps to CWE-22: Path Traversal, specifically the Zip Slip pattern, where insufficient canonicalization and validation of paths during decompression leads to arbitrary file write outside the intended location.
Potential impact
- Overwrite of application or system configuration files that the PraisonAI process can access
- Planting or overwriting executable scripts or binaries that may later be invoked by the application or system services
- Tampering with PraisonAI's own templates or code to introduce backdoors or data exfiltration logic
- Escalation from a limited template-management capability to broader compromise of the host environment, depending on file permissions
General mitigation guidance
Effective mitigation focuses on enforcing strict path hygiene during archive extraction and limiting the blast radius of file operations:
- Normalize and validate each ZIP entry path before extraction, ensuring it resolves within a pre-defined, canonical template directory.
- Reject entries containing
.., absolute paths, drive prefixes, or symlink tricks that could escape the target directory. - Extract files using a custom loop instead of
extractall(), applying explicit checks on each member before writing to disk. - Run PraisonAI with the least filesystem privileges necessary and isolate template storage in tightly permissioned directories.
- Treat all externally sourced templates as untrusted content and integrate security review requirements for official or curated template repositories.
How teams detect issues like this
Detection can rely on both code-level and operational signals:
- Static analysis: Flag uses of
zipfile.extractall()or similar bulk extraction APIs on untrusted data without prior path validation or canonicalization. - Code review: Look for archive-handling code that does not sanitize ZIP entry names, fails to enforce a strict base directory, or writes files using paths derived directly from archive metadata.
- Security testing: Include Zip Slip test archives in QA and security testing pipelines to verify that extraction is confined to the intended directory.
- Runtime monitoring: Monitor for unexpected file modifications outside designated template directories during template installation operations, where host-level tools are available.

