Since 2003 a large part of my workday has been devoted solely to hacking systems. Over this time I've collected a number of penetration testing tips and plan to write a number of posts to share them. This time I will talk briefly about the annoying NT_STATUS_INVALID_WORKSTATION error that a co-worker noticed during a penetration test. I have seen it occur when you have a valid credential but your access is not allowed--very frustrating for a penetration tester.
Let's say you are doing an internal penetration test and you collect password hashes while spoofing ARP, NetBIOS, LLMNR, ICMP redirect or whatever. You obtained the plain-text password via dictionary attack, brute-forcing, downgrading protocols or forcing clear-text authentication. Then you tried to connect to the target system and received the infamous "NT_STATUS_INVALID_WORKSTATION" error.
root@WS:~/SpiderLabs# smbclient -L -W DCSPL -U RSmith //10.10.5.15Password: **********Connection to \\10.10.5.15\C$ failed - NT_STATUS_INVALID_WORKSTATION
root@WS:~/SpiderLabs# nmap -sC -sV 10.10.5.15 -p 445Starting Nmap 6.25 ( http://nmap.org ) at 2014-03-15 16:14 CDTStats: 0:00:06 elapsed; 0 hosts completed (1 up), 1 undergoing Service ScanService scan Timing: About 0.00% doneNmap scan report for SRVTEST02.spl.com (10.10.5.15)Host is up (0.00066s latency).PORT STATE SERVICE VERSION445/tcp open microsoft-ds?MAC Address: 00:21:5A:86:B3:C4 (Hewlett-Packard Company)Host script results:|_nbstat: NetBIOS name: Dragon, NetBIOS user: <unknown>, NetBIOS MAC: 00:21:5A:86:B3:C4 (Hewlett-Packard Company)Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 11.73 seconds
Now, let's try connecting again using the NetBIOS name "Dragon."
root@WS:~/SpiderLabs# smbclient -L -n Dragon -W DCSPL -U RSmith //10.10.5.15Password: **********Domain=[DCSPL] OS=[Windows 7 Enterprise 7601 Service Pack 1] Server=[Windows 7 Enterprise 6.1]
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
C$ Disk Default share
D$ Disk Default share
IPC$ IPC Remote IPC
At this point, you can access any share or anything you want. Sometimes the NetBIOS name that you obtain from the source connection is not on the list, in that case there are other options such as Exchange CAS, etc. However, what I do in general is port-scan all systems on the internal network for port 445 and extract the NetBIOS name of each computer found. With that information I build a simple script that attempts to connect replacing the NetBIOS name passed to smbclient tool with the names obtained during the port-scanning phase. It has proven to be fast and effective.
If you are interested in more hacking tricks, check other posts:
Stay tuned for more Wendel's Small Hacking Tricks.