Skip to content
WETNav
SecurityAuthenticationIn-depth analysis

Event ID 4634: An account was logged off

Event 4634 is generated when an account is logged off from a system, recording the end of a user session. While often overlooked, this event is valuable for calculating session durations, detecting anomalous logon patterns when correlated with Event 4624, and identifying potential cleanup activities by attackers attempting to remove their traces.

Channel
Security
Logged by default
Yes
Written on
Target host
Volume
Very high
Audit subcategory
Logoff
Needs a SACL
No

To have this event

  • Enable Logoff: auditpol /set /subcategory:"Logoff" /success:enable /failure:enable

Key fields

Exact XML field names, as they appear in <Data Name="…"> and in SIEM field extractions.

TargetUserNameAccount name that logged off
TargetDomainNameDomain of the account
TargetLogonIdLogon ID to correlate with 4624
LogonTypeType of logon that ended2 Interactive3 Network4 Batch5 Service8 NetworkCleartext9 NewCredentialsAll LogonType values
Have one of these events? Paste it into the decoder

In an investigation

Event 4634 marks the termination of user sessions and provides important context when correlated with Event 4624 (successful logons) to understand session behavior. Security teams can use this event to identify abnormally short sessions (potential failed attack attempts or automated reconnaissance), unusually long sessions (forgotten credentials, persistence mechanisms), or sessions occurring during off-hours. When attackers successfully compromise systems, they may intentionally generate Event 4634 to clear their tracks or may leave sessions open indefinitely if using persistence mechanisms. This event includes the logon ID that matches corresponding Event 4624 entries, enabling precise session tracking. The logon type field indicates whether the session being closed was interactive, network, service, or another type.

What it can reveal

  • Abnormally short session durations (seconds) may indicate automated credential testing or failed attack attempts
  • Missing Event 4634 for established sessions may indicate persistence mechanisms or attackers maintaining access
  • Rapid logon/logoff cycles from same account across multiple systems suggests lateral movement reconnaissance
  • Service account logoffs outside maintenance windows may indicate unauthorized access or misuse
  • Attackers using tools like Mimikatz or Cobalt Strike may not properly close sessions, creating logon/logoff pattern anomalies

How to detect with it

Calculate session durations by correlating Event 4634 with corresponding Event 4624 using the Logon ID field. Alert on sessions shorter than expected thresholds for interactive logons (e.g., <60 seconds) which may indicate failed attacks or scripted reconnaissance. Monitor for Event 4624 entries lacking corresponding Event 4634 closures, suggesting persistent access or forgotten credentials. Track service account logoff events that occur outside scheduled maintenance windows. Detect lateral movement by identifying accounts with many short-duration sessions across multiple systems within compressed timeframes. Monitor privileged account logoffs occurring during unusual hours or from unexpected source systems.

Attack patterns

  • Credential validation reconnaissance: Attackers testing stolen credentials generated Event 4624/4634 pairs with 5-second durations across 50 systems, validating access without maintaining sessions
  • Cobalt Strike beacon detection: Missing Event 4634 for service account Event 4624 Type 3 logons indicated persistent beacon maintaining network sessions for C2 communication
  • Ransomware deployment: Event 4634 logged immediately after Event 4624 as attackers quickly authenticated to systems, deployed ransomware binaries, and disconnected
  • Insider threat investigation: Employee created evening sessions with no corresponding logoffs, later found to be using scheduled tasks for persistent unauthorized access

Compared withEvent 4634 logs all session terminations, while Event 4647 specifically tracks user-initiated logoffs. Event 4778 (session reconnected) and Event 4779 (session disconnected) track Remote Desktop session state changes. Correlate all these events for complete session visibility.

Pull this event

Retrieval queries for a live host, a collected .evtx file and common SIEMs. Filter further on the key fields above.

Get-WinEvent -LogName 'Security' -FilterXPath "*[System[(EventID=4634)]]" -MaxEvents 50 |
  Select-Object TimeCreated, Id, MachineName, Message

-FilterXPath supports exact matches only. For substring matching, filter in Where-Object.

Where it shows up

Investigations, attack signals and lateral movement techniques that rely on this event.

Common questions

What does Windows event ID 4634 mean?
Event 4634 is generated when an account is logged off from a system, recording the end of a user session. While often overlooked, this event is valuable for calculating session durations, detecting anomalous logon patterns when correlated with Event 4624, and identifying potential cleanup activities by attackers attempting to remove their traces.
Is event 4634 logged by default?
Yes, a default Windows installation records it. It is controlled by the "Logoff" Advanced Audit Policy subcategory (Logon/Logoff).
Where is event 4634 recorded?
In the Security channel on the target host.

Event 4634 is generated when an account is logged off from a system, recording the end of a user session.