Lateral movement and exfiltration
16 min · 2 ejercicio(s)
Lateral movement with PsExec
PsExec copies a service binary (PSEXESVC.exe) to the target and starts it there (MITRE ATT&CK T1021.002, T1569.002). The two halves happen on different hosts, so a sequence by host.name cannot find them. Without a join key the sequence only relies on order and time:
sequence with maxspan=1m
[process where process.name : "psexec*.exe"]
[process where process.name : "psexesvc.exe"]On a large network you would add more context, e.g. a network connection from the source to port 445 of the target.
Exfiltration with rclone
rclone is a legitimate cloud sync tool and a favourite of ransomware gangs for stealing data (MITRE ATT&CK T1567.002). Attackers drop it, run it and delete it afterwards. Sequences can describe the whole story:
sequence by host.name with maxspan=30m
[file where event.type == "creation" and file.name : "rclone.exe"]
[process where process.name : "rclone.exe"]
[file where event.type == "deletion" and file.name : "rclone.exe"]Missing events
A sequence can also express that something did not happen in between, with ![ … ]. For example "an account was created and no change ticket process ran". Use it carefully: absence is harder to prove than presence.
🔎 Profundiza: funciones, errores habituales y práctica
Lateral movement detections
| Technique | Data | Idea |
|---|---|---|
| PsExec (T1569.002) | process | PSEXESVC.exe started by services.exe |
| SMB admin shares (T1021.002) | network + auth | logon type 3 followed by service creation |
| WMI (T1047) | process | WmiPrvSE.exe spawning cmd.exe or powershell.exe |
| RDP (T1021.001) | auth | RDP logon from a workstation that normally never uses RDP |
Missing events in practice
sequence by host.name with maxspan=10m
[process where process.name : "rclone.exe"]
![file where event.type == "deletion" and file.name : "rclone.exe"]Use ![ … ] when the absence of a step is meaningful, e.g. a privileged action without a preceding approval tool. Missing-event sequences need a reliable data source: if the log for step 2 is lost, you get false positives.
Exfiltration signals
- Known tools:
rclone,MEGAcmd,winscp,curl -T, cloud CLIs - Large outbound volumes to new destinations (ES|QL
SUM(source.bytes)) - Staging: archives created shortly before (
file where file.extension : ("zip", "7z", "rar")) - Anti-forensics afterwards:
wevtutil cl, deletion of the tool
Combine an EQL sequence (behaviour) with an ES|QL aggregation (volume) for high-confidence alerts.