Port 139 is the NetBIOS Session Service port used by SMBv1 for Windows file and printer sharing over NetBIOS. Exposing port 139 to the internet is extremely dangerous – it was the entry point for WannaCry, NotPetya, and EternalBlue exploits. Modern systems use SMB over port 445 directly without NetBIOS.
Port Number
139
Protocol
TCP
Service
NetBIOS Session Service
Range
IANA Well-Known (0–1023)
Check if target is vulnerable to EternalBlue (MS17-010)
nmap -p 139 --script smb-vuln-ms17-010 targetEnumerate users, shares, policies via NetBIOS null session
enum4linux -a targetList shares without credentials (null session test)
smbclient -L //target -NPowerShell: check if SMBv1 is enabled (should be False)
Get-SmbServerConfiguration | Select EnableSMB1Protocolnmap -p 139 target
smbclient -L //host -p 139
net use \\host\shareNetBIOS (Network Basic Input/Output System) was created by IBM in 1983 for LAN communication. Port 139 carries the Session Service – originally designed for small office LANs. Microsoft built SMBv1 file sharing on top of NetBIOS. Windows 2000 introduced 'direct hosting' (SMB over TCP/445, no NetBIOS needed). EternalBlue (leaked from NSA in 2017) exploited SMBv1 on port 139/445 causing billions in damage via WannaCry and NotPetya.
Port 139 vs port 445 – what is the difference?
Port 139: SMB over NetBIOS Session Service (legacy, requires NetBIOS name resolution on ports 137/138). Port 445: SMB directly over TCP (modern, no NetBIOS layer needed). Windows 2000+ supports both; Windows 10+ defaults to 445. Port 139 exists for backward compatibility with pre-Windows 2000 systems. If all your systems are Windows 2000+, you can disable NetBIOS entirely.
Is it safe to run Samba on port 139 internally?
Only if: (1) SMBv1 is disabled (smb.conf: min protocol = SMB2), (2) port 139 is restricted to trusted subnets via hosts allow, (3) NTLM is disabled in favor of Kerberos authentication. Better: configure Samba on port 445 only (smb.conf: disable netbios = yes) and ensure clients use DNS/WINS instead of NetBIOS name resolution.