Notepad++ release 8.9.6.1
-
The configuration files (config.xml, shortcuts.xml & others) could reside on any location with cloud option or by “-settingsDir=” command argument…
So are you trying to fix a situation when a user (inadvertently) set for these N++ xml files a location, where also everyone else (instead of him or admins) has the write permission?
-
@Coises said:
Does this vulnerability mean that a user, by manipulating the shortcuts file (and responding OK to the prompt in 8.9.6.1), would be able to execute an arbitrary program from an arbitrary directory (as it would be executing under the control of Notepad++, which has already been whitelisted)?No. If an app is not on a whitelist (realized e.g. by Windows App Control for Business), it should not be executed (even from a whitelisted app).
Or would there still be a UAC prompt that the user could not satisfy?
This is other thing. UAC gets in the way whenever an action is required to be performed with higher than the current privileges. So if an attacker creates e.g. that config.xml “commandLineInterpreter” redirection to his “mycmd.exe”, UAC shows up e.g. if that mycmd.exe has a manifest within with higher execution level requested.
Thank you for the clarification.
If someone can do arbitrary writes to my Windows user profile (or persuades me to do it for him via that mentioned social engineering), then such an attacker can easily do also other mischievous things, e.g. redirecting my user environment variables like %PATH%, where I can have paths to executables…
That’s kind of why I wondered if the vulnerability was about a form of privilege escalation. If not…
You know, if someone gains write access to my desktop, they could replace my shortcut to Notepad++ with one that has the same name and icon but actually starts a malicious program. Shortcuts are a security risk! (/sarcasm… just in case)
-
-
I will see if I can treat only “-settingsDir=” & cloud option, and keep %appdata% case as before (without confirmation).
-
Then it seems like a “simple” implementation would be to let an empty supressRunAlertDialog.xml file work as @donho suggested, which would make it easy to create the installer checkbox he mentioned to restore old behavior.
I am leaning towards agreeing. I like the idea of granular control from my suggestion, because some user/admin might want it, I don’t know how important it would be. OTOH, making it easy for the installer checkbox, and thus easy for users to opt out of this fix, is definitely important.
.I like the idea of having a filled
supressRunAlertDialog.xml, even if it may be a bit more difficult to implement, but on the other side:
There would be no need to add an option to the installer if the file should be installed or not. Just install/ship a prefilled file but with no added path by default and a user with admin rights can add the needed path. Or the file can be prefilled with all the program files path by default, so you don’t have to hard code them in source code. This way, admin in company environment would even be able to remove those paths at all if needed. -
-
I implemented another solution that removes the annoying requirement of adding authorized directories.
This solution was suggested by the security expert who reported CVE-2026-48800.The idea is as follows:
We use the user’s machine GUID to generate a HMAC of shortcuts.xml, and store this value in config.xml. Each time a customized command is launched, Notepad++ recalculates the HMAC of the current shortcuts.xml content on HD, and compare it with the stored value.If the HMAC in config.xml is missing or does not match, the shortcuts.xml file will be opened for review and a warning dialog is displayed, and the user must validate (and possibly modify) the file. Otherwise no command will not be executed.
The PR is ready for review now:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/18079Please let me know your thoughts on this alternative enhancement.
-
The PR is ready for review now:
https://github.com/notepad-plus-plus/notepad-plus-plus/pull/18079Please let me know your thoughts on this alternative enhancement.
This is classic security through obscurity (read - “no security at all”) or if you prefer a CWE-656. Or maybe I should rather use here “security through well-known obscurity”, because N++ is opensource, so anyone can easily do what I did below, STR:
- add a new shortcut to N++ shortcuts.xml via N++ menu > Run > Run…, enter there
C:\Windows\System32\charmap.exe, click on Save…, enter a name for it, e.g. CharacterMap (you can also set a key-shortcut if you like, e.g. Ctrl+Alt+M seems to be free) - the above will create new record in the N++ shortcuts.xml file (in my case:
<Command Key="77" Shift="no" Alt="yes" Ctrl="yes" name="CharacterMap">C:\Windows\System32\charmap.exe</Command>) - try it (e.g. via that Ctrl+Alt+M), the Windows CharMap should launch
- close N++
- go to where your N++ shortcuts.xml is and do the “evil” in question - e.g. modify the relevant line to
<Command Key="77" Shift="no" Alt="yes" Ctrl="yes" name="CharacterMap">C:\Windows\System32\cmd.exe</Command> - relaunch N++, press again that Ctrl+Alt+M, you should see the new warning:

