Quick answer
An AI platform let its users write bot logic in Python executed in a "sandbox." The sandbox didn't block the os module. Two lines (os.popen("env").read(), os.popen("whoami; uname -a").read()) were enough to run system commands, read internal environment variables and fingerprint the underlying runtime. Severity: Critical.
1. Context — what is the Python Sandbox?
The platform lets users create bots with custom logic by writing Python code directly in the app. This code runs in an environment called the "sandbox" when the bot receives messages.
The promise of the sandbox is that the code runs in a controlled, isolated environment. The bug found proves that that isolation doesn't exist: from the bot's Python code you can directly run operating-system commands on the server.
2. The bug — unrestricted shell access
The sandbox doesn't block the os module or the functions that let you run system commands. Specifically, os.popen() opens a shell subprocess and returns its output directly in the bot's response.
PoC A — Environment variables
import os
print(os.popen("env").read())
This code runs the env command on the server and returns all the process's environment variables. The observed output includes internal variables of the execution system and internal runtime paths (/__runtime/*), which reveal that the sandbox runs on a publicly known serverless Python platform.
Keep reading the full chain
The remaining part includes the step-by-step PoC, exploitation code and the full chain that led to impact. Available to subscribers.
Practice this in a lab
Rce
Keep learning · free account
Save your progress, unlock advanced payloads and rank your flags.
Related articles
Command Injection — bypasses with spaces, encoding and backticks
Command injection in endpoints that pass input to the shell. Filter bypasses: ${IFS}, $@, ;|&, encoded null bytes, output redirection to a file.
Headless browsers — SSRF and RCE in endpoints that render URLs
Endpoints that accept URLs for screenshots/PDF (Puppeteer, Playwright, wkhtmltopdf) are an SSRF goldmine: cloud metadata, file://, gopher://, JS injection with XSS-to-RCE in the chromium sandbox.
File Upload — extension, content-type and magic bytes bypasses
10 bypasses to upload webshells: double extension, null byte, content-type spoof, magic bytes, polyglots, race conditions and path traversal abuse.