Default php ini now disable php system dangerous function#275
Default php ini now disable php system dangerous function#275froozeify wants to merge 4 commits intoglpi-project:mainfrom
Conversation
cedric-anne
left a comment
There was a problem hiding this comment.
-
The
toolsdirectory is not present in the GLPI release archives, so there is no need to allow usage of theproc_openfunction in theglpi/glpiimage. -
IMHO, for the dev environment, there is no need to apply this configuration for the CLI context. Indeed, as long as we have to allow the usage of
proc_open, an RCE is possible and disabling other functions is not sufficient. Since this is a dev environment, this is not an issue. Keeping the Apache configuration is still interesting as it can permit to dectect unexpected call to these function in our code. -
Could you check if we have the posix extension in our docker image ? Many
posix_*function should be disabled too in this case, but not theposix_geteuidfunction for instance. -
The
pcntl_async_signals,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatchfunctions should not be disabled, they are useful to handle signals coming from the system. -
As a bonus, maybe we could add a rule in our custom PHPStan extension, to mark usage of these methods as an issue. It would not detect usages inside vendor packages, but, at least, it could permit to prevent using these functions in our code.
|
I had disabled for the dev env, so we could mimic as close as possible to the prod image. PHPStan extension : glpi-project/phpstan-glpi#16 |
Disable dangerous PHP functions to prevent RCE.
I checked on GLPI 11 for usage of those command, only core tools use them.
But those tools are not exposed in PROD image so it should not cause any issue.
I didn't check for plugin as they should normally not use any of this system call (just a doubt if they expose sf commands)