Summary
PraisonAI's recipe registry publish endpoint writes uploaded recipe bundles to a filesystem path derived from the bundle's internal manifest.json before validating that the manifest name and version match the HTTP route.
By embedding ../ directory traversal sequences in the manifest, an attacker can cause the server to create files outside the intended registry root on the host filesystem, even though the HTTP request is ultimately rejected with a 400 error.
Affected context
This vulnerability occurs in PraisonAI deployments that expose the recipe registry publish flow.
The affected code path processes uploaded recipe bundles, reading the internal manifest.json and constructing a filesystem path for storage based on manifest fields.
The issue is present when the service writes these files before fully validating that the manifest name and version are consistent with the HTTP route and before sanitizing traversal sequences in the manifest-derived path.
Instances intentionally running the registry without an authentication token are exposed to any network client, while token-protected registries remain exposed to authenticated users with publish access.
Exploit preconditions
- Attack surface: Recipe registry publish HTTP endpoint.
- Required access:
- If no token is configured: any network client that can reach the registry service.
- If a token is configured: any authenticated user with publish permissions.
- Trigger point: Uploading a crafted recipe bundle whose internal manifest.json contains path segments with directory traversal sequences (e.g., ../) in fields used to construct the storage path.
- Why exploitation is possible: The server writes bundle content to a filesystem path computed from manifest fields before:
- Validating that manifest name/version match the HTTP route.
- Normalizing and constraining the path to the configured registry root.
- Rejecting unsafe traversal components.
Why this happens
The root cause is an improper limitation of the path used for file operations, mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The registry accepts attacker-controlled values from manifest.json and incorporates them into a filesystem path without sufficient normalization or restriction to a configured root directory.
Because file creation occurs before full validation of the manifest and HTTP parameters, a malicious publisher can leverage ../ segments to escape the intended registry directory and cause arbitrary file creation elsewhere on the host.
This pattern reflects a mismatch between input validation order and sensitive filesystem operations: the system performs side effects (file writes) using untrusted path components and only afterward verifies consistency, making rejection too late to prevent impact.
Potential impact
- Creation or overwriting of files outside the intended registry root directory on the host.
- Placement of attacker-controlled data in sensitive directories, which may be leveraged for:
- Log poisoning or configuration manipulation, depending on host layout.
- Interference with other services that read from shared directories.
- Potential privilege escalation or code execution in environments where other processes load or execute files from writable locations.
- Disruption of registry operation by corrupting internal data or metadata files if traversal targets related paths.
General mitigation guidance
Effective mitigation focuses on enforcing strict filesystem boundaries and validating all path components derived from user-controlled input before any file operation:
- Constrain all file writes to a well-defined registry root using safe path-join utilities that normalize and verify resulting paths remain under the configured base directory.
- Perform early validation of manifest fields (name, version, and any path-related attributes) before using them to construct filesystem paths, rejecting inputs with traversal sequences or unexpected characters.
- Apply canonicalization to derived paths and enforce checks such as "resolved_path starts with registry_root" before creating or writing files.
- Separate the concerns of request validation and persistence: only persist bundles after all cross-checks between HTTP route parameters and manifest contents have passed.
- Run the registry process with least-privilege filesystem permissions so that even if traversal occurs, the impact is limited to non-sensitive directories.
How teams detect issues like this
Detection can combine source-level analysis, configuration review, and runtime monitoring:
- Static analysis and code review:
- Search for file I/O APIs that use values derived from HTTP request data or manifest.json without explicit normalization and root-confinement checks.
- Flag patterns where manifest fields are concatenated into paths (e.g., string-based joins or f-strings) instead of using safe path utilities with boundary verification.
- Review the sequence of operations to ensure that all validations occur before file writes, especially where HTTP route parameters and manifest data must be consistent.
- Policy and tooling:
- Introduce secure coding guidelines requiring canonicalization and root checks for any user-influenced path.
- Use automated security scanners or SAST tools configured with rules for CWE-22 to identify missing directory traversal protections.
- Runtime monitoring:
- Monitor the registry host for unexpected file creation outside the intended registry root by the registry process account.
- Configure logging to capture request metadata and manifest information when write operations target abnormal directories, aiding incident response.

