139, 445 - SMB

Nmap

nmap -v -p 139,445 $targetip-254 -oG smb.txt 

search for nmap NSE scripts

ls -1 /usr/share/nmap/scripts/smb*
    /usr/share/nmap/scripts/smb2-capabilities.nse
    /usr/share/nmap/scripts/smb2-security-mode.nse
    /usr/share/nmap/scripts/smb2-time.nse
    ...

Nmap NSE script

nmap --script "safe or smb-enum-*" -p 139,445 $targetip

NSE SMB enumeration scripts:

  • smb-enum-domains

  • smb-enum-groups

  • smb-enum-processes

  • smb-enum-services

  • smb-enum-sessions

  • smb-enum-shares

  • smb-enum-users

Unsafe option. scripts will crash the vulnerable system:

Search for known vulnerabilities:

Nbtscan

Enum4linux

Run everything, runs all options apart from dictionary based share name guessing:

With credentials:

Parameters
  • -a: Do all simple enumeration (-U -S -G -P -r -o -n -i).

  • -u <user>: specify username to use.

  • -p <pass>: specify password to use.

Other enum4linux commands:

Smbclient / smbmap / crackmapexec

List shared folders

It is always recommended to look if you can access to anything, if you don't have credentials try using null credentials/guest user.

Connect/List a shared folder

Mount Shares

Download Files

Create a tar file of the files under users/docs.

Possible Errors

SMB Protocol Negotiation Failed

Normally SMB takes care of choosing the appropriate protocol for each connection. However, if the offered protocols are out of client’s default range, it will return an error message like this:

Solution

Edit the connection protocol range in the client configuration file. Add client min protocol and client max protocol settings to /etc/samba/smb.conf under [global].

Last updated

Was this helpful?