hacktricks/generic-methodologies-and-resources/python/python-internal-read-gadgets.md
2024-02-10 17:52:19 +00:00

14 KiB

Python Internal Read Gadgets

Learn AWS hacking from zero to hero with htARTE (HackTricks AWS Red Team Expert)!

Other ways to support HackTricks:

Basic Information

Different vulnerabilities such as Python Format Strings or Class Pollution might allow you to read python internal data but won't allow you to execute code. Therefore, a pentester will need to make the most of these read permissions to obtain sensitive privileges and escalate the vulnerability.

Flask - Read secret key

The main page of a Flask application will probably have the app global object where this secret is configured.

app = Flask(__name__, template_folder='templates')
app.secret_key = '(:secret:)'

ghItlh vItlhutlh 'ejwI' ghItlh Bypass Python sandboxes page gadget 'e' access 'e' object 'e'.

'ejwI' vulnerability 'e' python file 'e' vItlhutlh gadget 'e' files 'e' traverse 'e' main 'e' 'ej 'e' global object app.secret_key 'e' access 'e' Flask secret key 'ej 'e' escalate privileges 'e'.

payload 'e' 'ej [writeup 'e' 'e' (https://ctftime.org/writeup/36082)]:

{% code overflow="wrap" %}

__init__.__globals__.__loader__.__init__.__globals__.sys.modules.__main__.app.secret_key

{% endcode %}

app.secret_key (app-ghItlh) ghItlh (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) app.secret_key (app-ghItlh) **

{ua.__class__.__init__.__globals__[t].sys.modules[werkzeug.debug]._machine_id}
{ua.__class__.__init__.__globals__[t].sys.modules[werkzeug.debug].uuid._node}

{% hint style="warning" %} Qapla'! Qa'vIn app.py server local path ghItlh web page error ghItlh path. {% endhint %}

vulnerability python file vIlegh Flask trick previous access objects.

Learn AWS hacking from zero to hero with htARTE (HackTricks AWS Red Team Expert)!

HackTricks support ways: