Skip to content
AdminKit

NetBIOS Name Service (NBNS)

What is NetBIOS Name Service (NBNS)?

NetBIOS Name Service (NBNS) is the part of NetBIOS over TCP/IP, defined in RFC 1001 and RFC 1002, that maps flat Windows computer names to IPv4 addresses, using UDP port 137 and local broadcasts or a WINS server. AdminKit explains how NBNS works and why its broadcast lookups invite name poisoning.

By AdminKit team, Netbase JSC · Updated

The NetBIOS Name Service is the name lookup system of old-style Windows networking. Before Windows 2000 could use DNS for the job, a Windows PC found the file server FILESRV01 by asking the local network, not a DNS server, who owned that name. RFC 1001 and RFC 1002, both from March 1987, define how the NetBIOS services run over TCP and UDP, and the Wireshark wiki on NBNS explains that it “serves much the same purpose as DNS does: translate human-readable names to IP addresses”.

How does NetBIOS Name Service work?

NetBIOS over TCP/IP (NBT) provides three services, which the IANA port registry lists as:

netbios-ns    137   NETBIOS Name Service
netbios-dgm   138   NETBIOS Datagram Service
netbios-ssn   139   NETBIOS Session Service

The name service normally runs over UDP 137. A host either broadcasts a name query to its whole subnet and waits for the owner to answer, or sends it unicast to a name server. On Windows that name server is WINS, which uses the same protocol. The Wireshark wiki points out the limits: NetBIOS names live in a flat namespace rather than DNS’s hierarchy, and NBNS can only return IPv4 addresses.

Non-Windows systems take part too. Samba’s nmbd is “a server that understands and can reply to NetBIOS over IP name service requests”, and replies to broadcast queries for its own name so Windows clients can find a Samba file server.

Why is NBNS a name poisoning target?

A broadcast question can be answered by any machine that hears it, and the requester has no way to verify the answer. MITRE ATT&CK technique T1557.001 documents adversaries responding to NBT-NS (UDP 137) and LLMNR (UDP 5355) traffic as if they owned the requested name, so that the victim connects to them and, when authentication is required, sends its username and NTLMv2 hash. The hash can then be cracked or relayed to a real SMB server. Microsoft’s MS16-077 bulletin patched a NetBIOS spoofing flaw, CVE-2016-3299, and an attack in which a machine on the network answers NetBIOS requests for the WPAD proxy-discovery name.

Common mitigations:

  • Disable NetBIOS over TCP/IP (and LLMNR) by local security settings or group policy where nothing needs it.
  • Block UDP 137-138 and TCP 139 at the network perimeter so NetBIOS never reaches the internet.
  • Enable SMB signing to stop NTLMv2 relay to SMB servers.

AdminKit’s port check does not test port 137 or any UDP port; it probes a fixed list of nine TCP ports on your own public IP. AdminKit’s guide on whether port 445 (SMB) is exposed covers how SMB and the NetBIOS ports 137-139 travel together through router rules.

AdminKit groups NetBIOS Name Service under its DNS cluster — browse the AdminKit glossary index for other related terms.

Frequently asked questions

Which ports does NetBIOS over TCP/IP use?

IANA's registry lists 137 for the NetBIOS Name Service, 138 for the Datagram Service and 139 for the Session Service. The Wireshark wiki notes that the name service normally runs over UDP 137, with TCP 137 defined but rarely if ever used.

What is the difference between NBNS and WINS?

WINS (Windows Internet Name Service) is Microsoft's NBNS server. It uses the same protocol, but clients send unicast queries to the WINS server instead of broadcasting them to the whole subnet.

Why is NetBIOS Name Service a security risk?

A broadcast query can be answered by any host on the subnet. MITRE ATT&CK describes attackers answering NBT-NS on UDP 137, as well as LLMNR, so victims connect to them and send a username and NTLMv2 hash that can be cracked or relayed.

Do modern Windows networks still need NBNS?

Usually not. The Wireshark wiki notes that Windows 2000 and later can use DNS for everything NBNS was used for, though NBNS remains in use where older systems or configurations depend on it. MITRE ATT&CK recommends disabling it where it is not needed.