SMB
Last updated
Was this helpful?
Last updated
Was this helpful?
SMB (Server Message Block) is a protocol running on port 445/tcp. It is used to share access to files, printers and serial ports on a network
In 1996 Microsoft releases a customized SMB they call CIFS (Common Internet File System). CIFS can sometimes be referred to as SMB1 (or SMBv1, SMB 1.0). In 2006, Microsoft introduced SMB2 (also referred to as SMB 2.0), a new version of the CIFS protocol. In 2012, Microsoft released SMB3 (a.k.a. SMB 3.0). As of 2020, most systems use SMB 2.0 or above.
In short, SMB is the protocol, CIFS is an old dialect of SMB, and Samba is the Linux/UNIX-like implementation of the SMB protocol (see ).
The null session, if not disabled, allows for anonymous/guest access to a network resource when using no credentials
Tools like (C) and (Python) can be used to access SMB shares with null sessions. Null credentials do not have to be explicitly set in this case.
(Python) can be used to test for null session on multiple hosts.
In addition to not being stealthy at all, and depending on the password policy rules in place, bruteforcing authentication could lead to accounts getting locked out when reaching maximum allowed tries.
Valid credentials can then be used to list accessible shares and enumerate the contents of the shares the account has access to.
PSExec exploit module runs on the same principle as the PSExec Windows utility. The exploit embeds a payload into an executable, upload it into the Admin$ share. It then calls the Service Control Manager to approximately start a new rundll32.exe process that will execute our malicious executable.
Privileged user credentials required.
File uploading, creating, starting, stopping, deletion of services makes it really noisy.
Smbexec works like Psexec, but instead of trying to execute an uploaded executable inside the share, it will try to use directly the binaries cmd.exe/powershell.exe. The exploit create an arbitrary service with the Service File Name attribute set to a command string to execute. It echoes the command to be executed to a .bat file, execute it and delete it.
The exploit then get the output of the command via Smb and displays the content. For every command, a new service is created.
Prioritize using Smbexec when you detect a strong AV, cmd.exe
is a trusted component of the operating system.
Privileged user credentials required.
Windows Management Instrumentation is a subsystem of PowerShell that gives high privileged access to system monitoring tools.
Wmiexec has a similar approach to smbexec but it is executing commands through WMI.
DCOM is a way for a computer to run a program over the network on a different computer as if the program was running locally.
Dcomexec has a similar approach to psexec but it is executing commands through DCOM.
netexec is a swiss army that has featured a lot of the command execution methods mentionned precedently.
One of its feature is to automate the process of executing code via SMB by switching between methods when one fails.
Eternalblue is a flaw that allows remote attackers to execute arbitrary code on a target system by sending specially crafted messages to the SMBv1 server. Other related exploits were labelled asEternalchampion
, Eternalromance
and Eternalsynergy.
Smbghost is a bug occuring in the decompression mechanism of client message to a SMBv3.11 server. This bug leads remotely and without any authentication to a BSOD or an RCE on the target.
Smbleed allows to leak kernel memory remotely, it is also occuring in the same decompression mechanism as smbghost.
In order for the target to be vulnerable, it must have the SMBv3.1.1 implementation running and the compression function enabled, which is on by default.
Tools like , or can be used to operate authentication bruteforce attacks.
Tools like and can be used to recursively download a SMB share's content.