LFI2RCE via Segmentation Fault
Last updated
Last updated
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)
According to the writeups https://spyclub.tech/2018/12/21/one-line-and-return-of-one-line-php-writeup/ (second part) and https://hackmd.io/@ZzDmROodQUynQsF9je3Q5Q/rJlfZva0m?type=view, the following payloads caused a segmentation fault in PHP:
You should know that if you send a POST request containing a file, PHP will create a temporary file in /tmp/php<something>
with the contents of that file. This file will be automatically deleted once the request was processed.
If you find a LFI and you manage to trigger a segmentation fault in PHP, the temporary file will never be deleted. Therefore, you can search for it with the LFI vulnerability until you find it and execute arbitrary code.
You can use the docker image https://hub.docker.com/r/easyengine/php7.0 for testing.
Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE) Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)