Home

Awesome

RemoteWriteMonitor

RemoteWriteMonitor is a tool to help malware analysts tell that the sample is injecting code to another process. This tool is designed to find a possible remote code injection and execution without use of NtCreateThread/Ex(), APC or thread context manipulation.

A supporting tool 'TestInjector' is a sample program doing that type of code injection.

A related blog entry can be found here:

http://standa-note.blogspot.ca/2015/03/section-based-code-injection-and-its.html

Installation and Uninstallation

Get an archive file for compiled files form this link:

https://github.com/tandasat/RemoteWriteMonitor/releases/latest

Then use the 'sc' command. For installation:

>sc create rwmon type= kernel binPath= C:\Users\user\Desktop\RemoteWriteMonitor.sys
>sc start rwmon

For uninstallation:

>sc stop rwmon
>sc delete rwmon

On the x64 bit platform, you have to enable test signing to install the driver. To do that, open the command prompt with the administrator privilege and type the following command:

bcdedit /set {current} testsigning on

Then, reboot the system to activate the change. You also have to disable the Kernel Patch Protection (PatchGuard); DisPG may be use of.

Usage

Once you have installed it, you may execute the sample and see output from the driver if any.

The driver reports when any process newly created after the installation called NtWriteVirtualMemory() or NtMapViewOfSection() against another process and saves what was written or mapped into the remote process. Output can be seen with DebugView and are all saved under the C:\Windows\RemoteWriteMonitor\ directory. Written and mapped data is stored as <SHA1>.bin apart from a log file.

'TestInjector' could be used to test the driver's function. Injecting and executing code into notepad.exe can be done by the following commands:

>notepad && tasklist | findstr notepad
notepad.exe                   3368 Console                    1      4,564 K

>TestInjector 3368 section context
Remote Address   : 00180000
Waiting for the thread get executed.
Remote Thread ID : 1912

>TestInjector 3368 alloc context
Remote Address   : 001B0000
Remote Thread ID : 2156

Output on DebugView would look like this: DebugView

Note that the TestInjector only works against 32 bit processes.

Caveats

Supported Platform(s)

License

This software is released under the MIT License, see LICENSE.