PHP转Shell
PHP2Shell

原始链接: https://www.php2shell.com

将 memory_limit 设置为 -1 可以阻止依赖 PHP 内存限制处理的某些攻击路径,但会把内存耗尽处理转交给操作系统。在此配置下,内存耗尽的 worker 进程可能被终止,从而中断请求,影响服务器的稳定性和可用性。若决定启用,请使用 Linux cgroup v2 的 memory.max 或等效的操作系统机制,以帮助控制资源消耗并限制对 PHP 进程的可用性影响。应以管理方式应用配置更改并重启受影响的 worker。不要使用 RLIMIT_AS 或 RLIMIT_DATA 作为替代内存限制。PHP 安全通告警告这些可能触发相同的脆弱失败路径。此措施不覆盖应用特定的大内存分配路径或非内存相关触发因素。在多线程部署中,终止进程还可能中断其他线程上运行的请求。

Hacker News 新 | 往期 | 评论 | 提问 | 展示 | 工作 | 提交 登录 PHP2Shell (php2shell.com) 10 分 由 nr378 1 小时前 | 隐藏 | 往期 | 收藏 | 讨论 帮助 考虑申请 YC 2027 冬季批次!申请开放至 11 月 2 日。 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Setting memory_limit = -1 can prevent some attack paths that rely on PHP's memory-limit handling, but it transfers memory-exhaustion handling to the operating system. With this configuration, memory-exhausted workers may be terminated, interrupting requests and affecting stability and availability of the server. If you decide to enable this, use Linux cgroup v2 memory.max, or an equivalent operating-system mechanism, to help contain resource consumption and limit the availability impact to PHP processes. Apply configuration changes administratively and restart the affected workers.

Do not use RLIMIT_AS or RLIMIT_DATA as replacement memory limits. The PHP advisory warns that these can trigger the same vulnerable failure paths.

This measure does not cover application-specific large-allocation paths or non-memory-related triggers. In threaded deployments, terminating a process can also interrupt requests running on other threads.

联系我们 contact @ memedata.com