TCP 139, 445: NetBIOS, SMB

NetBIOS is a protocol used for File and Print Sharing under all current versions of Windows. While this in itself is not a problem, the way that the protocol is implemented can be. There are a number of vulnerabilities associated with leaving this port open.

NetBios services: NETBIOS Name Service (TCP/UDP: 137) NETBIOS Datagram Service (TCP/UDP: 138) NETBIOS Session Service (TCP/UDP: 139)

TCP port 445 is used for direct TCP_IP MS Networking access without the need for a NetBIOS layer. This service is only implemented in the more recent verions of Windows (e.g. Windows 2K / XP). The SMB (Server Message Block) protocol is used among other things for file sharing in Windows NT/2K_XP. In Windows NT it ran on top of NetBT (NetBIOS over TCP_IP, ports 137, 139 and 138_udp). In Windows 2K_XP, Microsoft added the possibility to run SMB directly over TCP_IP, without the extra layer of NetBT. For this they use TCP port 445.

UDP 137, 138, TCP 139: NetBIOS

Enumeration

nbtscan

sudo nbtscan -r <ip-range>

nmap

Check default SMB ports are open

nmap -p139,445 <ip> --open

List SMB scripts

ls -l /usr/share/nmap/scripts | grep smb

Run all SMB scripts

Run all SMB vuln scripts

enum4linux

enum4linux is a tool for enumerating information from Windows and Samba systems

Run this in parallel to grep the samba version

enum4linux-ng

A next generation version of enum4linux (a Windows/Samba enumeration tool) with additional features like JSON/YAML export. Aimed for security professionals and CTF players. GitHub - cddmp/enum4linux-ng

SMBMap

SMBMap is a handy SMB enumeration tool GitHub - ShawnDEvans/smbmap

List files on target

Enumerate authenticated

Find file

Tools

smbclient

FTP-like client to access SMB/CIFS resources on servers

list shares Unauthenticated

Authenticated

Mount share

(look for files, containing password, pwd, admin, user, connect, etc.)

Download file

Pull all files from (readable) share

mount

Mount smb share locally

gpp-decrypt

A simple ruby script that will decrypt a given GPP encrypted string.

smbexec

A rapid psexec style attack with samba tools

grab password hashes from domain controller

-> 3 "obain hashes" -> 2 "domain controllers"

crackmapexec

A swiss army knife for pentesting networks GitHub - byt3bl33d3r/CrackMapExec

-> SMB Command Reference

Display help (smb)

Using Credentials, NULL Sessions, PtH Attacks

null sessions

Pre Windows 2003, XP SP2

-> Enter empty password

Metasploit

smb version

Get samba version

psexec

Last updated