FPM: NULL dereference in fpm_status_export_to_zval() when the scoreboard copy fails (PHP-8.3)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 sapi/fpm/fpm/fpm_status.c 中的 fpm_status_export_to_zval() 开始,将 PHP-8.3 代码与 issue 中描述的 PHP-8.6 防护进行比较。报告称,sapi/fpm/fpm/fpm_main.c 中的 fpm_get_status() 会到达此函数;在复制 scoreboard 后添加 NULL 处理,并确认函数在失败时返回 -1。
由索引模型根据 Issue 内容生成。
描述
Description
fpm_status_export_to_zval() in sapi/fpm/fpm/fpm_status.c dereferences the result of fpm_scoreboard_copy() without a NULL check:
scoreboard_p = fpm_scoreboard_copy(NULL, 1); /* line 84 */
now_epoch = time(NULL);
fpm_clock_get(&now);
array_init(status);
add_assoc_string(status, "pool", scoreboard_p->pool); /* line 90 -- no NULL check */
fpm_scoreboard_copy() can return NULL (allocation failure, or no scoreboard), and the result is dereferenced immediately, crashing the worker.
This is reachable from PHP userland via the fpm_get_status() builtin (sapi/fpm/fpm/fpm_main.c:1525, which calls fpm_status_export_to_zval() at :1531).
PHP-8.6 already guards this right after the copy (if (!scoreboard_p) { return -1; }); PHP-8.3 is missing the guard.
Not a cross-boundary vulnerability — the trigger is calling a documented PHP function plus a scoreboard-copy failure (e.g. under OOM); it is a self-crash (NULL dereference) of the calling worker.
Suggested fix
Backport the 8.6 guard to PHP-8.3: return -1 when fpm_scoreboard_copy() returns NULL. PR to follow.
PHP Version
PHP-8.3 branch at 3f52e69cdb (PHP 8.3.38-dev (fpm-fcgi), DEBUG).
Operating System
Linux
- 主要语言
- C
- 星标
- 41.9k
- 派生
- 8.5k
- 平均合并
- 2 天 16 小时
- 30 天内合并 PR
- 117
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
FPM/FastCGI: FCGI_HASH_FUNC reads var[3] for 3-character names (guarded only by var_len < 3)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
FPM: fpm_request_end() releases the scoreboard writer lock without acquiring it (8.6 regression)未关闭
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
Bug Status: Verified
难度 1/5 1 小时以内 新手友好度 74/100
维护者通常 1 天内回复
-
getimagesize(): WebP VP8 dimensions are accepted with an invalid start code可能已有人在做 @lazerg 于 5 天前认领。 未关闭Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
CF_CFDP_S_SendFileData computes the file checksum from the SB buffer after CFE_SB_TransmitBuffer未关闭
难度 2/5 1-3 小时 新手友好度 78/100
-
needs triage
难度 2/5 1-3 小时 新手友好度 72/100
389ds/389-ds-base#8251 ·
维护者通常 1 天内回复
-
bug data-types
难度 2/5 1-3 小时 新手友好度 76/100
ClickHouse/clickhouse-cpp#645 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ROCm/hrx-system#3628 ·
维护者通常 1 天内回复