> For the complete documentation index, see [llms.txt](https://notes.qazeer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.qazeer.io/dfir/windows/ttps_analysis/lateral_movement.md).

# Lateral movement

**Windows DFIR notes are no longer maintained on InfoSec-Notes. Updated versions can be found on:** [**artefacts.help**](https://artefacts.help/)**.**

**The artefacts generated independently of the lateral movement technics used are introduced in the `[DFIR] Windows - Account Usage` note. The artefacts presented below are associated with a given lateral movement technique.**

### Remote Desktop artefacts

#### Destination machine

| Artefact                                    | Location                                                                                              | Conditions                                                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Information yield                                                                                                                                                                                                                                      |
| ------------------------------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| EVTX                                        | `Security.evtx`                                                                                       | Default configuration.                                                                  | <p>Event <code>4624: An account was successfully logged on</code>.<br><br><code>LogonType</code> field:<br><br><code>LogonType 10</code> for standard <code>RemoteInteractive</code> authentication.<br><br>Replaced by <code>LogonType 7</code> (<code>This workstation was unlocked</code>) for existing session unlocking.<br><br>Replaced by <code>LogonType 3</code> for <code>RDP</code> <code>RestrictedAdmin</code> mode.<br><br>Eventual prior event <code>4624</code> <code>LogonType 3</code> for <code>NLA</code> authentication.</p> | <p>Source user domain and username.<br><br>Source machine hostname / IP.</p>                                                                                                                                                                           |
| EVTX                                        | `Security.evtx`                                                                                       | Requires `Audit Other Logon/Logoff Events`.                                             | <p>Event <code>4778: A session was reconnected to a Window Station</code>.<br><br>Event <code>4779: A session was disconnected from a Window Station</code>.</p>                                                                                                                                                                                                                                                                                                                                                                                  | <p>Source user domain and username.<br><br>Source machine hostname / IP.</p>                                                                                                                                                                           |
| EVTX                                        | `Microsoft-Windows-TerminalServices-RemoteConnectionManager%4Operational.evtx`                        | Default configuration.                                                                  | <p>Event <code>1149: Remote Desktop Services: User authentication succeeded</code><br><br><strong>Does not indicate a successful session opening but an access to the Windows login screen.</strong> This event is however only generated upon successful authentication if <code>Network Level Authentication (NLA)</code> is required.</p>                                                                                                                                                                                                      | <p>Source user domain and username.<br><br>Source machine IP.<br><br>This event followed by unusual / suspicious activity of <code>NT AUTHORITY\SYSTEM</code> may indicate the use of a <code>Sticky Keys</code> or <code>Utilman</code> backdoor.</p> |
| EVTX                                        | `Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational`                                 | Default configuration.                                                                  | <p>Event <code>21: Remote Desktop Services: Session logon succeeded</code>.<br><br>Event <code>22: Remote Desktop Services: Shell start notification received</code>.<br><br>Event <code>23: Remote Desktop Services: Session logoff succeeded</code>.<br><br>Event <code>25: Remote Desktop Services: Session reconnection succeeded</code>.<br><br>With <code>Source Network Address</code> != <code>LOCAL</code>.</p>                                                                                                                          | <p>Source user domain and username.<br><br>Source machine IP.<br><br></p>                                                                                                                                                                              |
| EVTX                                        | `Microsoft-WindowsRemoteDesktopServicesRdpCoreTS%4Operational.evtx`                                   | <p>Default configuration.<br><br>Introduced in <code>>= Windows Server 2012</code>.</p> | <p>Event <code>131: The server accepted a new TCP connection from client \<IP></code>.<br><br><strong>Does not indicate a successful session opening but a network access to the RDS service.</strong></p>                                                                                                                                                                                                                                                                                                                                        | Source machine IP.                                                                                                                                                                                                                                     |
| Prefetch                                    | `C:\Windows\Prefetch\`                                                                                | Only generated on Windows desktop OS by default.                                        | <p>Prefetch files related to <code>RDP</code> activity:<br><br><code>TSTHEME.EXE-\<RANDOM>.pf</code><br><br><code>RDPCLIP.EXE-\<RANDOM>.pf</code></p>                                                                                                                                                                                                                                                                                                                                                                                             | Timestamp of last runs and overall number of executions.                                                                                                                                                                                               |
| <p>Filesystem<br><br>MFT<br><br>UsnJrnl</p> | <p><code>C:\Windows\Prefetch\</code><br><br><code>$MFT</code><br><br><code>$Extend$UsnJrnl</code></p> | Only generated on Windows desktop OS by default.                                        | <p>Entries for Prefetch files related to <code>RDP</code> activity:<br><br><code>TSTHEME.EXE-\<RANDOM>.pf</code><br><br><code>RDPCLIP.EXE-\<RANDOM>.pf</code></p>                                                                                                                                                                                                                                                                                                                                                                                 | <p>The most recent Prefetch file <code>LastModified</code> timestamp correspond to the last <code>RDP</code> activity.<br><br>The <code>MFT</code> and <code>UsnJrnl</code> may yield information about <code>RDP</code> historic activity.</p>        |
| <p>Shimcache<br><br>Amcache</p>             | <p><code>HKLM\SYSTEM</code> registry hive<br><br><code>Amcache.hve</code></p>                         | Unreliably generated.                                                                   | Entries for `rdpclip.exe` and / or `tstheme.exe`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                        |

#### Source machine

| Artefact | Location                                                                                                                         | Conditions                                                                                                                                                                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Information yield                                                                                                                                                                                                                                  |
| -------- | -------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| EVTX     | `Security.evtx`                                                                                                                  | <p>Default configuration.<br><br>Only logged if <code>NLA</code> is enabled on the destination AND alternate credentials are used.</p>                                                                  | <p>Event <code>4648: A logon was attempted using explicit credentials</code>.<br><br>Legacy:<br>Events <code>552: Logon attempt using explicit credentials</code>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                              | <p>Current logged-on user's domain and username.<br><br>Alternate user's domain and username.<br><br>Destination machine's hostname. The <code>Network Information</code> section only yields information about the client.</p>                    |
| EVTX     | `Microsoft-WindowsTerminalServicesRDPClient%4Operational.evtx`                                                                   | Default configuration.                                                                                                                                                                                  | <p>Event <code>1024: RDP ClientActiveX is trying to connect to the server (\<HOSTNAME>)</code>.<br><br>Event <code>1102: The client has initiated a multi-transport connection to the server \<IP></code>.<br><br>Event <code>1029: Base64(SHA256(UserName)) is = \<HASH></code>.<br><a href="https://gchq.github.io/CyberChef/#recipe=Decode_text(&#x27;UTF-8%20(65001)&#x27;)Encode_text(&#x27;UTF-16LE%20(1200)&#x27;)SHA2(&#x27;256&#x27;,64,160)From_Hex(&#x27;Space&#x27;)To_Base64(&#x27;A-Za-z0-9%2B/%3D&#x27;)&#x26;input=QWRtaW5pc3RyYXRvcg">This <code>CyberChef</code> formula</a> can be used to compute the hash.</p> | <p>Current logged-on user's domain and username.<br><br>Event <code>1024</code>: destination machine's hostname.<br><br>Event <code>1102</code>: destination machine's IP.</p>                                                                     |
| Registry | <p><code>C:\Users\&#x3C;USERNAME>\NTUSER.DAT</code><br><code>NTUSER\Software\Microsoft\Terminal Server Client\Servers</code></p> | Default configuration.                                                                                                                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                    |
| EVTX     | `Security.evtx`                                                                                                                  | <p>Requires <code>Audit process tracking</code> to be enabled.<br><br>For the process arguments to be logged, <code>Include command line in process creation events</code> must be enabled as well.</p> | <p>Event <code>4688: A new process has been created</code>.<br><br><code>New Process Name</code>: <code>C:\Windows\System32\mstsc.exe</code>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | <p>Current logged-on user's domain, username and <code>LogonID</code>.<br><br>Parent process.<br><br>If the destination machine is specified in the command line, and the command line logged, yields the destination machine's hostname / IP.</p> |

(SourceName = 'Microsoft-Windows-TerminalServices-LocalSessionManager' AND (EventID = 21 or EventID = 22 or EventID = 23 or EventID = 24 or EventID = 25 or EventID = 39 or EventID = 40)) (SourceName = 'Microsoft-Windows-TerminalServices-RemoteConnectionManager' AND EventID = 1149)"

### PsExec artefacts

### Remote Scheduled Tasks artefacts

*Remote job schedule registration, execution and deletion*

Location : Victim `Microsoft-Windows-TaskScheduler%4Operational.evtx` hive.

Artifact : Task Scheduler Event Log(since win7)

* Registering Job schedule ID : 106
  * Account Name used to registration
  * Job Name : Usually “At#” form
* Starting Job schedule ID : 200
  * The path of file executed for job
* Deleting Job schedule ID : 141

  * Account Name used for the deletion

  The creation, execution and deletion of a scheduled task will notably, in addition to `Security` `EID 4624` and `EID 4672` events, generate the following Windows events:

  * `Microsoft-Windows-TaskScheduler/Operational` hive, `EID 106: User "<DOMAIN | HOSTNAME>\<USERNAME> | <SID>" registered Task Scheduler task "\<TASK_NAME>"`.
  * `Microsoft-Windows-TaskScheduler/Operational` hive, `EID 140: User "<DOMAIN | HOSTNAME>\<USERNAME> | <SID>" updated Task Scheduler task "\<TASK_NAME>"`.
  * `Microsoft-Windows-TaskScheduler/Operational` hive, `EID 141: User "<DOMAIN | HOSTNAME>\<USERNAME> | <SID>" deleted Task Scheduler task "\<TASK_NAME>"`.
  * `Microsoft-Windows-TaskScheduler/Operational` hive, `EID 129: Task Scheduler launch task "\<TASK_NAME>", instance "<INSTANCE>" with process ID <PID>`.
  * `Microsoft-Windows-TaskScheduler/Operational` hive, `EID 100: Task Scheduler started "<INSTANCE>" instance of the "\<TASK_NAME>" task for user "NT AUTHORITY\SYSTEM | <DOMAIN | HOSTNAME>\<USERNAME> | <SID>"`.
  * `Microsoft-Windows-TaskScheduler/Operational` hive, `EID 140: User "<DOMAIN | HOSTNAME>\<USERNAME> | <SID>" updated Task Scheduler task "\<TASK_NAME>"`.
  * `Security`, if `Audit object access` is enabled for `Success` and `Failure`, `EID 4698: A scheduled task was created`. Includes the scheduled task detailed configuration (author, triggers, executing user, command and eventual command argument, etc.) and can be correlated to a logon session using the event `Logon ID`.
  * `Security`, if `Audit object access` is enabled for `Success` and `Failure`, `EID 4702: A scheduled task was updated`. Specifies the user at the origin of the modification, the task name of the updated scheduled task and can be correlated to a logon session using the event `Logon ID`.
  * `Security`, if `Audit object access` is enabled for `Success` and `Failure`, `EID 4699: A scheduled task was deleted`. Specifies the user at the origin of the modification, the task name of the updated scheduled task and can be correlated to a logon session using the event `Logon ID`.

### Remote Windows Services artefacts

### WMI artefacts

### WinRM artefacts

\| Microsoft-Windows-WinRM/Operational | 6 | X | `Creating WSMan Session`.\
Logged on the client host. The event connection string field include the remote host address. | | Microsoft-Windows-WinRM/Operational | 91 | X | `Session creation`. | | Microsoft-Windows-WinRM/Operational | 161 | X | `The client cannot connect to the destination specified in the request.`\
Error event, logged on the remote system.\
The `User` and `Computer` event fields provide information on the client. | | Microsoft-Windows-WinRM/Operational | 168 | X | `Session creation`. |

WinRM Operational event log entries indicating authentication prior to PowerShell remoting on an accessed system • Event ID 169: “User \[DOMAIN\Account] authenticated successfully using \[authentication\_protocol]”

System event log entries indicating a configuration change to the Windows Remote Management service: ○ Event ID 7040 “The start type of the Windows Remote Management (WS-Management) service was changed from \[disabled / demand start] to auto start.” – recorded when PowerShell remoting is enabled. ○ Event ID 10148 (“The WinRM service is listening for WS-Management requests”) – recorded upon reboot on systems where remoting has been enabled.

WinRM Operational event log entries indicating authentication prior to PowerShell remoting on an accessed system: ○ Event ID 169 (“User \[DOMAIN\Account] authenticated successfully using \[authentication\_protocol]”)

### DCOM artefacts

***

### References

<https://dfironthemountain.wordpress.com/2019/02/15/rdp-event-log-dfir/>

<https://digital-forensics.sans.org/media/SANS\\_Poster\\_2018\\_Hunt\\_Evil\\_FINAL.pdf>

<https://jpcertcc.github.io/ToolAnalysisResultSheet/details/mstsc.htm>

<https://nullsec.us/windows-rdp-related-event-logs-the-client-side-of-the-story/>

<https://ponderthebits.com/2018/02/windows-rdp-related-event-logs-identification-tracking-and-investigation/>

<https://purerds.org/remote-desktop-security/auditing-remote-desktop-services-logon-failures-1/>

<https://repo.zenk-security.com/Forensic/A-forensic-analysis-of-apt-lateral-movement-in-windows-environment.pdf>

<https://salt4n6.com/2019/09/22/event-id-1024/>

<https://www.13cubed.com/downloads/rdp\\_flowchart.pdf>

<https://www.andreafortuna.org/2020/06/04/windows-forensic-analysis-some-thoughts-on-rdp-related-event-ids/>

<https://www.manageengine.com/products/active-directory-audit/kb/windows-security-log-event-id-X.html>

<https://www.youtube.com/watch?v=qxPoKNmnuIQ>
