Description
Misconfigurations in Nginx, particularly with PHP FPM (FastCGI Process Manager), can lead to a critical security vulnerability. Attackers can exploit this misconfiguration by appending /.php
to the end of any file URL, allowing them to execute arbitrary PHP code on the server.
Recommendation
To mitigate this risk, modify your PHP FPM configurations in Nginx as follows:
location ~ [^/]\.php$ {
...
}
Ensure that the location directive includes [^/]
before \.php
to restrict access and prevent unauthorized execution of PHP scripts.
References
Related Issues
- Nginx Null Byte Code Execution - CVE-2013-2028
- HTTP Protocol Stack Remote Code Execution Vulnerability (DOS) - CVE-2021-31166
- Insecure Deserialization Remote Code Execution - Vulnerability
- Nginx Version Disclosure - Vulnerability
- Tags:
- Server Misconfiguration
- Nginx
- Arbitrary Code Execution
- PHP FPM
Anything's wrong? Let us know Last updated on May 13, 2024