RDP session takeover with tscon or session shadowing
Detects the two command-line forms of taking over an existing Windows remote desktop session: tscon.exe attaching another session to a terminal, and mstsc.exe shadowing a live session. tscon is matched on the binary alone because `tscon 2` with no further arguments already connects the target session to the caller's own — a complete hijack that a /dest: gate would miss, leaving only the longer variant that appears in write-ups. The shadow arm matches /shadow: on its own for the same reason: where the shadowing policy has already been set to view or control without consent, /noConsentPrompt is unnecessary and `mstsc /shadow:2 /control` takes the session silently, so a command line carrying both switches is the higher-confidence variant to triage first rather than the gate. Both are the observable MITRE's AN0216 describes as a session takeover with no matching logon event — the hijack produces no 4624 for the hijacker, which is why the logon events in the strategy cannot carry this detection on their own and the process creation source is used instead. The event says nothing about whose session was taken, so corroborate every hit with 4778 (session reconnected), 4779 (session disconnected) and 4624 with logon type 10 on the same host around the same time; the analytic's ExpectedUserSessionMap knob is the per-user baseline Sigma cannot hold. Classic tscon abuse runs as SYSTEM through a service the adversary created, so a parent of services.exe on a match is corroborating rather than exculpatory. Scope is the Windows RDP leg of DET0079 only, which is the mechanism ATT&CK files as T1563.002 — AN0217's Linux screen/tmux attach and PTY reuse and AN0218's macOS VNC and TTY takeover are not covered here. Where this is run against Security 4688 rather than Sysmon Event ID 1, Audit Process Creation and the separate "Include command line in process creation events" policy both have to be enabled or the shadow arm has no CommandLine to read and only the tscon arm survives. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0079, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
Sentinel · KQL
Run this as a search.
DeviceProcessEvents| where (FolderPath endswith "\\tscon.exe" or (FolderPath endswith "\\mstsc.exe" and (ProcessCommandLine contains "-shadow:" or ProcessCommandLine contains "/shadow:" or ProcessCommandLine contains "–shadow:" or ProcessCommandLine contains "—shadow:" or ProcessCommandLine contains "―shadow:")))
Splunk · SPL
Run this as a search.
index=* (Image="*\\tscon.exe" OR (Image="*\\mstsc.exe" AND (CommandLine="*-shadow:*" OR CommandLine="*/shadow:*" OR CommandLine="*–shadow:*" OR CommandLine="*—shadow:*" OR CommandLine="*―shadow:*")))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE (TO_LOWER(process.executable) LIKE "*\\\\tscon.exe" OR (TO_LOWER(process.executable) LIKE "*\\\\mstsc.exe" AND (TO_LOWER(process.command_line) LIKE "*-shadow:*" OR TO_LOWER(process.command_line) LIKE "*/shadow:*" OR TO_LOWER(process.command_line) LIKE "*–shadow:*" OR TO_LOWER(process.command_line) LIKE "*—shadow:*" OR TO_LOWER(process.command_line) LIKE "*―shadow:*")))
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,process_creation,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <!-- 2 rules: the Sigma condition ORs across different fields, which one rule cannot express. Any one matching is a hit. --> <rule id="100000" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)\\tscon\.exe$</field> <description>RDP session takeover with tscon or session shadowing (1/2)</description> <mitre> <id>T1563</id> <id>T1563.002</id> </mitre> </rule> <rule id="100001" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)\\mstsc\.exe$</field> <field name="CommandLine" type="pcre2">(?i)(-shadow:|/shadow:|–shadow:|—shadow:|―shadow:)</field> <description>RDP session takeover with tscon or session shadowing (2/2)</description> <mitre> <id>T1563</id> <id>T1563.002</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
No comments yet. Someone who deploys this will have something to say about it.