Event ID 4778
Event ID 4778: RDP Session Reconnected
A session was reconnected to a Window Station
- Log source
- Security
- How to enable it
- Logon/Logoff > Audit Other Logon/Logoff Events (Success)
- Category
- Lateral Movement
- Priority
- Medium
- Typical volume
- Low
- MITRE ATT&CK
What Event ID 4778 means
4778 records that somebody attached to an existing Windows session, most often over Remote Desktop. No new 4624 of type 10 is guaranteed in that case, so analysts who search only for new logons miss people who return to a session they left open.
The event also covers Fast User Switching on a local console. SessionName separates the two: RDP-Tcp with a number for remote connections, and Console for local ones. ClientName and ClientAddress describe the connecting machine, which is rare among session events.
A disconnected administrator session on a server is a standing invitation. Anyone with SYSTEM rights can attach to it without a password, and 4778 is where that becomes visible. Its counterpart for disconnection is 4779.
Key fields to inspect
| Field | Meaning | Suspicious when |
|---|---|---|
AccountName | Account that owns the session. | An administrator who is not working at that time. |
AccountDomain | Domain or computer of the account. | A local account on a domain server. |
SessionName | RDP-Tcp with a number, or Console. | RDP-Tcp on a host where Remote Desktop should be disabled. |
ClientName | Name that the connecting computer reported. | An unfamiliar name, or LOCAL with no address, which can indicate a hijack on the host. |
ClientAddress | Address of the connecting computer. LOCAL for the console. | Internet addresses, or a server that has no reason to start Remote Desktop. |
LogonID | Session identifier that matches the original 4624. | A session that was opened days earlier by someone else. |
Detection queries
Find accounts whose sessions are picked up from more than one client machine in a day. Adjust names and thresholds to your environment. About these queries.
Splunk SPL
index=windows source="XmlWinEventLog:Security" EventCode=4778
SessionName="RDP-Tcp*"
| bin _time span=1d
| stats dc(ClientName) AS clients values(ClientName) AS names values(ClientAddress) AS addresses BY _time Computer AccountName
| where clients>1 Microsoft Sentinel KQL
SecurityEvent
| where EventID == 4778
| where SessionName startswith "RDP-Tcp"
| summarize Clients = dcount(ClientName), Names = make_set(ClientName, 10), Addresses = make_set(ClientAddress, 10) by Computer, AccountName, bin(TimeGenerated, 1d)
| where Clients > 1 PowerShell
Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4778; StartTime = (Get-Date).AddDays(-7) } |
ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
Select-Object Time, AccountName, SessionName, ClientName, ClientAddress | Format-Table -AutoSize Attack scenarios
RDP session hijacking
From a SYSTEM shell, tscon.exe attaches the attacker to another user's disconnected session with no password. Expect a 4688 for tscon.exe, often started by a temporary service (7045), and a 4778 for the victim's account without any new authentication.
Return of an intruder
Operators disconnect and come back hours later. The first visit is a type 10 logon. Later visits appear as 4778, each with the client name of the attacker's machine, which tends to stay the same across an intrusion.
Investigation checklist
- Match LogonID to the 4624 that created the session and compare the two addresses.
- Search for tscon.exe and new services in the minute before the event.
- Check ClientName across all servers to map the same client's activity.
- Review Microsoft-Windows-TerminalServices-LocalSessionManager/Operational events 21, 24 and 25 to confirm.
Common benign causes
- Users who reconnect after a network drop or from a meeting room.
- Fast User Switching on shared workstations, with SessionName Console.
- Remote Desktop gateways, which can present the same address for many users.
Event ID 4778 FAQ
What is the difference between 4778 and 4779?
4778 is a reconnection to a session and 4779 is a disconnection. Together they outline when a session was in use, between the original logon and the final logoff.
Can ClientName be trusted in 4778?
It is reported by the client and can be changed, so treat it as a lead and not as proof. It is still useful, because attackers rarely bother to change it between connections.
How do I detect RDP hijacking with tscon?
Look for tscon.exe running as SYSTEM, usually through a service or scheduled task, followed within seconds by 4778 for a different account and no matching authentication event.