Description

Recent research has uncovered a significant vulnerability in the Windows operating system, exploiting its "Best-Fit" charset conversion feature. This behavior, designed to map unsupported characters between modern Unicode (UTF-16) and legacy ANSI encodings, inadvertently creates security risks. The flaw affects various widely-used applications like Microsoft Excel and PHP-CGI, enabling attackers to bypass security checks and execute remote code. The study revealed several critical vulnerabilities, including CVE-2024-4577, which impacts PHP-CGI servers. By using specially crafted query strings with the Unicode character "Soft Hyphen" (U+00AD), attackers can bypass security checks and inject malicious arguments, leading to remote code execution (RCE). Another vulnerability, CVE-2024-49026, affects Microsoft Excel, where attackers exploit the “Open-With” functionality, renaming files with fullwidth Unicode characters to bypass argument parsing controls and perform NTLM Relay-based RCE. Exploits rely on manipulating Windows' charset conversion in various ways. Characters like Yen (¥) and Won (?) are converted into backslashes, enabling directory traversal and unintended file access. Attackers can also inject additional arguments by using fullwidth characters, causing command-line processes to execute arbitrary commands like calc.exe. These vulnerabilities can also be leveraged through environment variables, bypassing character restrictions in query strings or HTTP headers to perform local file inclusion (LFI) or other attacks. While some vendors have responded with patches, Microsoft has acknowledged certain vulnerabilities but has not addressed the broader risks tied to legacy Windows encoding features. Developers are advised to prefer Unicode APIs, sanitize user inputs, and avoid relying on legacy code pages to reduce exposure to these vulnerabilities and strengthen overall security.