CyberHunter
// Network services

Port 138: NETBIOS Datagram Service

Port 138 is assigned by IANA to netbios-dgm (NETBIOS Datagram Service).

138

How netbios-dgm works

Network services
client:138netbios-dgmresponse client:138netbios-dgmresponse

The client sends a request to port 138 and the netbios-dgm service answers.

Transport
TCP · UDP
Exposure risk
not rated depends on the program listening
Encryption
Unknownnot stated by the registry
IANA status
Assigned1 registered service
Range
Well-known (0-1023)
01 Security

Is port 138 dangerous?

We have no specific security note for port 138. Its risk depends on the program actually listening on it. General advice for network services services:

  • Answer only the networks that need the service (no open resolvers, relays or reflectors).
  • UDP services can be abused for DDoS amplification: rate-limit or block them at the edge.
  • Disable legacy test services that have no use in production.
02 Registry

IANA registry entries for port 138

ServicePortTransportDescriptionReferenceUpdated
netbios-dgm 138 TCP, UDP NETBIOS Datagram Service - -

// source: IANA service name and port number registry

03 Check it

Which program uses port 138, and is it reachable?

Linux

sudo ss -ltnup 'sport = :138'      # process listening on 138
sudo lsof -nP -i :138

macOS

sudo lsof -nP -i :138

Windows (PowerShell)

Get-NetTCPConnection -LocalPort 138 -State Listen | Select LocalAddress, OwningProcess
Get-NetUDPEndpoint -LocalPort 138
netstat -ano | findstr :138

From another machine

nmap -p 138 -sV <host>
sudo nmap -sU -p 138 <host>
nc -zv <host> 138

Block it in the firewall

sudo ufw deny 138/tcp                                         # Linux (ufw)
New-NetFirewallRule -DisplayName "Block 138" -Direction Inbound -LocalPort 138 -Protocol TCP -Action Block  # Windows
04 FAQ
What is port 138 used for?

Port 138 is assigned by IANA to netbios-dgm (NETBIOS Datagram Service).

Is port 138 TCP or UDP?

Port 138 is registered for TCP and UDP.

Is it safe to open port 138?

It depends on the program that listens on it. Open it only for a service you know and only to the networks that need it. Answer only the networks that need the service (no open resolvers, relays or reflectors).

How do I check if port 138 is open?

On Linux run "ss -ltnup 'sport = :138'", on macOS "lsof -nP -i :138", and on Windows "netstat -ano | findstr :138" to see the local process. From another machine, "nmap -p 138 <host>" shows whether it is reachable.

05 Related