Skip to content

Why arbitrary AI execution needs a sandbox

اے آئی کا چلنا سینڈ باکس کے بغیر کیوں خطرناک ہے

33 min read

Three ways to see it

  1. A sandbox is a fenced workspace where code can run, files can be created, and commands can be issued, but nothing inside it can reach out and touch the systems that matter. Real disks, real databases, real networks are walled off. If the code inside the sandbox does something destructive, the damage stops at the fence. The same way a chowkidar at the gate of a Defence house in Lahore checks every delivery before it enters, a sandbox checks every AI-generated action before it touches your environment.

  2. Way one to think about danger: shell access is total power. When you let an AI run shell commands directly, you have effectively handed it your own user account. It can read every file you can read, delete every file you can delete, send any HTTP request you can send. Modern AI models do not have intent in the human sense, but they do follow instructions, and a poorly-phrased instruction can produce a destructive command. The model will not stop and ask 'are you sure'. It will run the command because that is what you asked.

  3. Way two: code generation is not the same as code review. A model is brilliant at writing code that looks right. It is much less reliable at judging whether the code is safe in your specific environment. A perfectly correct piece of Python that deletes old log files becomes a disaster when 'old' means 'older than today' on a server where logs are the only audit trail. The model did what you asked. The model did not know what mattered. Sandboxes give you the space to run, observe, and roll back before the consequences are real.

Quick check

Quick check: what makes modern AI different from a rule-based program?

The why-tree

Why-tree level one: why does AI need a sandbox more than a human does? Because a human pauses. A human in HBL operations who is asked to delete every file in /home stops and double-checks. A model does not pause. It does not feel a knot in its stomach. The sandbox is the artificial pause.

Try this with Claude

AI-edge prompt: 'I run IT operations at a 500-person Pakistani bank. Audit my AI usage and tell me which of these workflows must run in a sandbox versus which can run with direct access: (1) summarising daily branch reports, (2) writing SQL queries against the customer database, (3) drafting emails to customers, (4) generating compliance reports for SBP, (5) translating Urdu loan applications. Justify each.' Compare the model's answer to your gut.

Sources

Sources and further reading. Anthropic, Computer Use safety (docs.anthropic.com/en/docs/agents-and-tools/computer-use). Anthropic, Skills documentation. OWASP LLM Top 10 (genai.owasp.org/llm-top-10) — especially LLM02 Insecure Output Handling and LLM08 Excessive Agency. NIST AI Risk Management Framework (nist.gov/itl/ai-risk-management-framework). Microsoft Copilot security architecture overview. E2B and Daytona sandbox-as-a-service documentation. Pakistan PECA 2016 sections relevant to unauthorised system access.

Mark complete + next lesson →