Advisory

PYSEC-2026-4261

Details, part 2 of 2. The advisory

Details

Expected vulnerable output:

{
  "expectations": {
    "absolute_path_discloses_outside_file": true,
    "inside_control_expands_workspace_file": true,
    "missing_control_leaves_missing_reference": true,
    "relative_parent_traversal_discloses_outside_file": true,
    "shell_control_does_not_create_file": true
  },
  "samples": {
    "absolute_escape": "Review absolute outside:\nPRAISONAI_CUSTOM_COMMAND_CANARY=outside-workspace\n",
    "inside_control": "Review inside:\nINSIDE_FILE=allowed\n",
    "missing_control": "Missing stays literal:\[email protected]",
    "relative_escape": "Review outside:\nPRAISONAI_CUSTOM_COMMAND_CANARY=outside-workspace\n",
    "shell_control": "Shell substitution is escaped:\n\\$(touch SHOULD_NOT_EXIST)"
  },
  "vulnerable": true,
  "yaml_dependency": "installed"
}

The PoC does not contact a model provider or any external service. It stops at the interpolation step that praisonai run --command uses before calling _run_prompt().

Impact

An attacker who can supply or modify a repository can add a project command such as .praisonai/commands/review.md containing @../outside_secret.txt or another process-readable path outside the project. If the operator runs that project command, PraisonAI expands the outside file into the prompt. In normal use that prompt may be sent to a hosted model provider, logged, or displayed to a lower-trust caller.

This report claims confidentiality impact only. It does not claim code execution, arbitrary write, credential theft without user interaction, persistence, or network scanning.

Suggested severity: Medium under the local untrusted-repository threat model because the operator must run a project-defined command.

Suggested CVSS 3.1 vector:

CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Relevant CWEs:

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory
  • CWE-200: Exposure of Sensitive Information to an Unauthorized Actor

Suggested Fix

Resolve command @path references through a single containment helper before opening files:

  1. Resolve the project root or intended command workspace once.
  2. For relative references, join to that root and then call resolve().
  3. For absolute references, either reject them outright or require resolved.relative_to(root) to succeed.
  4. Reject escaped files before any exists(), is_file(), or open() operation.
  5. Apply the same boundary to project and user command templates.
  6. Add regression tests for @../outside.txt, @/absolute/outside.txt, a valid in-workspace file, a missing file, and shell-substitution escaping.

Minimal shape:

def resolve_command_file(root: Path, value: str) -> Path:
    root = root.resolve()
    candidate = Path(value)
    if not candidate.is_absolute():
        candidate = root / candidate
    resolved = candidate.resolve()
    try:
        resolved.relative_to(root)
    except ValueError as exc:
        raise PermissionError(f"command file reference escapes workspace: {value}") from exc
    return resolved

Affected Package/Versions

The feature was introduced by commit 88cf0c29. Current release tags now contain that commit, and PyPI currently publishes praisonai through 4.6.71.

introducing commit: 88cf0c29
earliest affected release observed: v4.6.65
latest affected release observed: v4.6.71
latest PyPI version checked: 4.6.71
unaffected sampled tag: v4.6.64
fixed version: none identified yet

Affected package entry:

Ecosystem: pip
Package: praisonai
Vulnerable versions: >= 4.6.65
Patched versions: none yet

Advisory History

No checked PraisonAI private advisory matched .praisonai/commands/*.md, praisonai.cli.features.custom_definitions, or custom command template @path interpolation.

The closest comparator is GHSA-2rcg-mm5h-xchx, arbitrary file read via @file: mention path traversal. This report is distinct because it is triggered by project-level custom command templates discovered from .praisonai/commands/*.md, not by a direct @file: mention path. The vulnerable code path here is TemplateInterpolator._interpolate_files() in custom_definitions.py, introduced by 88cf0c29, and the sink is praisonai run --command.

Other checked PraisonAI advisories cover Platform authorization gaps, AgentMail unsigned webhooks, localhost Host-header auth bypass, ContextGatherer/FastContext path escapes, API deploy YAML-to-Python injection, MCP and recipe policy bypasses, Dynamic Context path traversal, and file-tool path traversal. None covers this custom command template interpolation path.

References

  • PraisonAI repository: https://github.com/MervinPraison/PraisonAI
  • Introducing commit 88cf0c29: https://github.com/MervinPraison/PraisonAI/commit/88cf0c29
  • Current tested commit 3aa9cbc2bd49c23a32be0a89a5e620d13d843eab: https://github.com/MervinPraison/PraisonAI/commit/3aa9cbc2bd49c23a32be0a89a5e620d13d843eab
  • Comparator advisory GHSA-2rcg-mm5h-xchx: https://github.com/MervinPraison/PraisonAI/security/advisories/GHSA-2rcg-mm5h-xchx
  • PraisonAI security policy page: https://github.com/MervinPraison/PraisonAI/security/policy
  • CWE-22: https://cwe.mitre.org/data/definitions/22.html
  • CWE-200: https://cwe.mitre.org/data/definitions/200.html

Sources & licences