{"vuln_id":"GHSA-h35g-vwh6-m678","aliases":["CVE-2024-8929"],"description":"[Mysqlnd] Leak partial content of the heap through heap buffer over-read ","published_at":"2024-11-21T18:15:38Z","modified_at":"2024-11-21T18:15:38Z","first_seen_at":"2026-11-22T14:05:37.618996Z","severity":"high","severity_source":"ghsa","cvss_score":null,"cvss_vector":null,"cwe":["CWE-126","CWE-200","CWE-244","CWE-488"],"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-h35g-vwh6-m678"},"matched_alias":null,"items":[{"id":12661,"source":{"id":"gh-php-src","name":"PHP releases (GitHub php/php-src tags)"},"title":"GHSA-h35g-vwh6-m678 / CVE-2024-8929: [Mysqlnd] Leak partial content of the heap through heap buffer over-read","summary":"[Mysqlnd] Leak partial content of the heap through heap buffer over-read ### Summary By connecting to a fake MySQL server or tampering with network packets and initiating a SQL Query, it is possible to abuse the function `static enum_func_status php_mysqlnd_rset_field_read` when parsing MySQL fields packets in order to include the rest of the heap content starting from the address of the cursor of the currently read buffer. Using PHP-FPM which stays alive between request, and between two different SQL query requests, as the previous buffer used to store received data from MySQL is not emptied and `malloc` allocates a memory region which is very near the previous one, one is able to extract the response content of the previous MySQL request from the PHP-FPM worker. ### Details After the connection against a MySQL database is established, when initiating a SQL query, for example through `mysqli_query`, the expected response from the server is of the following format : - A `column count` packet, describing the number of fields that are expected to be received; - As much as `fields packets` as there are fields to be transmitted; - An `intermediate EOF` packet, telling it is the end of the \"fields packets\"; - As much as `row packet` as there are entries to be transmitted. The MySQL `fields` packets, are parsed by the `static enum_func_status php_mysqlnd_rset_field_read` defined in `/ext/mysqlnd/mysqlnd_wireprotocol.c`. Here are the interesting parts : ``` C static enum_func_status php_mysqlnd_rset_field_read(MYSQLND_CONN_DATA * conn, void * _packet) { MYSQLND_PACKET_RES_FIELD *packet = (MYSQLND_PACKET_RES_FIELD *) _packet; MYSQLND_ERROR_INFO * error_info = conn->error_info; MYSQLND_PFC * pfc = conn->protocol_frame_codec; MYSQLND_VIO * vio = conn->vio; MYSQLND_STATS * stats = conn->stats; MYSQLND_CONNECTION_STATE * connection_state = &conn->state; const size_t buf_len = pfc->cmd_buffer.length; size_t total_len = 0; zend_uchar * const buf = (zend_uchar *) pfc->cmd_buffer.buffer; const zend_uchar * p = buf; const zend_uchar * const begin = buf; char *root_ptr; zend_ulong len; MYSQLND_FIELD *meta; ... // We learn here that it is not supposed to support COM_FIELD_LIST anymore. if (ERROR_MARKER == *p) { /* Error */ p++; BAIL_IF_NO_MORE_DATA; php_mysqlnd_read_error_from_line(p, packet->header.size - 1, packet->error_info.error, sizeof(packet->error_info.error), &packet->error_info.error_no, packet->error_info.sqlstate ); DBG_ERR_FMT(\"Server error : (%u) %s\", packet->error_info.error_no, packet->error_info.error); DBG_RETURN(PASS); } else if (EODATA_MARKER == *p && packet->header.size < 8) { /* Premature EOF. That should be COM_FIELD_LIST. But we don't support COM_FIELD_LIST anymore, thus this should not happen */ DBG_ERR(\"Premature EOF. That should be COM_FIELD_LIST\"); php_error_docref(NULL, E_WARNING, \"Premature EOF in result field metadata\"); DBG_RETURN(FAIL); } ... // Par Patched: 8.1.31, 8.2.26, 8.3.14","url":"https://github.com/php/php-src/security/advisories/GHSA-h35g-vwh6-m678","published_at":"2024-11-21T18:15:38Z","updated_at":"2024-11-21T18:15:38Z","fetched_at":"2026-11-22T14:05:37.431193Z","severity":"high","cvss_score":5.8,"epss":0.02219,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"php","product":"php-src","vuln_id":"CVE-2024-8929","vuln_ids":["CVE-2024-11233","CVE-2024-11234","CVE-2024-11236","CVE-2024-8929","CVE-2024-8932","GHSA-H35G-VWH6-M678"],"tags":["repo-advisory","CWE-126","CWE-200","CWE-244","CWE-488","security","repo:php/php-src","stack"],"cluster_id":11768,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/12661","html":"https://vulnwatch.ve1ve2.com/item/12661"}}]}