GitHub Security Advisory: GHSA-4rx4-4r3x-6534
Package: PraisonAI (PIP)
Severity: HIGH (CVSS 7.3)
CWE: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Vulnerable versions: <= 4.5.112
Patched in: 4.5.113

Summary: PraisonAI recipe registry pull path traversal writes files outside the chosen output directory

Details:
### Summary

PraisonAI's recipe registry pull flow extracts attacker-controlled `.praison` tar archives with `tar.extractall()` and does not validate archive member paths before extraction. A malicious publisher can upload a recipe bundle that contains `../` traversal entries and any user who later pulls that recipe will write files outside the output directory they selected.

This is a path traversal / arbitrary file write vulnerability on the client side of the recipe registry workflow. It affects both the local registry pull path and the HTTP registry pull path. The checksum verification does not prevent exploitation because the malicious traversal payload is part of the signed bundle itself.

### Details

The issue is caused by unsafe extraction of tar archive contents during recipe pull.

1. A malicious publisher creates a valid `.praison` bundle whose `manifest.json` is benign enough to pass publish, but whose tar members include traversal entries such as:

```text
../../escape-http.txt
```

2. `LocalRegistry.publish()` in `src/praisonai/praisonai/recipe/registry.py:214-287` only reads `manifest.json`, calculates a checksum, and stores the uploaded bundle. It does not inspect or sanitize the rest of the tar members before saving the archive.

3. When a victim later pulls the recipe from a local registry, `LocalRegistry.pull()` in `src/praisonai/praisonai/recipe/registry.py:289-345` extracts the tarball directly:

```python
recipe_dir = output_dir / name
recipe_dir.mkdir(parents=True, exist_ok=True)

with tarfile.open(bundle_path, "r:gz") as tar:
    tar.extractall(recipe_dir)
```

4. The HTTP client path is also vulnerable. `HttpRegistry.pull()` in `src/praisonai/praisonai/recipe/registry.py:691-739` downloads the bundle and then performs the same unsafe extraction:

```python
recipe_dir = output_dir / name
recipe_dir.mkdir(parents=True, exist_ok=True)

with tarfile.open(bundle_path, "r:gz") as tar:
    tar.extractall(recipe_dir)
```

5. Because no archive member validation is performed, traversal entries escape `recipe_dir` and create files elsewhere on disk.

Verified vulnerable behavior:

- Published recipe name: `evil-http`
- Victim-selected output directory: `/tmp/praisonai-pull-traversal-poc/victim-output`
- Artifact created outside that directory: `/tmp/praisonai-pull-traversal-poc/escape-http.txt`
- Artifact contents: `owned over http`

This demonstrates that a remote publisher can cause filesystem writes outside the pull destination chosen by another user.

### PoC

Run the single verification script from the checked-out repository:

```bash
cd "/Users/r1zzg0d/Documents/CVE hunting/targets/PraisonAI"
python3 tmp/pocs/poc2.py
```

Expected vulnerable output:

```text
[+] Publish result: {'ok': True, 'name': 'evil-http', 'version': '1.0.0', ...}
[+] Pull result: {'name': 'evil-http', 'version': '1.0.0', ...}
[+] Outside artifact exists: True
[+] Artifact also inside output dir: False
[+] Outside artifact content: 'owned over http\n'