CVE-2022-32168 (published 2022-09-28T09:15Z)

Notepad++ versions 8.4.1 and before are vulnerable to DLL hijacking where an attacker can replace the vulnerable dll (UxTheme.dll) with his own dll and run arbitrary code in the context of Notepad++.

CVSS v3 base score: 7.8, HIGH (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-427
cwe_name: Uncontrolled Search Path Element
description: The product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors.
extended_description: 
            Although this weakness can occur with any type of resource, it is frequently introduced when a product uses a directory search path to find executables or code libraries, but the path contains a directory that can be modified by an attacker, such as "/tmp" or the current working directory.
            In Windows-based systems, when the LoadLibrary or LoadLibraryEx function is called with a DLL name that does not contain a fully qualified path, the function follows a search order that includes two path elements that might be uncontrolled:
               
                  the directory from which the program has been loaded
                  the current working directory
               
            In some cases, the attack can be conducted remotely, such as when SMB or WebDAV network shares are used.
	    One or more locations in that path could include the Windows drive root or its subdirectories. This often exists in Linux-based code assuming the controlled nature of the root directory (/) or its subdirectories (/etc, etc), or a code that recursively accesses the parent directory.  In Windows, the drive root and some of its subdirectories have weak permissions by default, which makes them uncontrolled.
            In some Unix-based systems, a PATH might be created that contains an empty element, e.g. by splicing an empty variable into the PATH. This empty element can be interpreted as equivalent to the current working directory, which might be an untrusted search element.
            In software package management frameworks (e.g., npm, RubyGems, or PyPi), the framework may identify dependencies on third-party libraries or other packages, then consult a repository that contains the desired package. The framework may search a public repository before a private repository. This could be exploited by attackers by placing a malicious package in the public repository that has the same name as a package from the private repository. The search path might not be directly under control of the developer relying on the framework, but this search order effectively contains an untrusted element.
         
         

Fix information:
repo_url: https://github.com/notepad-plus-plus/notepad-plus-plus
commit_details: repo_url: https://github.com/notepad-plus-plus/notepad-plus-plus
author: SinghRajenM
author_date: 2022-09-07 09:53:15+05:30
msg: Fixes security vulnerability

Fix #12113, close #12114
repository: repo_url: https://github.com/notepad-plus-plus/notepad-plus-plus
repo_name: notepad-plus-plus/notepad-plus-plus
description: Notepad++ official repository
repo_language: C++
owner: notepad-plus-plus
file_changes: filename: MiniDumper.cpp
change_type: ModificationType.MODIFY
diff: @@ -34,7 +34,7 @@ bool MiniDumper::writeDump(EXCEPTION_POINTERS * pExceptionInfo)
 	LPCTSTR szResult = NULL;
 	bool retval = false;
 
-	HMODULE hDll = ::LoadLibrary( TEXT("DBGHELP.DLL") );	//that wont work on older windows version than XP, #care :)
+	HMODULE hDll = ::LoadLibraryEx(TEXT("DBGHELP.DLL"), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);	//that wont work on older windows version than XP, #care :)
 
 	if (hDll)
 	{

programming_language: C++
filename: Parameters.cpp
change_type: ModificationType.MODIFY
diff: @@ -1169,7 +1169,7 @@ bool NppParameters::load()
 	//---------------------------------------------//
 	// Dlg theme texture function for xp and vista //
 	//---------------------------------------------//
-	_hUXTheme = ::LoadLibrary(TEXT("uxtheme.dll"));
+	_hUXTheme = ::LoadLibraryEx(TEXT("uxtheme.dll"), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
 	if (_hUXTheme)
 		_enableThemeDialogTextureFuncAddr = (WNDPROC)::GetProcAddress(_hUXTheme, "EnableThemeDialogTexture");
 

programming_language: C++