Netstart is a ‘vulnhub’ Linux machine running a wine program vulnerable to Buffer Overflow, escalating privileges through user’s sudo permissions to root. Let’s get right to it.
First and foremost we start with the nmap scan:
Press enter or click to view image in full size

Looks like ‘ftp’ has anonymous login enabled. Let’s go and take a look:
Press enter or click to view image in full size

I’ve seen 2 files in the ftp directory, login.exe and login_support.dll, I downloaded them to my machine so I can examine and debug the program.
I now nc to port 2371
Press enter or click to view image in full size

Seems like we’ve got an input option. At this point I’m thinking BoF could be an option on this box.
Sending the downloaded files into CommandoVM to debug the program with Immunity Debugger, I setup an smbserver on my Kali and accessed it from Windows CommandoVM.
Press enter or click to view image in full size


Press enter or click to view image in full size

Press enter or click to view image in full size

Launched Immunity Debugger and opened login.exe. It required login_support.dll because.. you’ll see. (;
Press enter or click to view image in full size

Press enter or click to view image in full size

I tried to connect to the CommandoVM on port 2371 and it successfully connected and requested the exact same thing as the target on port 2371. If this is vulnerable to BoF we can exploit the target machine!
Press enter or click to view image in full size

Now I’ve ran python scripts against the program located at CommandoVM on port 2371, every script will be documented here.

Press enter or click to view image in full size

We can see it crashed at 1900 bytes. Let’s generate a pattern using msf-pattern_create.
Press enter or click to view image in full size

We run the next script against the program:
Press enter or click to view image in full size

Press enter or click to view image in full size

We now see if we can find an offset using the EIP address.
Press enter or click to view image in full size

We found an exact match at 1702. We set our offset to 1702 in the next scripts!
Get mansk1es’s stories in your inbox
Join Medium for free to get updates from this writer.
We run the next script against the program to see if we can control the EIP to be 4 Bs.

We can control the EIP! We overwritten the EIP with 4 Bs.
Press enter or click to view image in full size

Now we need to find bad characters. We run the following script:
Press enter or click to view image in full size

I’ve removed \x00 (null byte) from the bytearray because it is an already known bad character.
Press enter or click to view image in full size

Hmm, doesn’t seem like we have bad characters except for the null byte.
Now we use mona to identify vulnerable modules that has the least security.
Press enter or click to view image in full size

Remember login_support.dll? We can see login_support.dll has no security at all! Let’s try to find a JMP ESP address using the module, with ‘mona’ again.
Press enter or click to view image in full size

Great, we found 2 addresses, I’m going to use the address 0x625012b8 on my next scripts.

625012b8 is indeed JMP ESP. Now the next script is going to verify the address, I’m going to set a breakpoint at this address.
Press enter or click to view image in full size

Now let’s check Immunity Debugger:

Great. The EIP is our target.
Now I’m going to generate a shellcode with msfvenom. I’ve added x0a and x0d as bad characters, because they are commonly bad characters as well.
Press enter or click to view image in full size

Putting the generated shellcode on our attacking script:

Now we set up a nc listener listening to port 51337.
Press enter or click to view image in full size

We got a reverse shell!
Press enter or click to view image in full size

Use ‘fox’ can execute /usr/bin/systemctl as root. GTFObins have a page showing how to use that method.
Press enter or click to view image in full size

Let’s try this:
Press enter or click to view image in full size

Now we type !sh in this ‘less’ pager.

We got root! Fun box — this machine is a great BoF practice.
