Connect with our team of offensive security, AI security and pen testing experts at Black Hat Europe 2023. Learn More

Connect with our team of offensive security, AI security and pen testing experts at Black Hat Europe 2023. Learn More

Managed Detection & Response

Eradicate cyberthreats with world-class intel and expertise

Managed Security Services

Expand your team’s capabilities and strengthen your security posture

Consulting & Professional Services

Tap into our global team of tenured cybersecurity specialists

Penetration Testing

Subscription- or project-based testing, delivered by global experts

Database Security

Get ahead of database risk, protect data and exceed compliance requirements

Email Security & Management

Catch email threats others miss with layered security & maximum control

Co-Managed SOC (SIEM)

Eliminate alert fatigue, focus your SecOps team, stop threats fast, and reduce cyber risk

Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
The Trustwave Approach
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Platform
SpiderLabs Fusion Center
Security Operations Centers
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

Wendel's Small Hacking Tricks - The Annoying NT_STATUS_INVALID_WORKSTATION.

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 //
Password: **********
Connection to \\\C$ failed - NT_STATUS_INVALID_WORKSTATION
At this point the authentication was valid (correct username / password), but failed to establish a connection to this host because of NT_STATUS_INVALID_WORKSTATION.
This occurs due to a computer restriction set on the Active Directory User Account Object.
As you see above, there is a restriction on the names that are allowed to log with this credential. My experience shows that the most common allowed workstation name is the one from where you collected the credential. For example, if you obtained the credential during a spoofing attack just check the source of the authentication, obtain the NetBIOS name and try use it.
To obtain the NetBIOS name you could use Nmap as seen below:
root@WS:~/SpiderLabs# nmap -sC -sV -p 445
Starting Nmap 6.25 ( ) at 2014-03-15 16:14 CDT
Stats: 0:00:06 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan
Service scan Timing: About 0.00% done
Nmap scan report for (
Host is up (0.00066s latency).
445/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 .
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 //
Password: **********
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


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.

Latest SpiderLabs Blogs

The 2023 Retail Services Sector Threat Landscape: A Trustwave Threat Intelligence Briefing

The annual holiday shopping season is poised for a surge in spending, a fact well-known to retailers, consumers, and cybercriminals alike. The latter group, however, is poised to exploit any...

Read More

Pwning Electroencephalogram (EEG) Medical Devices by Default

Overall Analysis of Vulnerability Identification – Default Credentials Leading to Remote Code Execution During internal network testing, a document was discovered titled the “XL Security Site...

Read More

Hidden Data Exfiltration Using Time, Literally

I was looking at my watch last week and my attention was moved towards the seconds over at the right of the watch face, incrementing nicely along as you’d expect. Now, I don’t know if I’d just spent...

Read More