Dangerous PHP functions are allowed
MediumP04PHP servers (Linux and Windows)Block functions such as exec and system in web PHP so a web shell can do less.
What is the risk
Once there is a web shell or code execution bug, attackers first run server commands with exec, system, shell_exec, passthru, proc_open or popen.
Blocking these with disable_functions limits what the same bug can do. It does not stop everything, so treat it as an extra layer.
How to check
Linux
php -i | grep '^disable_functions'
grep -rn '^disable_functions' /etc/php/*/fpm/php.ini /etc/php.ini 2>/dev/nullWindows PowerShell (admin)
& "C:\php\php.exe" -i | Select-String disable_functionsHow to fix
php.ini
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,pcntl_execPut it in the php.ini the web uses (on Debian and Ubuntu /etc/php/VERSION/fpm/php.ini). Leave the command-line php.ini alone so cron jobs keep working. Test uploads, image processing and mail afterwards.
Debian / Ubuntu
sudo systemctl restart php8.3-fpmRHEL / Rocky / Alma
sudo systemctl restart php-fpmWindows PowerShell (admin)
if (Get-Service W3SVC -ErrorAction SilentlyContinue) { iisreset } else { Get-Service *apache* -ErrorAction SilentlyContinue | Restart-Service }Restarts IIS if installed, otherwise the Apache service. With XAMPP press Stop then Start for Apache in the Control Panel.
How to prevent it
- Use PHP extensions instead of calling server commands from your code.
- Run PHP as a low-privilege account separate from the web server (the FPM pool user).
- Use open_basedir as well.
Check again after fixing
Debian / Ubuntu
php-fpm8.3 -i | grep '^disable_functions'On RHEL use php-fpm -i.
Run the downloaded check again and make sure this item passes.