Skip to main content

NetBIOS Protocol

Impacket’s NetBIOS implementation provides support for NetBIOS Name Service (NBNS) and NetBIOS Session Service (NBSS), essential for legacy Windows networking and SMB1 connections.

Overview

The NetBIOS implementation is located in impacket/nmb.py and includes:
  • Name resolution - NetBIOS name queries and registration
  • Session management - NetBIOS session establishment
  • Name encoding - First and second level encoding (RFC 1001/1002)
  • Network scanning - Enumerate NetBIOS names and services

NetBIOS vs. DNS

NetBIOS predates DNS for Windows networking. While modern networks use DNS, NetBIOS is still used for SMB1 connections over port 139 and network browsing.

Ports and Services

From nmb.py:67-73:

Name Resolution

Query NetBIOS Name

Query Multiple Names

Name Types

NetBIOS names have different suffixes indicating service types (from nmb.py:84-93):

Name Encoding

NetBIOS names use special encoding defined in RFC 1001/1002.

Encode NetBIOS Name

From nmb.py:166-198:

Decode NetBIOS Name

NetBIOS Session Service

Establish NetBIOS Session

Session Message Types

From nmb.py:156-161:

NetBIOS Name Service Queries

Node Status Query

Broadcast Name Query

Network Scanning

NetBIOS Scanner

Error Handling

NetBIOS operations can timeout or fail. Always implement proper error handling for network operations.

Error Codes

From nmb.py:240-255:

SMB over NetBIOS

SMB Connection via Port 139

SMB Direct (Port 445) vs NetBIOS

Complete Example: NetBIOS Enumerator

Legacy Considerations

NetBIOS is a legacy protocol. Modern Windows networks use DNS for name resolution. NetBIOS should only be enabled when required for legacy compatibility.

Port 445 vs Port 139

  • Port 139: SMB over NetBIOS - Requires NetBIOS session setup
  • Port 445: Direct SMB - No NetBIOS required (modern)

References

  • Source: impacket/nmb.py
  • RFC 1001: NetBIOS Service Protocols
  • RFC 1002: NetBIOS on TCP/IP
  • [MS-NBTE]: NetBIOS over TCP