CVE-2026-6104: Global buffer over-read in mb_convert_encoding() with attacker-supplied encoding
In PHP versions 8.4.* before 8.4.21 and 8.5.* before 8.5.6, when an encoding name containing an embedded NUL byte is passed to mb_convert_encoding() or related mbstring functions, the code incorrectly assumes that when strncasecmp() returns 0 it means the strings have the same length. This can lead to out-of-bounds read of global memory, potentially causing a crash or information disclosure or crash. Affected functions include mb_convert_encoding(), mb_detect_encoding(), mb_convert_variables(), and mb_detect_order(), as well as the mbstring.detect_order and mbstring.http_output INI settings.
Security readout for executives and security teams
Plain-English summary
PHP mbstring can read beyond expected memory when given an encoding name containing an embedded NUL byte. For exposed applications, this could crash PHP processes or disclose limited memory. The issue is high priority where untrusted users can influence character encoding parameters.
Executive priority
Treat as a high-priority maintenance and exposure-reduction issue. Patch affected PHP 8.4 and 8.5 systems promptly, especially public services using mbstring with user-controlled encodings.
Technical view
CVE-2026-6104 is a CWE-125 global buffer over-read in PHP 8.4 before 8.4.21 and 8.5 before 8.5.6. mbstring incorrectly treats a zero strncasecmp() result as equal length, affecting mb_convert_encoding(), mb_detect_encoding(), mb_convert_variables(), mb_detect_order(), and related INI settings.
Likely exposure
Exposure is most likely in PHP 8.4 or 8.5 applications using mbstring where request data, API input, headers, or configuration can influence encoding names.
Exploitation context
The bundle lists network, low-complexity, unauthenticated impact with no user interaction. KEV is false, and no provided source states active exploitation. Evidence supports crash and possible limited information disclosure, not integrity compromise.
Researcher notes
Focus triage on whether an attacker can introduce embedded NUL bytes into encoding names passed to affected mbstring APIs or settings. Do not assume all PHP applications are exposed solely because mbstring is installed.
Mitigation direction
Upgrade PHP 8.4 deployments to 8.4.21 or later.
Upgrade PHP 8.5 deployments to 8.5.6 or later.
Apply relevant vendor or distribution errata, including Red Hat advisories where applicable.
Restrict accepted encoding names to a fixed approved list.
Check PHP Group and platform vendor guidance before adding compensating controls.
Validation and detection
Inventory systems running PHP 8.4 or 8.5 with mbstring enabled.
Review code for affected mbstring functions accepting variable encoding names.
Check configuration using mbstring.detect_order or mbstring.http_output.
Confirm installed PHP versions include the fixed vendor build.
Prioritize internet-facing services and APIs handling user-supplied encodings.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-125: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-125 · source CWE mapping
Out-of-bounds Read
Out-of-bounds Read represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.