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 天內回覆