Advisory

PYSEC-2026-3504

Details, part 2 of 2. The advisory

Details

and child_output.get("network_reply") == "local-ok"
)

return {
"repo": str(repo),
"has_sandlock": True,
"sandbox_type": sandbox.sandbox_type,
"sandlock_available": sandbox.is_available,
"configured_allowed_paths": config.security_policy.allowed_paths,
"configured_network": config.security_policy.allow_network,
"outside_path_under_allowed": str(outside).startswith(str(allowed) + os.sep),
"status": getattr(result.status, "name", str(result.status)),
"exit_code": result.exit_code,
"stdout": result.stdout.strip(),
"stderr": result.stderr.strip(),
"error": result.error,
"child_output": child_output,
"accepted_local_payload": accepted_payload,
"vulnerable": vulnerable,
}

def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("--repo", required=True, type=pathlib.Path)
args = parser.parse_args()

result = asyncio.run(run_pov(args.repo.resolve()))
print(json.dumps(result, indent=2, sort_keys=True))

if result.get("has_sandlock") and not result.get("vulnerable"):
return 1
return 0

if __name__ == "__main__":
raise SystemExit(main())


## PoC

The PoV section above contains the local reproduction command, input, and decisive output.

## Impact

If a PraisonAI user or service relies on `SandlockSandbox` / native sandboxing for untrusted code isolation on a host without the required Landlock support, code submitted to the sandbox can execute with the host user's normal filesystem and network access.

Concrete impact includes:

- reading files outside the configured tenant/workspace path;
- reading project files, credentials, `.env` files, SSH material, or cloud config reachable by the PraisonAI process user;
- connecting to loopback or internal services despite `network=False`;
- moving from sandboxed code execution to unsandboxed host-user code execution in deployments that treat Sandlock as the isolation boundary.

The local PoV does not read real sensitive files or contact external systems. It uses temporary tenant directories and a localhost TCP listener.

## Suggested Fix

Fail closed when the requested native sandbox boundary cannot be enforced.

Recommended changes:

1. In `SandlockSandbox.execute()` and `run_command()`, return a failed `SandboxResult` or raise a clear runtime error when `self.is_available` is false.
2. If fallback behavior is kept for developer convenience, require an explicit opt-in such as `allow_degraded=True` or `fallback="subprocess"` and surface that degraded state in the result metadata.
3. Do not preserve `sandbox_type == "sandlock"` in status metadata when the actual execution backend is subprocess.
4. Add regression tests proving that unavailable Landlock does not execute code unless degraded fallback was explicitly requested.
5. Add tests that a native policy with `network=False` and a restricted path cannot read outside-path canaries or connect to a localhost listener.
6. Document the required kernel/ABI versions and the exact degraded-mode semantics.

## Affected Package/Versions

- Repository: `MervinPraison/PraisonAI`
- Package: `praisonai`
- Component: `src/praisonai/praisonai/sandbox/sandlock.py`
- Related config component: `src/praisonai-agents/praisonaiagents/sandbox/config.py`
- Latest verified release/current head: `v4.6.58`, `1ad58ca02975ff1398efeda694ea2ab78f20cf3e`

Confirmed affected:

```text
v4.5.110  vulnerable
v4.5.120  vulnerable
v4.6.58   vulnerable
current   vulnerable

Negative control:

v4.5.109  not affected because SandlockSandbox is absent

Suggested affected range: >= 4.5.110, <= 4.6.58.

No fixed version is known at submission time.

Version Sweep

version              has_sandlock  sandlock_available  status     outside_read     network_reply  vulnerable
praisonai-v4.5.109   false                                               false
praisonai-v4.5.110   true          false               COMPLETED  TENANT_B_CANARY  local-ok       true
praisonai-v4.6.58    true          false               COMPLETED  TENANT_B_CANARY  local-ok       true
praisonai-current    true          false               COMPLETED  TENANT_B_CANARY  local-ok       true

GitHub history for sandlock.py shows the backend was introduced in 4ee7d298c89f on 2026-04-01 with "graceful fallback to SubprocessSandbox", then updated in 7ae6c6d19c31 on 2026-04-02 to use the current Landlock ABI check.

Advisory History

Nearby advisories are distinct:

  • GHSA-r4f2-3m54-pp7q / CVE-2026-34955: SubprocessSandbox shell command escape through 4.5.96.
  • GHSA-4mr5-g6f9-cfrh, GHSA-qf73-2hrx-xprp, GHSA-6vh2-h83c-9294: execute_code() Python sandbox escapes.
  • GHSA-ch89-h4r2-c8f8: agent tools workspace escape via symlinks.
  • GHSA-gcq3-mfvh-3x25: PraisonAI Code agent tool workspace fail-open.

This report covers a different root cause: SandlockSandbox / native sandbox policy downgrade when Landlock is unavailable. It reproduces on the latest release v4.6.58, while the older SubprocessSandbox shell escape advisory was fixed at 4.5.97.

Sources & licences