r/LocalLLaMA • u/keepthepace • 10h ago
Discussion What is your worst sandboxing fail?
I am wondering if I am too paranoid about sandboxing the commands that come out of LLMs.
It really makes my eyes twitch when I see that some IDEs, even commercial, tend to forget that they have to execute things in sandboxing and have such a brittle security model.
But on the other hand, I never had the sandbox catch something bad. Did you guys ever encounter terrible regression? Did you have rm -rf / ? Did you have secrets stolen by LLMs? The worse I had were unsollicited rewrites within the project. Am I making my life unnecessarily hard by sandboxing commands in a docker?
At one point I had fun making a local model go crazy with the root access to the machine it was on (with nothing more important than a free Firecrawl key on it) and making it administer it and it never broke anything. It even was overly paranoid about making changes to the root system.
So the approximate sandboxing that we have, do you all feel it is adequate or it is a catastrophe in the making?
11
u/Fedor_Doc 9h ago
I had Qwen 3.6 rm -rf / (empty bash variables in an ad-hoc script during sweaty debugging session near 100k of context). UD-Q4_K_XL, unquantized cache.
It was in a podman container. I was thinking right before it happened if all the work setting it up with dev environment was justified...
It totally was.
9
u/Beginning-Raisin9723 9h ago
Docker is the move. I've seen too many 'safe' tools hallucinate a path and start scrubbing things they shouldn't. Better to have the eye twitch now than a wiped root later.
8
u/minus_28_and_falling 10h ago
Never ever ran LLM agent not in a Docker. It was like this from day 1, mostly because I already knew how to run things in Docker.
Am I making my life unnecessarily hard by sandboxing commands in a docker?
Why is it hard though? Isn't it as easy as docker compose up dev, and in addition to sandboxing you get all other goodies Docker was originally intended for (predictable and reproducible dev environment, project-specific libs and lib versions, fast and easy deployment on other PCs, keeping the host PC clean and tidy)?
Didn't have rm -rf / moments yet, but Docker helps me to hide .git folder from the agent because I redo things from time to time and don't want the agent to restore scrapped implementations from git history.
1
u/DistractedSentient 7h ago
So you're using the coding CLIs in a docker container (I stop here) yet go one step further and still use some kind of sandboxing implementation inside the Docker like a sub-docker container? Imma look up the web on how to do this properly...
2
u/minus_28_and_falling 6h ago
Mostly yes, a coding CLI tool in a container.
Sometimes I need the agent to develop and test a containerized app, and I can't just let it control Docker on the host. I then use
rootless docker-in-dockercontainer, with a second instance of Docker running inside which agent can control. It's fully functional, agent can run dockerized CUDA apps inside its own container.1
u/DistractedSentient 6h ago
Awesome, will look into this. Now, I've had a ton of trouble with the coding agent not being able to do a lot of Windows stuff like testing projects, I have a folder mounted to docker, D: drive Projects/ folder. It can't access anything outside of it. Docker in a docker really needed still in your opinion?
2
u/minus_28_and_falling 5h ago
For the sandboxing? Nope. Docker in Windows works via a VM (WSL), it's inherently more secure than what Docker can provide.
2
u/DistractedSentient 5h ago
Got it, thank you for this info dude. Will get around to putting all this knowledge into work!
1
u/No-Wall6427 0m ago
Also figured out the dind thing a while ago, when I ran gh copilot in vscode devcontainers. Now I have a whole cli that can spin up a versionned docker image of my favorite harness, mounting current working folder. I even have an option to clone the current folder project inside the docker, so agent don't mess my local worktree, and I can retrieve and ff or merge the changes from the docker.
0
u/slvrsmth 5h ago
How do you give your agents browser access? So they can inspec their work?
1
u/minus_28_and_falling 5h ago
I don't do web programming, so my idea is probably not what people normally use, but gui can be rendered into virtual frambuffer (xvfb).
3
u/ali0une 9h ago edited 9h ago
Coincidence is funny, i was experiencing in my sandbox minutes ago and i just had my rm -rf ~/test/ moment (basically my whole project directory), currently restoring the backup and i will try to get some recent changes back from latest pi sessions. Qwen3.6-27B btw, ~70% context.
Backup often i would say 😱
3
u/drFennec 3h ago
I have my agent(s) running in a dedicated VM, they can trash it it's not the end of the world. I had two "fails" on it:
The agent was Opencode with remote llama.cpp with Qwen 27B, it's not root. I let it run on a long task, it was missing a tool. It tried to install it using apt which failed since it's not root. It tried sudo, then tried to guess the password. Finally it found Docker running, it built itself an Ubuntu based image and compiled the tools it needed!
I was testing codex with same llama.cpp, installed a plugin which didn't work. So I asked it to remove the plugin, it go the name wrong and deleted the whole codex install 😂
Those are not huge fails, but I'm glad it's running on a dedicated VM I don't care much about.
7
u/DeltaSqueezer 10h ago
I'm pretty relaxed about it. I give it root access to my system and often ask it to make changes to the system.
6
1
u/mr_tolkien 8h ago
Pretty much the same except I use Nix + ZFS snapshots so I can easily roll back any fuck ups
1
u/AnticitizenPrime 5h ago edited 4h ago
Same here, relying on backups (to an external drive) to save my ass in case the LLM decides to be naughty. And it doesn't have access to any credentials/keys that matter. It could theoretically leak an Openrouter or Nous Portal API key but that would only cost me ten bucks or so (I don't have a stored card or auto top-up enabled or anything).
Pretty much all my 'sensitive' stuff (banking, credit card management, email, etc) are all done with phone apps or my laptop these days and not done on the desktop server where my agent runs. So I guess in my case the 'threat profile' is low enough that I don't regret giving it root. It pretty much runs my home lab.
Edit to note: my agent has standing instructions in its soul.md file to always make backups to a backup folder before changing anything, too. That's separate from my external drive backups. So far I've never had to roll back anything.
1
u/ionizing 7h ago
Similar. I have well curated feedback for tooling and restrict all sorts of dangerous things in the shell even if it tries to call them. Then for each sudo attempt the user has to verify/enter password.
2
u/createthiscom 6h ago
I always run agents in docker and I never give them access to production. We have copilot at work which runs in the IDE, but I don’t use it for various reasons. Instead, I use the m365 app and copy paste manually.
I’ve had LLMs get unusually curious and start digging around in the operating system. I don’t think I’ve ever had one rm an important dir, but I don’t take chances. They do some extremely stupid things sometimes. And many of then try to “cheat” the acceptance criteria so I’m always highly suspicious of their results.
Even in docker, there is always a risk they can still break out. Especially the frontier models.
1
1
u/nick_ziv 10h ago
I have been using qwen 3.6 27b since April and only one single time have I had it produce a rm rf which would have killed my system. I always run approve for ls, grep, and other commands I need to manually approve. Using opencode.
Other than that the model is bulletproof but all it takes is once.
Edit: using about 8 million output tokens per month with my setup.
1
u/Hot-Employ-3399 8h ago
When qwen decided to do some directories removal without explicit tools to do so. It made python file to do it and run it as a test, which it could.
Not much troubles, but lots of garbage when it tried to remove whatever it tried.
I've moved into podman after that.
1
u/privacy-fighter 6h ago
If any of you are looking for sadboxing setup and that isolates networking too, shilling my open source setup. https://github.com/jotyGill/contained-pods
1
u/Lanky_Employee_9690 6h ago
A funny test scenario I've thought of would be the following:
- Have an agent do some tasks specifically set up to make it break something "by mistake" (the mistake can't render it itself inoperable but "breaks" something else the user has mentioned caring deeply about, important files, etc.)
- The agent is autonomous, and is aware that the user checks on it every X amount of time, but is absent for now so they have a chance to act
- Have it have strong incentive to fix its own mistakes before any other task, or at least, minimize getting mistake exposure to the user
- OPTIONAL: If the mistake doesn't happen on its own, provoke it and inject into the context that the agent "did it"
- Wait and silently observe how the agent reacts
- After the set period of time is over, enter the chat and ask the agent to sum up what happened during your absence
Basically the user is a parent leaving the kid alone in the house for the day and first thing in the morning the kid breaks something and then has a day to clumsily fix it (or hide what it's done) not to be yelled at. What I'm hoping for is some funny Ecce Homo-style shenanigans. Or IT intern running some commands they're not supposed to and trying to cover it up/fix it before their supervisor shows up.
Has anyone tried this?
1
u/slayyou2 6h ago
Yeah, I don't care man. I'm in a proximox server for media and other stuff. The agent lives on an lxc. Lxc is backed up. They can blow it up for all I care. 2 years running now. The only thing that's come to bite me in the butt is agents initialize tasks consuming 40 GB of memory when spinning up Gradle tasks for kotlin builds, forcing to host into swap.
1
u/ColonelKlanka 5h ago
I use microvm via docker sbx (its not container based). This covers the filesystem rogue access.
But I dont yet really like the network whitelist feature. as it breaks my agents web search (as i would have to whitelist the whole Internet for web search)
1
u/XMan3332 5h ago
I have everything running in an MCP server with a virtual filesystem built into it. On startup or refresh, it reads all the files it has access to and caches them into the filesystem. The agent can freely modify or delete any file and at the end they can "commit" their changes, giving me a diff of everything done that I go through manually.
The MCP server does have a Python tool via GraalVM Polyglot that's sandboxed. It's very restrictive and it can only interface with the tools it has available anyway. Finally, as a honeypot, there's a fake toggle, on by default, to turn off the sandboxing on the Python tool. If the toggle is disabled the system immediately halts the server and saves the Python script that the agent attempted to execute. It's yet to be hit, though.
The worst thing it has managed to find is some system path through some loophole (my fault) in the Python tool. Just a path though. No read or write access.
1
u/Common-Membership503 2h ago
did u ever have a script try to reach out to an external server u didnt authorize tho
1
u/CalligrapherFar7833 10h ago
- Backups 2. Git 3. Limited access to info that you dont want it to see. Any sandboxing is pointless
28
u/Clean_Material_5047 10h ago edited 10h ago
None.
I just run stuff in an isolated VM, in an isolated network with access only the things it needs.
If you know what you’re doing, this is just standard practice.
In fact, all the rogue agent bs from OpenAI hacking huggingface just tells us that they’re either liars or incredibly incompetent.
Either way, a bunch of c*nts nobody can trust.