and the shortcuts.xml will be opened for you to review (DO NOT VALIDATE IT now, remember - we want to play here as the “attackers” do…) - instead of validating via the N++ menu > Run > Validate shortcuts.xml, just close the N++ app for now
In the next steps we manually mimic (as a potential attacker also can) what the N++ app validation does:
- in the dir with your current N++ shortcuts.xml, create and launch this batch:
@echo off setlocal enabledelayedexpansion set "FILE_PATH=shortcuts.xml" if not exist "%FILE_PATH%" ( echo Error: Notepad++ file not found - "%FILE_PATH%" pause exit /b 1 ) echo. echo Processing file: %FILE_PATH% echo. powershell -NoProfile -Command "$guid = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Cryptography').MachineGuid; $guid | Out-File 'MachineGuid-key.tmp' -Encoding ascii -NoNewline; $hmac = New-Object System.Security.Cryptography.HMACSHA256; $hmac.Key = [System.Text.Encoding]::UTF8.GetBytes($guid); $hash = [System.BitConverter]::ToString($hmac.ComputeHash([System.IO.File]::ReadAllBytes('%FILE_PATH:\=\\%'))).Replace('-','').ToLower(); $hash | Out-File 'HMAC.txt' -Encoding ascii -NoNewline;" set /p SECRET_KEY=<MachineGuid-key.tmp set /p HMAC_RESULT=<HMAC.txt del MachineGuid-key.tmp echo Secret-Key (MachineGuid): %SECRET_KEY% echo HMAC-SHA256 Signature: %HMAC_RESULT% echo. echo HMAC saved to: %cd%\HMAC.txt echo. endlocal pause- open the generated HMAC.txt file (e.g. in Windows Notepad app)
- open there also your current N++ config.xml file, edit the relevant line, mine was:
<GUIConfig name="shortcutsXmlHMAC" value="5b3ed06c526a812cc93e147d5243adb0eded6b7529a59883977f480985bc360e" />, use your HMAC from the manually generated HMAC.txt file - save N++ config.xml file
- relaunch N++, try Ctrl+Alt+M again (now no warning - an attacker silently fooled us to run whatever he wants, here only the cmd.exe instead of charmap.exe)
I’ll repeat myself here - the fixed CVE is not a security vulnerability! @coises has above another great example - modify in the same way e.g. the N++ shortcut on the Desktop (and be surprised that instead of notepad++.exe, you will launch whatever else…)
N++ is a powerful tool, like a sharp knife. And like with the sharp knife, users can “cut themselves” if not handled properly (allowing anyone else than me or admins to write to my N++ config.xml & shortcuts.xml…).
- add a new shortcut to N++ shortcuts.xml via N++ menu > Run > Run…, enter there
-
@donho I unchecked the plugins item (i.e. all of them); the installation completed then.
-
@fml2
Did you check if NppExport.dll is read-only in your system? -
@donho you forgot to update/upload this new minor version to winget microsoft repository?
Until now I only can find 8.9.6.
Thank you so much.
-
The HMAC is only meant to protect against the
-settingsDir=&settings on Cloud optionvectors where the attacker prepares a malicious directory on a different machine — a USB drive, a downloaded archive, a network share. In that case they genuinely don’t know the victim’s MachineGUID and cannot forge the HMAC.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login