Netbios

NetBIOS, which stands for Network Basic Input/Output System, is a fundamental networking concept primarily addressed in the Enumeration phase of hacking. Attackers often focus on NetBIOS first because it allows the extraction of a large amount of sensitive information about the target network.

💡 Definition and Core Function

NetBIOS was initially designed as an API (Application Programming Interface) for client software to access Local Area Network (LAN) resources*. In Windows environments, NetBIOS is used specifically for file and printer sharing*.

🔌 NetBIOS Ports and Services

NetBIOS utilizes three primary ports via UDP and TCP protocols:

Port/Protocol Service Name Description
UDP 137 NETBIOS Name Service (NBNS) Used for name resolution services.
UDP 138 NETBIOS Datagram Service Used for connectionless communication.
TCP 139 NETBIOS Session Service Used for SMB over NetBIOS session establishment, file transfer, and file/printer sharing.
TCP/UDP 445 SMB over TCP (Direct Host) Used by later versions of Windows (after 2000) for directly hosted SMB traffic, bypassing the older NetBIOS over TCP (NBT) protocol.

The proper configuration of TCP port 139 is critical, and restricting access to this port should be a top priority for system administrators.

📝 NetBIOS Name Service (WINS)

The NetBIOS Name Service (NBNS) is also known as the Windows Internet Name Service (WINS). WINS maintains a database to match IP addresses with NetBIOS names and queries. Since attackers exploit this mapping process, the name service is often targeted first. Note that Microsoft does not support NetBIOS name resolution for IPv6.

🕵️ NetBIOS Enumeration and Information Gathered

NetBIOS enumeration involves creating active connections and sending directed queries to extract sensitive data. Attackers use NetBIOS enumeration to obtain:

  • The list of computers belonging to a domain.
  • The list of shares on individual hosts in the network.
  • Policies and passwords.
  • NetBIOS names, usernames, domain names, and MAC addresses.

The 16th character (NetBIOS code) is particularly revealing of the system's role:

NetBIOS Code Information Obtained
<00> Hostname or Domain name.
<03> Messenger service running for the computer or logged-in user.
<20> Server service running (File Service).
<1B> Domain master browser name (identifies the Primary Domain Controller or PDC).
<1E> Browser service elections.

🛠️ NetBIOS Enumeration Tools and Commands

Attackers use several methods and tools to perform NetBIOS enumeration:

🛑 Countermeasures

Because a network running SMB (which historically relied on NetBIOS) is highly vulnerable to enumeration, key countermeasures include: