CVE-2026-52885: Notepad++ Time-of-Check-Time-of-Use (TOCTOU) Vulnerability in Command Execution
Notepad++ versions before 8.9.6.4 contain a time-of-check-time-of-use (TOCTOU) vulnerability in how it validates user-defined commands. The application verifies the integrity of the shortcuts.xml configuration file at the moment a command executes, but it uses the command payload that was loaded into memory when the application started. An attacker with local write access to the shortcuts.xml file can exploit this gap by placing a malicious command definition before Notepad++ launches, then replacing the file with a legitimate version before any command runs. The integrity check passes because it validates the now-clean file, but the malicious command from memory executes anyway. This requires local file system access and user interaction to trigger a command, limiting but not eliminating the practical risk.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 6.3 MEDIUM · CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
- Weaknesses (CWE)
- CWE-367
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-26 / 2026-06-29
NVD description (verbatim)
Notepad++ is a free and open-source source code editor. Prior to 8.9.6.4, NppCommands.cpp checks the HMAC of the on-disk shortcuts.xml at the moment a user command fires (Time-of-Check). However, the command payload is taken from the in-memory _userCommands vector, which is populated at application startup and never re-synchronized with the on-disk file (Time-of-Use). Swapping shortcuts.xml between startup and command execution causes the HMAC check to validate a clean file while a malicious command runs. An attacker with write access to shortcuts.xml places a malicious version on disk before launch, then immediately restores the legitimate file. The HMAC check at execution time validates the restored legitimate file (check passes), while the malicious payload executes from memory. This vulnerability is fixed in 8.9.6.4.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability stems from a classic TOCTOU flaw in NppCommands.cpp. Notepad++ loads user commands from shortcuts.xml into the _userCommands in-memory vector during startup. Later, when a user executes a command, the application performs an HMAC integrity check on the current on-disk shortcuts.xml file (Time-of-Check). However, the actual command payload execution reads from the cached _userCommands vector, which was never re-synchronized with the disk file after startup (Time-of-Use). An attacker with local file write permissions can: (1) place a malicious shortcuts.xml before application startup; (2) wait for Notepad++ to load and cache the malicious payload in memory; (3) restore the legitimate shortcuts.xml to disk; (4) trigger command execution, causing the HMAC check to validate the now-legitimate file while the in-memory malicious payload executes. The CWE-367 classification (Time-of-check Time-of-use) directly reflects this architectural flaw. Versions 8.9.6.4 and later patch this by ensuring the command payload is re-validated or re-loaded at execution time, closing the window between check and use.
Business impact
This vulnerability enables local privilege escalation or arbitrary code execution for attackers who already possess write access to Notepad++ configuration files. In shared workstation environments or scenarios where user home directories are mounted on network shares with relaxed permissions, an attacker could inject malicious commands that execute with the privileges of whoever launches Notepad++. The attack requires local file access and user interaction (launching Notepad++ and triggering a command), making it primarily a risk in multi-user systems or environments where an attacker has achieved initial file system write access. For organizations using Notepad++ in development, security analysis, or administrative workflows, successful exploitation could lead to unintended code execution, data theft, or lateral movement. The impact is contained to the local system and the user's privilege level.
Affected systems
Notepad++ versions prior to 8.9.6.4 are affected. The vulnerability is specific to Notepad++ (notepad++) and does not impact other text editors or Notepad (the Windows built-in editor). Organizations should inventory Notepad++ deployments, particularly on shared workstations, developer machines, and systems used by privileged users. The vulnerability does not affect Notepad++ instances where the shortcuts.xml file resides on read-only file systems or where file system permissions prevent unauthorized modification by other local users.
Exploitability
Practical exploitation requires multiple conditions: the attacker must have local write access to the target user's Notepad++ configuration directory (typically ~/.config/notepad++/ on Linux or %AppData%\Notepad++\ on Windows); the attacker must be able to swap the shortcuts.xml file between startup and command execution, implying either code execution, scheduled access, or a race condition; and the target user must execute a user-defined command after application launch. The CVSS vector (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H) reflects that this is a local attack with high complexity, requiring low privileges but not user interaction at exploitation time (though user interaction is required to trigger the vulnerable command). The lack of public exploit code and KEV status designation indicate this remains a theoretical but credible threat rather than an actively weaponized vulnerability in the wild.
Remediation
Upgrade Notepad++ to version 8.9.6.4 or later. Users should verify their current version via Help > About Notepad++. Administrators can automate Notepad++ updates through standard patch management channels if deployment is managed organizationally. For users unable to update immediately, mitigations include: restricting file system permissions on the Notepad++ configuration directory to prevent other local users from modifying shortcuts.xml; disabling user-defined commands if not required; and monitoring the shortcuts.xml file for unauthorized changes. However, these mitigations do not eliminate the underlying flaw and should be treated as temporary measures only.
Patch guidance
Verify the installed version of Notepad++ and confirm it is 8.9.6.4 or later. The patch is available through the official Notepad++ GitHub releases page and is also distributed via the Windows installer and portable editions. Organizations should test the update in a development environment first to ensure compatibility with any custom user command sets before broad deployment. The patch maintains backward compatibility and does not require migration of existing shortcuts.xml files.
Detection guidance
Monitor for suspicious modifications to Notepad++ configuration files, particularly shortcuts.xml, especially if modifications occur shortly before or after Notepad++ process execution. Endpoint detection and response (EDR) solutions should flag rapid file write-and-restore patterns on configuration files as potential TOCTOU exploitation attempts. Process execution monitoring can help identify if Notepad++ launches unexpected child processes or performs unexpected network activity following command execution. Log file integrity monitoring on shortcuts.xml can detect unauthorized edits, though the attacker's temporary restoration may evade some tools. Behavioral detection of commands executing with unexpected privilege levels or from unexpected locations is also valuable.
Why prioritize this
Although the CVSS score is 6.3 (MEDIUM), this vulnerability merits prompt prioritization in environments with shared workstations or elevated-privilege Notepad++ users. The integrity bypass is subtle but reliable once conditions are met, and the patch is simple to deploy with no known side effects. Prioritize systems where Notepad++ is used by developers, security analysts, or system administrators, and systems where file permissions may permit lateral write access to user directories. KEV non-designation suggests active exploitation is not yet widespread, providing a narrow window for patching before attackers discover this vector.
Risk score, explained
The CVSS 3.1 score of 6.3 (MEDIUM) reflects the combination of local-only attack surface (AV:L), high attack complexity (AC:H), low privilege requirement (PR:L), no integrity impact on the system itself (I:H only on user intent/data), high availability impact through process termination (A:H), and the fact that successful exploitation requires the attacker to already possess local file write access and timing precision. The score appropriately discounts scenarios where multi-user environments are the exception and acknowledges that the attack is feasible but non-trivial. Organizations with elevated Notepad++ users or shared development systems may reasonably rate this higher internally than the base CVSS score suggests.
Frequently asked questions
Does this vulnerability affect Notepad (the Windows built-in editor)?
No. This vulnerability is specific to Notepad++, the open-source community editor. Windows Notepad and other text editors are not affected.
Can this vulnerability be exploited remotely?
No. The attack vector is local-only (AV:L). An attacker must have write access to the file system where Notepad++ configuration resides. Remote exploitation is not possible.
What if I use Notepad++ but have not defined any custom user commands?
The vulnerability applies to the user command execution mechanism. If you do not use user-defined commands in shortcuts.xml, the attack surface is reduced, though the flaw remains present. Updating to 8.9.6.4 is still recommended as a general security best practice.
Do I need to migrate my shortcuts.xml after upgrading?
No. The patch is backward compatible. Your existing shortcuts.xml will work unchanged with version 8.9.6.4 and later.
This analysis is provided for informational purposes and reflects publicly available information as of the publication date. Users should verify all patch version numbers and compatibility details against the official Notepad++ GitHub repository and vendor advisories before deploying updates. The vulnerability does not appear on the CISA KEV catalog as of this writing and is not known to be actively exploited in the wild, but organizations should treat this as subject to change. No exploit code or weaponized proof-of-concept is provided or endorsed by this analysis. Security teams should conduct their own risk assessment based on their specific environment, deployment patterns, and threat model. Source: NVD (public-domain), retrieved 2026-08-05. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2025-59610MEDIUMQualcomm Memory Corruption via IOCTL API Version Mismatch – Patch Guidance
- CVE-2026-13502MEDIUMANTLR4 Maven Plugin TOCTOU Vulnerability Guide
- CVE-2026-14160MEDIUMTOCTOU Race Condition in Samsung Escargot JavaScript Engine
- CVE-2026-20454MEDIUMMediaTek geniezone Race Condition Privilege Escalation (CVSS 6.4)
- CVE-2026-41568MEDIUMDocker & Moby Race Condition in docker cp Mount Setup
- CVE-2026-45619MEDIUMWWBN AVideo DNS-Rebinding SSRF Vulnerability
- CVE-2026-45647MEDIUMMicrosoft Defender for Endpoint Privilege Escalation Race Condition
- CVE-2026-46159MEDIUMLinux btrfs TOCTOU Race Condition Information Disclosure