{"vuln_id":"GHSA-rwp7-7vc6-8477","aliases":["CVE-2024-11235"],"description":"Reference counting in php_request_shutdown causes Use-After-Free","published_at":"2025-03-13T17:44:39Z","modified_at":"2025-03-13T17:44:40Z","first_seen_at":"2026-11-22T14:05:37.615446Z","severity":"medium","severity_source":"ghsa","cvss_score":null,"cvss_vector":null,"cwe":["CWE-416"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-rwp7-7vc6-8477"},"matched_alias":null,"items":[{"id":12654,"source":{"id":"gh-php-src","name":"PHP releases (GitHub php/php-src tags)"},"title":"GHSA-rwp7-7vc6-8477 / CVE-2024-11235: Reference counting in php_request_shutdown causes Use-After-Free","summary":"Reference counting in php_request_shutdown causes Use-After-Free\n\n### Summary\r\n\r\nException handler frees variables via `cleanup_live_vars` for termination. However, the subsequent `php_request_shutdown` performs reference counting on these variables using `zend_gc_refcount`(read) and `zend_gc_delref`(write), resulting in use-after-free. Since `zend_mm_free_small` stores metadata in freed memory chunks, this use-after-free vulnerability may allows manipulation of the Zend allocator through reference count behaviors.\r\n\r\n### Details\r\n\r\n- **OS**: Ubuntu 22.04 (x86)\r\n- **PHP Version**: php-8.4.0beta5\r\n- **FYI**: A similar bug with the handler (#10169) was reported two years ago and patched, but it just increased the reference count before the handler.\r\n\r\n```cpp\r\nAccess:\r\n    #0 0x55d832ba169c in zend_gc_refcount Zend/zend_types.h:1318:12\r\n    #1 0x55d832ba169c in zval_refcount_p Zend/zend_types.h:1367:9\r\n    #2 0x55d832ba169c in zval_call_destructor Zend/zend_execute_API.c:217:35\r\n    #3 0x55d832e53559 in zend_hash_reverse_apply Zend/zend_hash.c:2226:13\r\n    #4 0x55d832ba1062 in shutdown_destructors Zend/zend_execute_API.c:262:4\r\n    #5 0x55d832fd0b84 in zend_call_destructors Zend/zend.c:1325:3\r\n    #6 0x55d8328338a7 in php_request_shutdown main/main.c:1916:3\r\n    #7 0x55d832fdf066 in do_cli sapi/cli/php_cli.c:1105:3\r\n    #8 0x55d832fdb393 in main sapi/cli/php_cli.c:1309:18\r\n    #9 0x7f5f61429d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\r\n    #10 0x7f5f61429e3f in __libc_start_main csu/../csu/libc-start.c:392:3\r\n    #11 0x55d832001ce4 in _start (sapi/cli/php+0x401ce4)\r\n\r\nFree:\r\n    #1 0x55d832a35696 in __zend_free Zend/zend_alloc.c:3308:2\r\n    #2 0x55d832a38b0d in _efree Zend/zend_alloc.c:2747:3\r\n    #3 0x55d832f3bfbf in zend_objects_store_del Zend/zend_objects_API.c:198:3\r\n    #4 0x55d832fb603b in rc_dtor_func Zend/zend_variables.c:57:2\r\n    #5 0x55d832bcdaee in cleanup_live_vars Zend/zend_execute.c\r\n    #6 0x55d832e01cd5 in zend_dispatch_try_catch_finally_helper_SPEC Zend/zend_vm_execute.h:3227:2\r\n    #7 0x55d832d5f83e in ZEND_HANDLE_EXCEPTION_SPEC_HANDLER Zend/zend_vm_execute.h\r\n    #8 0x55d832bd2aa4 in execute_ex Zend/zend_vm_execute.h:58585:7\r\n    #9 0x55d832bd362d in zend_execute Zend/zend_vm_execute.h:64237:2\r\n    #10 0x55d832fd6a09 in zend_execute_script Zend/zend.c:1928:3\r\n    #11 0x55d832839658 in php_execute_script_ex main/main.c:2578:13\r\n    #12 0x55d832839c08 in php_execute_script main/main.c:2618:9\r\n    #13 0x55d832fde33c in do_cli sapi/cli/php_cli.c:935:5\r\n    #14 0x55d832fdb393 in main sapi/cli/php_cli.c:1309:18\r\n    #15 0x7f5f61429d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\r\n\r\nAlloc:\r\n    #1 0x55d832a390cc in __zend_malloc Zend/zend_alloc.c:3280:14\r\n    #2 0x55d832a389ed in _emalloc Zend/zend_alloc.c:2737:10\r\n    #3 0x55d832f3e1fc in zend_objects_new Zend/zend_objects.c:210:24\r\n    #4 0x55d832a59ddb in _object_and_properties_init Zend/zend_API.c:1823:22\r\n    #5 0x55d832a5a608 in object_init_ex Zend/zend_API.c:1846:9\r\n    #6 0x55d832\nPatched:  8.3.19,  8.4.5","url":"https://github.com/php/php-src/security/advisories/GHSA-rwp7-7vc6-8477","published_at":"2025-03-13T17:44:39Z","updated_at":"2025-03-13T17:44:40Z","fetched_at":"2026-11-22T14:05:37.431190Z","severity":"high","cvss_score":8.1,"epss":0.01482,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"php","product":"php-src","vuln_id":"CVE-2024-11235","vuln_ids":["CVE-2024-11235","GHSA-RWP7-7VC6-8477"],"tags":["repo-advisory","CWE-416","security","repo:php/php-src","stack"],"cluster_id":11763,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/12654","html":"https://vulnwatch.ve1ve2.com/item/12654"}}]}