CVE-2023-40164 in Notepad++info

Summary

by MITRE • 08/26/2023

Notepad++ is a free and open-source source code editor. Versions 8.5.6 and prior are vulnerable to global buffer read overflow in `nsCodingStateMachine::NextStater`. The exploitability of this issue is not clear. Potentially, it may be used to leak internal memory allocation information. As of time of publication, no known patches are available in existing versions of Notepad++.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 02/03/2026

The vulnerability identified as CVE-2023-40164 affects Notepad++ versions 8.5.6 and earlier, representing a critical buffer overflow condition within the application's text encoding handling mechanism. This flaw exists in the `nsCodingStateMachine::NextStater` function which processes character encoding detection for text files, making it a target for exploitation during normal text processing operations. The issue manifests as a global buffer read overflow, indicating that the application fails to properly validate input boundaries when processing encoded text data, potentially allowing attackers to read beyond allocated memory regions.

The technical implementation of this vulnerability stems from inadequate bounds checking within the encoding state machine that Notepad++ employs to determine text file encodings. When processing files with specific encoding patterns, the `nsCodingStateMachine::NextStater` function does not properly validate array access limits, leading to memory read operations that extend beyond the intended buffer boundaries. This condition creates a potential information disclosure vector where attackers could potentially read adjacent memory contents, including sensitive data such as stack canaries, heap metadata, or other internal application structures. The vulnerability's classification under CWE-125 indicates it involves reading data past the end of a buffer, while its potential for information leakage aligns with ATT&CK technique T1005 for data hijacking.

The operational impact of this vulnerability extends beyond simple information disclosure, as the memory leak could provide attackers with insights into the application's internal memory layout and heap organization. This information could subsequently be leveraged for more sophisticated attacks including heap spraying techniques or bypassing security mechanisms such as address space layout randomization. The lack of available patches at the time of publication creates a significant risk for organizations still using affected versions, particularly in environments where Notepad++ is used to process untrusted text files or documents. Attackers could potentially exploit this vulnerability by crafting specially formatted text files that trigger the overflow condition during normal file opening operations, making the attack surface particularly broad given Notepad++'s widespread usage across various computing environments.

Mitigation strategies for this vulnerability should prioritize immediate version updates to Notepad++ 8.5.7 or later, which contain the necessary fixes for the buffer overflow condition. Organizations should also implement defensive measures such as restricting file type processing for untrusted content and monitoring for unusual memory access patterns during text processing operations. Additionally, users should be advised to avoid opening untrusted text files with Notepad++ until the vulnerability is fully addressed, as the exploitability remains unclear but the potential for remote code execution cannot be entirely ruled out given the memory read overflow nature of the flaw. System administrators should consider implementing application whitelisting policies that restrict the execution of vulnerable Notepad++ versions in enterprise environments.

Responsible

GitHub, Inc.

Reservation

08/09/2023

Disclosure

08/26/2023

Moderation

accepted

CPE

ready

EPSS

0.00549

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!