PORT 139,445/tcp - SMB
SMB stands for Server Message Block. Itβs a protocol for sharing resources like files, printers, in general any resource which should be retreivable or made available by the server.
Introduction
It primarily runs on port 445 or port 139 depending on the server . It is actually natively available in windows, so windows users donβt need to configure anything extra as such besides basic setting up. In Linux however ,it is a little different. To make it work for Linux, you need to install a samba server because Linux natively does not use SMB protocol.
Scanning the network
Nmap
We can do a port scanner selecting the NetBIOS and SMB ports:
Nbtscan
We can scan for NetBIOS Service around the network in order to collect additional NetBIOS information like server names:
Enumeration a target
Nmap scripts
Nmap
contains many useful NSE scripts that can be used to discover and enumerate SMB services. All these scripts are in the folder /usr/share/nmap/scripts/
You can launch the script with the --script
parameter:
Enum4linux
Enum4linux is an script that automatize some tasks:
Shared Folders
There are some available nmap
scripts that could help us in that work:
smbmap
will shows us available shares and permissions:
And we can connect to these shares with smbclient
:
To download recursively all the share you can use smbget
:
Also you could enumerate shares with crackmapexec
:
Finally you can mount the share on your kali.
Shell Command Files (SCF) attack
It is not new that SCF (Shell Command Files) files can be used to perform a limited set of operations such as showing the Windows desktop or opening a Windows explorer. However a SCF file can be used to access a specific UNC path which allows the penetration tester to build an attack. The code below can be placed inside a text file which then needs to be planted into a network share.
Adding the @ symbol in front of the filename will place the file on the top of the share drive.
When the user will browse the share a connection will established automatically from his system to the UNC path that is contained inside the SCF file. Windows will try to authenticate to that share with the username and the password of the user, so we can capture it with Responder.
References:
Last updated
Was this helpful?