بسم الله والصلاة والسلام على رسول الله
اللهم علمنا ما ينفعنا وانفعنا بما علمتنا وقنا عذاب النار
Investigating RDP Lateral Movement
We wouldn’t normally jump directly into RDP logs because they can be very noisy. Instead, let’s say we received an alert for discovery commands being executed on our Domain Controller. We start by looking at process creation logs:
index=win EventCode=1 host=THM-DC
| search CommandLine IN ("*nltest*", "*net * user*", "*net * group*", "*net * view*")
| table _time, host, User, Image, CommandLine, LogonId
| sort _time
We can see a discovery command being executed on the Domain Controller. The LogonId field tells us which session these commands belong to. Let’s use it to find out how this session was created.

Identify How the Attacker Reached the Domain Controller
We take the LogonId from the suspicious commands and correlate it with Event 4624 (successful logon) on the same host:
index=win EventCode=4624 host=THM-DC Logon_ID={LOGON_ID}
| table _time, user, Logon_Type, Source_Network_Address, Logon_ID
The Logon_Type field shows 10, which means the attacker reached the Domain Controller over RDP. We can check the Source_Network_Address field to know where the attacker connected from.

Identifying the Source Hostname
e have the source IP from the Source_Network_Address field, but we need the hostname to query Sysmon logs on that machine
index=win EventCode=4624 Source_Network_Address={SOURCE_IP} user=*$
| stats count by user, Source_Network_Address
| sort -count

Find Evidence of the Outbound RDP Connection on the Source
When someone initiates an RDP connection from a machine, mstsc.exe (the Windows Remote Desktop Client) runs on that machine. If Sysmon is capturing process creation on that host, we can search for it:
index=win EventCode=1 host={SOURCE_SERVER} Image="*mstsc.exe*"
| table _time, User, Image, CommandLine, LogonId
| sort _time
This confirms that someone launched an outbound RDP connection from that server targeting the Domain Controller.

Trace How the Attacker Reached the Intermediate Server
index=win EventCode=4624 host={SOURCE_SERVER} Logon_ID={LOGON_ID}
| table _time, user, Logon_Type, Source_Network_Address, Logon_ID
Using the same correlation technique, we take the LogonId from the mstsc.exe process and match it against Event 4624 on the same server:
We can see another RDP login, but this time, from a different user and a different source than the one we saw on the Domain Controller.

The attacker started on a compromised workstation, used RDP to reach the server, then, from within that session, opened another RDP connection to the Domain Controller using a different, more privileged account.
This pattern is called RDP chaining, and it’s common when attackers pivot through intermediate machines to reach sensitive targets like Domain Controllers. Each hop uses RDP, but the source IP address changes at each hop because the connection originates from the intermediate machine, rather than the original workstation.

سبحانك اللهم وبحمد أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك