Executing the commands below will initiate a server where the payload will be hosted.
Metasploit Framework has support for this technique via the web delivery module. A very popular technique utilizes the regsvr32 windows binary in order to execute a scriptlet from a remote location. Notepad++ – Code Executionįile-less payloads could be also executed in order to establish a communication channel. The next time that Notepad++ is launched and a character is typed the message box will appear which indicates that the code has been executed successfully.
dir "C:\Program Files\Notepad++\plugins\pentestlab" Notepad++ – Plugin Location This technique can be utilized under the context of an elevated user such as the administrator since write permissions are required to drop the plugin into the relevant sub-folder of “ Program Files“. MessageBox.Show("Persistence via Notepad++ - Visit ") Ĭompiling the code will generate the DLL file. If ( = (uint)SciMsg.SCI_ADDTEXT & ExecuteOnce) Public static void OnNotification(ScNotification notification) In the following example a message box will appear during insertion of a character. The SCI_ADDTEXT API will trigger a custom command when a character is typed inside notepad++. There are various API’s that could be used to execute something arbitrary when a specific event occurs. For red team operators there is no need to write a malicious plugin from scratch since the Notepad++ Plugin Pack can be used as a template. It should be noted that in order for a plugin to be loaded the folder and the DLL need have identical names.
A plugin has the form a DLL file and is stored in the following path: %PROGRAMFILES%\Notepad++\plugins By default there is a list of approved plugins which a user can download inside Notepad++ but custom plugins are allowed also without any validation giving flexibility to developers to extend the usage of the text editor. Plugins can be used to extend the capability of Notepad++. Except of the storage of scripts and administrator commands which can provide important information for a red team operator, it could be leveraged as a persistence mechanism by loading an arbitrary plugin that will execute a command or a script from a remote location.ĭaniel Duggan brought the idea of persistence via Notepad++ plugins to light in an article which highlights the technique. It is not uncommon a windows environment especially dedicated servers which are managed by developers or IT staff to have installed the Notepad++ text editor.