Hardening: execute_code sandbox permits runtime-built frame introspection

Aperta
#6,678 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
security

Direzione di ricerca

Start by reading execute_code() in praisonaiagents/tools/python_tools.py, especially the AST deny-list and the replacement getattr/builtins it installs. Reproduce the bypass with a runtime-built frame attribute name, then look at the project's kernel/container-backed sandbox that the issue points to as the intended replacement. Done means untrusted code no longer runs against the restricted-Python boundary alone, with regression tests covering runtime-built introspection paths. This is design-level security work, not a first edit.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

The default subprocess path of praisonaiagents.tools.python_tools.execute_code() uses an AST deny-list and replacement builtins as guard rails. The validator rejects the original literal frame-attribute spelling, but runtime-built attribute names can reach frame introspection through the replacement getattr path.

A bounded reproduction against the current published package recovered the wrapper frame's ordinary Python builtins and demonstrated local file read/write under the sandbox subprocess account.

Why this matters

The current implementation does not provide OS-level isolation. If model- or user-controlled code is admitted to this mode, bypassing the deny-list can cross the intended restricted-Python boundary.

Suggested direction

Use the project's kernel/container-backed sandbox for untrusted execution, or apply an OS-level isolation boundary with explicit filesystem, environment, network, and process policy. Add regression coverage for runtime-built introspection paths.

This issue is opened in accordance with the current security policy's guidance for built-in Python execution guard rails.

Lingua principale
Python
Stelle
9.3k
Fork
1.5k
Merge medio
1g 5h
PR unite (30g)
520

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MervinPraison/PraisonAI

Tutte le issue di MervinPraison/PraisonAI

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.