I am a security researcher who has been running into multiple cases where file upload forms can be exploited, allowing attacker-controlled PHP code to be interpreted by the server, leading to remote code execution. The root cause of this vulnerability seems to be a legacy setting that is enabled by default in the Apache config of following Linux Distros:
- CentOS 5.8
- CentOS 6.5
- RedHat 5.10
- RedHat 6.5
and possibly others. The setting is:
AddHandler application/x-httpd-php .php
The effect of this setting that is concerning is that it tells the server that files with names that match \.php should be interpreted as PHP code. If an attacker uploads an image with the name shell.php.jpg with php code embedded in it, and navigates to the page, the server will execute the script as the server user.
My recommended remediation is to disable this setting by commenting it out. My reasoning is that .php files already have an implicit handler built in to Apache, which tells the server to interpret the code as php, so this setting seems to my eyes to be redundant. I get the feeling that this is a legacy setting carried forward by old versions of CentOS and RedHat, and the newest versions do not have this setting.
My question is: Under what circumstances will disabling this setting break functionality?