Vulnerability library
Security checkMay 13, 2024

Nginx Code Execution due to Misconfiguration

Understand the exposure, see the recommended fix, and check whether your own website has related weaknesses.

Check your website

Find this and other vulnerabilities with a free scan.

Your scan runs on your computer. No account required.

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

Could your website be exposed too?

SmartScanner can check your website for Nginx Code Execution due to Misconfiguration and gives you actionable findings to investigate.

Start a free scan

Related Issues

See something that needs correcting? Let us knowUpdated May 13, 2024