A session that lasts far longer, or far shorter, than its owner's sessions usually do can be the only visible trace of a hijacked account or an unattended foothold. MITRE D3FEND names this countermeasure Session Duration Analysis (D3-SDA) and defines it as "Analyzing the duration of user sessions in order to detect unauthorized activity." It sits under the Detect tactic as a child of User Behavior Analysis (D3-UBA). This card covers what D3-SDA measures, which ATT&CK techniques D3FEND relates it to, the log sources that make session duration measurable, how to verify it and why it is a weak signal on its own. It is written for detection engineers and SOC leads; the UEBA foundations are in the UEBA Guide.
Key takeaways
- Duration is compared with history. D3FEND describes D3-SDA as comparing the duration of a logon session with a behaviour model built from that user's historical session durations.
- Measuring duration is the real work. You need a reliable start and end for each session: Windows 4624 paired with 4634 or 4647 by Logon ID, RADIUS accounting Acct-Session-Time for VPN, or gateway session logs for remote access.
- It relates to account misuse. Through the Authentication and Authorization artefacts, D3FEND relates D3-SDA to the same eight ATT&CK techniques as its UBA siblings, including Valid Accounts (T1078) and External Remote Services (T1133).
- A weak signal, best used as a feature. D3FEND warns of false positives and of attackers whose sessions look normal; session duration works best as one input to a risk score, not as a stand-alone alert.
- Session limits are the preventive pair. Bounded sessions, such as IAM role maximum session duration or conditional access sign-in frequency, cap how long an abused session can run and make outliers easier to see.
D3-SDA at a glance
| Attribute | Value |
|---|---|
| D3FEND ID | D3-SDA (d3f:SessionDurationAnalysis) |
| Tactic | Detect |
| Parent technique | User Behavior Analysis (D3-UBA) |
| Digital artefacts | Authentication and Authorization (D3FEND relation: analyzes) |
| D3FEND references | Patents from Exabeam and Idaptive on network risk and fraud analytics |
| Input data | Session start and end times per identity, with session type and source |
| Output | An anomaly feature or alert for sessions outside the identity's usual duration range |
| Main limitation | Noisy for humans with irregular work patterns; easy for an attacker to stay within normal duration |
How it works
D3FEND's description is two sentences: unauthorised sessions are detected by comparing a logon session's duration with a baseline behaviour model of historical session durations, and abnormalities may indicate suspicious activity. Turning that into a working analytic needs three decisions.
- What a session is: an interactive or remote desktop logon on a host, a VPN connection, a privileged access gateway session, a cloud console session or a federated web session. Each has different start and end events, and they should be baselined separately.
- How to pair start and end: on Windows, Microsoft documents that event 4634 "An account was logged off" can be correlated with event 4624 using the Logon ID, and that Logon IDs are only unique between reboots on the same computer, so the pairing key is host plus boot plus Logon ID. Event 4647 marks user-initiated logoff for interactive and remote interactive sessions. For VPN and network access, RADIUS accounting (RFC 2866) carries Acct-Session-Time (attribute 46, seconds of service, sent in Stop records) and Acct-Session-Id (attribute 44), which must match between Start and Stop records.
- What abnormal means: a per-identity distribution of durations by session type, with outliers above a high percentile flagged, plus rules for sessions that never end (no stop record), sessions at times the identity never works and very short sessions repeated many times.
Session duration is related to, but separate from, D3-WSAA Web Session Activity Analysis, which looks at what happens inside web sessions, and D3-UGLPA User Geolocation Logon Pattern Analysis, which looks at where sessions start.
Where identity fits
Non-human identities change the picture. A Windows service logon (Logon Type 5) or a batch logon (Type 4) can legitimately stay open for long periods, so applying human baselines to them only creates noise. The useful signal for workload identities is the opposite: a service account appearing in an interactive (Type 2) or remote interactive (Type 10) session at all. In cloud, short-lived credentials bound duration by design. AWS IAM role maximum session duration can be set from 1 hour to 12 hours, with 1 hour applied if no value is specified, so a role session that appears to outlive that limit points to a logging gap or a different credential, not a long session. See the Token and Session Security Guide for session lifetimes in depth.
ATT&CK techniques D3FEND relates to D3-SDA
Relationship type: inferred only. D3FEND lists no direct ATT&CK mapping for D3-SDA. The rows below are inferred because D3-SDA analyzes the Authentication and Authorization artefacts, and these ATT&CK techniques produce or create those artefacts in the D3FEND ontology (D3FEND 1.6.0, checked November 2026). Each ID was checked against ATT&CK v20.
| ATT&CK ID | Technique | Shared artefact (D3FEND relation) | Where session duration can help |
|---|---|---|---|
| T1078 | Valid Accounts | Authentication, Authorization (produces) | An abused account holding a session far longer than its owner does, or at hours the owner never works |
| T1110.001 | Password Guessing | Authentication (produces) | Bursts of very short sessions after successful guesses |
| T1110.003 | Password Spraying | Authentication (produces) | Many accounts with brief, atypical sessions from one source |
| T1110.004 | Credential Stuffing | Authentication (produces) | Short check-and-leave sessions on accounts with reused passwords |
| T1133 | External Remote Services | Authentication, Authorization (produces) | VPN or remote access sessions far outside the user's normal length |
| T1187 | Forced Authentication | Authentication (produces) | Later sessions using captured credentials that do not match the owner's pattern |
| T1550.002 | Pass the Hash | Authentication (creates) | Short network logons on many hosts in sequence |
| T1550.003 | Pass the Ticket | Authentication (creates) | Sessions created from replayed tickets that do not match the user's usual session shape |
None of these techniques is detected by duration alone. The brute force rows are better served by D3-ANET Authentication Event Thresholding; duration adds context after access succeeds. Technique detail is in the T1133 External Remote Services Defensive Guide and the MITRE ATT&CK T1078 Valid Accounts Guide.
Session data sources
| Session type | Start record | End record or duration field | Pairing key and caveat |
|---|---|---|---|
| Windows interactive and RDP | Event 4624, Logon Type 2 or 10 | Event 4647 (user-initiated logoff) and 4634 (session terminated) | Host, boot and Logon ID; Logon IDs repeat after reboot |
| Windows network logons | Event 4624, Logon Type 3 | Event 4634 | Very short and frequent by nature; baseline counts rather than duration |
| VPN and network access (RADIUS) | Accounting-Request with Acct-Status-Type 1 (Start) | Acct-Status-Type 2 (Stop) carrying Acct-Session-Time; 3 (Interim-Update) for long sessions | Acct-Session-Id, identical in Start and Stop |
| Privileged access gateway | Session open record | Session close record with duration | Gateway session ID; often the most reliable end time |
| Cloud and federated web | Sign-in or token issue event | Usually no logoff event; infer from last activity or token lifetime | Session or correlation ID; duration is an estimate |
Web and cloud sessions are the hardest to measure, because many applications never log a logoff. For those, track time from sign-in to last activity, and lean on preventive limits. In Microsoft Entra ID, for example, Microsoft documents that the default user sign-in frequency is a rolling window of 90 days, and that sign-in frequency can be set in Conditional Access (Entra ID P1 or P2) to force reauthentication. Privileged session recording and review are covered in the Privileged Session Management Guide.
Implementation steps
- Pick session types worth baselining. Start with remote access (VPN, RDP to servers, privileged gateway sessions), where durations are measurable and abuse is costly.
- Prove you can pair start and end. Build the pairing query and measure the share of sessions with a matched end. If it is low, fix logging (logoff auditing, RADIUS Interim-Update, gateway export) before building any anomaly logic.
- Baseline per identity and per session type. Use a learning window that covers normal working cycles; record percentiles, not just the mean, because duration distributions are skewed.
- Define outliers and orphans. Flag sessions above a high per-identity percentile, sessions with no end after a set time and service accounts in interactive sessions. Thresholds are local choices; tune them in report-only mode first.
- Feed a risk score, not a queue. Use duration anomalies to raise an identity's risk score and combine them with geolocation, resource access and authentication anomalies before alerting.
- Add preventive limits. Set maximum session durations on remote access, idle timeouts on RDP and gateways and sign-in frequency on sensitive applications, so outliers are bounded.
- Roll back safely. If tuning goes wrong, return to report-only mode and keep collecting; do not switch off logoff auditing.
How to verify it works
- Pairing health: report weekly the share of sessions per type with a matched end record; a sudden drop means a log source broke.
- Synthetic long session: with approval, hold a test account's VPN or RDP session well beyond its baseline and confirm the feature fires and raises the risk score.
- Service account test: perform an approved interactive logon with a test service account and confirm the rule fires.
- Emulation and replay: include remote access abuse in authorised adversary emulation and replay closed incidents to see whether duration features would have contributed.
| Metric | Example target (NHI Mgmt Group suggestion, not a standard) | Why it matters |
|---|---|---|
| Sessions with matched start and end, by type | Above 95% for remote access | Duration cannot be analysed without it |
| Remote access identities with a mature baseline | Rising quarter on quarter | Coverage of the riskiest sessions |
| Synthetic long-session tests detected | All tests | Proves the analytic end to end |
| Duration anomalies that contributed to a confirmed incident | Tracked per quarter | Shows whether the feature earns its cost |
| Service accounts seen in interactive sessions | Zero unexplained | A high-value, low-noise rule |
Limits, bypasses and failure patterns
- Attackers with normal-looking sessions: D3FEND notes that attackers may not differ enough in session duration to trigger an alert. An intruder who logs in briefly during work hours is invisible to this analytic.
- Missing logoff events: disconnected RDP sessions, crashed VPN clients and web applications without logout create orphan sessions; without handling them, every analysis shows false long sessions.
- Logon ID reuse: pairing on Logon ID without host and boot context joins unrelated sessions, because Microsoft states Logon IDs are only unique between reboots on the same computer.
- Stolen tokens outlive the session you measure: session cookies and refresh tokens can be replayed from elsewhere while the original session looks normal. Session token theft needs its own controls; see the Session Hijacking and Cookie Theft Guide.
- Human baselines applied to workloads: service and batch logons swamp the results unless baselined separately or handled by type rules.
- Stand-alone alerting: duration alone has low precision; teams that alert on it directly tend to disable it after the first month.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | AC-2(12) Account Monitoring for Atypical Usage | Atypical session length is one form of atypical usage |
| NIST SP 800-53 Rev 5 | AC-12 Session Termination, SC-10 Network Disconnect, AC-2(11) Usage Conditions | Preventive limits that bound session length |
| NIST SP 800-53 Rev 5 | SI-4 System Monitoring, AU-6 Audit Record Review, Analysis, and Reporting | The monitoring and review behind the analytic |
| NIST CSF 2.0 | DE.CM-03, DE.AE-02, DE.AE-03 | Monitoring personnel activity; analysing and correlating adverse events |
| MITRE D3FEND | D3-UBA, D3-SDA | Parent and technique |
Practitioner checklist
- Choose remote access session types first.
- Measure the share of sessions with a matched end before building anomaly logic.
- Pair Windows sessions on host, boot and Logon ID, not Logon ID alone.
- Enable RADIUS accounting with Interim-Update for VPN.
- Baseline per identity and per session type, using percentiles.
- Treat service accounts in interactive sessions as a separate high-priority rule.
- Use duration as a risk score feature, combined with other UBA signals.
- Set maximum session and idle limits so outliers are bounded.
Standards and references
- MITRE D3FEND: Session Duration Analysis (D3-SDA)
- IETF: RFC 2866 RADIUS Accounting
- NIST: SP 800-53 Rev. 5 Security and Privacy Controls (AC-2(12), AC-12)
- Microsoft Learn: Event 4634, an account was logged off
- Microsoft Learn: Conditional Access adaptive session lifetime
- AWS: Update the maximum session duration for a role
Related NHI Mgmt Group resources: UEBA Guide · Token and Session Security Guide · Privileged Session Management Guide · D3-RAPA Resource Access Pattern Analysis · MITRE D3FEND Guide