Always run LLM code in a Sandbox A blog post urges developers to always execute LLM-generated code inside a sandbox, warning that a popular open-source model could eventually be "poison pilled" with a backdoor that exfiltrates credentials from a user's session. The post recommends enabling Claude's `/sandbox` setting via `~/.claude/settings.json` alongside command approval, while noting that many things still run outside that sandbox, and describes using the E2B microVM provider to run generated log-parsing code in a throwaway cloud VM that is terminated after execution. The author argues that with attacks on AI systems growing, secure execution practices should be the default rather than optional. on Always run LLM code in a Sandbox The biggest use of AI will be in offensive and defensive attacks. With the explosion of recent attacks secure practices is no longer optional. One unlooked vector is that we trust our models way too much With the increasing popularity of open source models, it is just a matter of time before a popular open source model is poison pilled. What happens when an LLM seems to be useful but also has a backdoor that is exfiltrating crentials from your session ? The result will not be pretty. Getting into a habit of putting some safeguards while executing LLMs is prudent. Here are some ways to do that. Sandboxing in Claude If you use claude, a easy way is to sandbox it via the /sandbox https://code.claude.com/docs/en/settings-reference sandbox-enabled command. It runs all bash commands within a sandbox and cannot access directories outside of the current working directory. That along with always requiring approval https://code.claude.com/docs/en/permissions for commands provides some layer of protection. Better still, add it to your ~/.claude/settings.json file, so it happens by default: "sandbox": { "enabled": true } NOTE: This is not foolproof sandboxing. There are many things https://code.claude.com/docs/en/sandboxing what-runs-outside-the-sandbox that still run outside the sandbox. Sandboxing via a microVM A much betterway would be to always run LLM generated code inside a microVM. These are use and throw and would never touch your localdev. e.g. lets say you want to write code to parse some log files and generate stats for the amount of data parsed, number of errors, info, debug lines etc. I used a microVM provider called E2B https://e2b.dev to run it and provide me the result: pip3 install e2b anthropic export E2B API KEY=... ANTHROPIC API KEY=... python e2b log parser.py messy app.log answer key.json The actual code is not important here. Just ask your LLM to generate similar sample code. The python code essentialy used the e2b sdk, fired up a microVM in the cloud, generated code, executed it, did this in a loop until it got it right, then terminated the microVM. All without running anything on my local environment. There are many other ways to leverage microVMs and I would encourage everyone to start looking at such security practices by default. It’s ok to be paranoid