In this section

0.4 What Stolen Sessions and Tokens Still Open

Module 0

Introduction

A stealer log is worth money because of what it opens, and the most valuable things in it are not passwords. A session cookie or refresh token records that a user already signed in, second factor and all, and whoever presents it can be treated as that user without being asked for anything. A password reset, the reflex response to a stolen credential, does not always end it.

This lesson sets out what a stolen session is, what each kind of token grants and for how long, what a password change revokes and what it leaves, how revocation and continuous access evaluation close the gap, and where replay shows in sign-in records. It then reads a prepared stealer log against prepared sign-in records and checks an assistant's answer to the question every response lead asks: is access over?

1

What a Stolen Session Is

The checks already ran

Every check an identity provider makes happens when the user signs in. Once it is satisfied, it issues tokens so that the user is not asked again for every request, and those tokens sit on the user's machine where a stealer can copy them:

Sign-inpassword andsecond factorissuesIssuedsession cookie,refresh tokenkeepsStoredin the browseron the laptopcopiesStolencopied intoa stealer logpresentsReplayedfrom elsewhere,no prompt

What a stolen session is. The checks all ran at step 1, for the real user; the token issued at step 2 carries that result to whoever presents it.

That is the whole problem in one picture. The second factor, the device check and the location check all ran for the real user at step 1, and the token issued at step 2 carries their result. Presented from another machine, it can be accepted without any of them running again.

That is why the session cookies in a stealer's target list matter more than the saved passwords. A saved password still has to be typed into a sign-in page, where a second factor, a location rule or a risk check can stop it; a session presented to a service never reaches that page.

The prepared stealer log for this lesson is a summary of what such a log holds for one user, with the cookie values removed:

$ cat log/info.txt
User: j.rivera
Machine: LT-RIVERA-07
Collected: 2026-11-10T14:02:31Z
Browser: Chrome, profile Default
$ cut -f1,4 log/cookies.tsv | sort -u
crm.example.com	2026-12-10  # ◄ the app's own session
login.microsoftonline.com	2027-02-08  # ◄ kept across restarts
login.microsoftonline.com	session
news.example.org	2027-05-01
outlook.office.com	session

The log names the user, the machine and the collection time, and lists the hosts its cookies belong to. Two of them are Microsoft's sign-in service, one is Outlook on the web, one is a CRM application at crm.example.com, and one is a news site.

One of the sign-in cookies is persistent, set to outlive a browser restart by months, and the CRM cookie belongs to an application that keeps its own sessions.

Each host in that list is a separate question for the response. The sign-in service cookies can produce sessions for every application the user reaches through Entra ID, so they are the widest. The Outlook cookie is a session with one service.

The CRM cookie answers to the CRM alone. The news site is noise for an identity response, and the record says so rather than leaving it unexplained, because an unexplained line in a scope invites someone to chase it later.

2

What Each Kind Grants, and for How Long

Lifetimes are the attacker's window

Microsoft Entra ID issues several kinds of token and cookie, and each lasts a different length of time. Microsoft documents the defaults:

How long each kind lasts, by Microsoft's defaults

Access token

One hour; up to 28 hours in a CAE session

Refresh token

90 days, replaced with a fresh one on every use; 24 hours for single-page apps

Entra session cookie

Until it expires or is revoked; which changes revoke it is in the next table

An application's own session

Set by the application; Entra ID cannot revoke it directly

An access token is short-lived and grants access to one service. A refresh token is long-lived, can be exchanged for new access tokens without the user, and replaces itself with a fresh one each time it is used, which keeps an active session going well past any single token's life.

For an attacker, the refresh token or the session cookie that can produce one is the prize, because it turns one theft into weeks of access.

The last row is easy to miss. An application that signs users in through Entra ID often creates its own session afterwards, held in its own cookie. Microsoft states plainly that Entra ID cannot directly revoke a session token issued by an application; the application has to end it under its own rules. The CRM cookie in the prepared log is that kind.

Which applications those are is a question the identity team can answer from the list of enterprise applications, and it is worth answering before an incident rather than during one.

An application that relies on Entra ID only at sign-in and then holds its own session for days is a gap in every revocation, and its owner needs a documented way to end one user's sessions on request, tested before the day it is needed.

Lifetimes also bound the search. A refresh token valid for 90 days means a log collected three months ago may still open accounts today, and the Snowflake case in lesson 0.3 involved credentials from infections years old. The age of a log is not a measure of its danger until the sessions in it have been revoked or have expired.

Lifetimes also set the order of the response.

A token that expires within the hour matters only if it is being used now; a refresh token that lasts months matters until it is revoked, whether or not it has been used yet. So the first action against a stealer log is the one that ends the long-lived sessions, and the investigation of what they were used for can follow it rather than wait in front of it.

3

What a Password Change Revokes

It depends on how the session began

The common belief is that changing a password signs everyone else out. Microsoft's documentation of refresh token revocation shows it is more conditional than that. It separates cookies and tokens that were established with a password from those established without one, such as by a passkey or the Authenticator app, and the change that revokes one kind does not always revoke the other:

What each change revokes, from Microsoft's revocation table

User changes own password, or uses SSPR

Password-based cookies and tokens only

Admin resets in the Azure portal

Password-based cookies and tokens only

Admin resets in the Entra or Microsoft 365 admin center

Also non-password tokens; not non-password cookies

Admin revokes all refresh tokens

Everything: every cookie and token type

Password expires

Nothing

The difference that matters most is the first row. When users change their own password, or reset it themselves, only password-based cookies and tokens are revoked. A session that began with a passwordless sign-in, which more organizations now encourage, stays alive. An administrator's reset in the Entra or Microsoft 365 admin center goes further but still leaves non-password cookies. Only revoking all of the user's refresh tokens ends every kind.

So the answer to "did the reset end access?" is a question back: which kind of session was stolen, and which kind of reset was done. In the prepared incident the user signs in to this laptop without a password, and the user changed their own password. The table says the stolen session survives, and section 6 shows the records agreeing.

In practice an analyst rarely knows for certain how every stolen session began. The sign-in records show the authentication method for interactive sign-ins, the user can say how they usually sign in, and the device may hold sessions from both kinds.

When the answer is unclear, the safe course is the one the table says works every time: revoke all of the user's refresh tokens, whatever kind of reset was or was not done.

4

Revoking Sessions

The step a reset does not replace

Microsoft's emergency procedure for a compromised user does not rely on a password change. It disables the account, revokes the user's refresh tokens and then deals with the user's devices. In Graph PowerShell, with the scopes the page gives:

PS C:\> Connect-MgGraph -Scopes 'User.ReadWrite.All', 'Directory.AccessAsUser.All'
PS C:\> $User = Get-MgUser -UserId 'j.rivera@example.com'
PS C:\> Update-MgUser -UserId $User.Id -AccountEnabled:$false
PS C:\> Revoke-MgUserSignInSession -UserId $User.Id

The same revocation is the Revoke sessions button on the user's Overview page in the admin center. Afterwards, Microsoft states, the user cannot obtain new tokens for any application tied to Entra ID, which applies equally to an attacker holding the user's old ones.

As a procedure the response team can follow:

Containing a stolen session, in order

Procedure

User

j.rivera@example.com

Source

Microsoft Learn, revoke user access in an emergency

Steps

  • 1. Disable the account, so no one signs in as the user meanwhile.
  • 2. Revoke all refresh tokens and sessions.
  • 3. Ask each application with its own sessions to end the user's.
  • 4. Remove any authentication method or mail rule added during the replay.
  • 5. Reset the password, then re-enable the account.

Two gaps remain, and the procedure names both. Access tokens already issued stay valid until they expire, by default an hour, because the service receiving them does not ask Entra ID again. And applications with their own sessions keep them until the application ends them.

The first gap is what continuous access evaluation closes; the second is a task for each application's owner, which is why the CRM cookie in the stealer log becomes a separate line in the response.

Disabling the account first matters during a live replay. Revocation stops new tokens; disabling stops the user, and the attacker presenting as the user, from signing in again while the rest of the response happens. The account is re-enabled once the sessions, the password and the second factor are all known to be the user's alone.

That last condition needs checking, not assuming. An attacker holding a live session can often change the account it belongs to, and adding their own authentication method or a mail forwarding rule is a common way to keep access after the session ends.

Before the account is re-enabled, its authentication methods are listed and compared with what the user registered, and anything added during the replay window is removed and recorded.

5

Continuous Access Evaluation

Closing the hour

Continuous access evaluation, CAE, lets services that support it hear about critical changes from Entra ID and act on them without waiting for an access token to expire:

Continuous access evaluation, in short

Critical events

disable, delete, password change, MFA enabled, revocation, high risk

Services

Exchange Online, SharePoint Online, Teams

Propagation

up to 15 minutes

Token lifetime

up to 28 hours in CAE sessions

Location

IP-based named locations only

From Microsoft Learn, continuous access evaluation, dated 8 April 2026. Not every client and service pair supports it.

The critical events are the ones a response creates: an account disabled or deleted, a password changed or reset, multifactor authentication enabled, refresh tokens revoked, and high user risk from ID Protection. Microsoft notes that critical event evaluation does not depend on Conditional Access, so it is available in any tenant. Exchange Online, SharePoint Online and Teams subscribe to these events.

Two limits keep it from being a complete answer. Propagation can take up to 15 minutes, so revocation is near real time rather than instant. And because CAE lets services revoke on events, tokens in CAE sessions can live up to 28 hours, so a client or service pair that does not support CAE is left with a long-lived token and no event to end it.

Microsoft states that not every combination of client app and resource is supported.

Location policies are the exception to the propagation delay. Microsoft states that enforcement of IP-based named locations is instant under CAE, so a policy that blocks sign-ins from outside known networks cuts a replay from elsewhere as soon as the token is presented.

CAE has no insight into country-based locations or MFA trusted IPs, and when the IP ranges in location policies add up to more than 5,000, it cannot enforce location changes in real time.

For the response, that means a revocation is effective against the services that matter most within minutes, and less certain elsewhere. The record says which services the user reached from the attacker's address, so each one can be checked rather than assumed.

The same records show whether CAE was in play. Sign-in records carry details of the session and the token issued, and Module 4 reads them field by field. For a foundation response, the rule is simple: revoke, then watch the sign-ins from the attacker's address for long enough to cover the longest token that might still be valid, and record that window.

6

Matching the Log to the Sign-In Records

Where replay shows

The stealer log gives a collection time and a set of sessions. The user's sign-in records show when those sessions were used and from where. Listing them by time, address, country and whether the user was present makes the replay stand out:

$ jq -r '.[] | [.createdDateTime, .ipAddress, .location.countryOrRegion,
    .isInteractive] | @tsv' signins.json
2026-11-10T08:55:02Z	198.51.100.10	US	true
2026-11-10T13:10:44Z	198.51.100.10	US	false
2026-11-11T02:14:09Z	203.0.113.77	NL	false  # ◄ first use, 12 hours later
2026-11-11T02:31:55Z	203.0.113.77	NL	false
2026-11-11T09:44:12Z	203.0.113.77	NL	false  # ◄ after the password change
2026-11-11T10:58:30Z	203.0.113.77	NL	false

The first two rows are the user, from the office address, the first interactive and the second a background refresh. The next four are from an address in another country, none interactive, starting about 12 hours after the log was collected. Non-interactive sign-ins are how applications use refresh tokens without the user, which is exactly what a replayed session looks like.

The authentication details confirm how those sign-ins met the requirement for a second factor:

$ jq -r '.[] | select(.ipAddress == "203.0.113.77")
    | [.appDisplayName,
    .authenticationDetails[0].authenticationStepResultDetail]
    | @tsv' signins.json
Office 365 Exchange Online	MFA requirement satisfied by claim in the token
Office 365 SharePoint Online	MFA requirement satisfied by claim in the token
Office 365 Exchange Online	MFA requirement satisfied by claim in the token
Office 365 SharePoint Online	MFA requirement satisfied by claim in the token

Each replay met the multifactor requirement through a claim already in the token, not through a new prompt. That is the stolen session carrying the real user's earlier sign-in, and it means nothing about the attacker holding the user's phone or passkey. An analyst who reads "multiFactorAuthentication" in the requirement column and stops has misread the record.

Matching works in both directions. A log with a session for a service and no sign-in from a new address may not have been used yet, which is a reason to revoke now rather than reassurance. A sign-in from a new address with no matching log may be a different theft entirely, and is its own investigation.

The sign-ins are also the index for everything else to pull.

The replay window, from the first sign-in at the attacker's address to the revocation, bounds the searches that follow: what mail was read or sent, what files were opened or shared, whether any inbox rule, authentication method or application consent was added. Each of those is in a different log, and the window lets each search ask for exactly the hours that matter.

7

Reading the Timeline

Is access over?

Put the stealer log, the sign-ins and the response log in one sequence, and the question answers itself:

10 Nov 14:02log collectedon the laptop11 Nov 02:14first replayfrom 203.0.113.7709:30user changesown password09:44, 10:58replay goes on,sessions alive11:05sessionsrevoked

The prepared incident as a timeline. The password change sits in the middle of the replay, not at its end.

The replay began overnight, and the user's password change at 09:30 did not touch it: two more sign-ins from the attacker's address follow it, at 09:44 and 10:58, as the revocation table predicted for a session that began without a password. The analyst's revocation at 11:05 is the first action that reaches the stolen session. Checking the records after it:

$ jq '[.[] | select(.ipAddress == "203.0.113.77"
    and .createdDateTime > "2026-11-11T11:05")] | length' signins.json
0  # ◄ nothing after the revocation
$ jq -r 'max_by(.createdDateTime).createdDateTime' signins.json
2026-11-11T10:58:30Z  # ◄ the last sign-in in the export

There are no sign-ins from the attacker's address after the revocation, and the export runs to 15:00 that day, so the absence covers four hours of records, not an empty file. That is the difference between "no evidence of further use" and "no evidence was looked at", and the record states the window.

Two things remain open. The CRM session in the log is outside Entra ID, and only the CRM can end it. And the stealer took more than sessions, so the password reset, the target list from lesson 0.3 and the laptop itself are still on the list. Module 4 takes replay apart in depth, across more services and token types.

The timeline is also the evidence for the post-incident question of why the reset did not work. Writing it down with the revocation table beside it turns an uncomfortable surprise into a change to the procedure: revoke sessions as the first step, not the last, and treat a user's own password change as a precaution, never as containment.

8

Working With the Assistant

Prompt, session, record

Whether access is over is the question a response lead asks first. Asked with nothing in front of it, an assistant gives the reflex answer:

OpenCode in REMnux, no files namedPrepared example
The user reset their password after a stealer infection. Are we safe now?
Yes, most likely.
  1. Changing the password invalidates the stolen credentials.
  2. Make sure MFA is enabled on the account to prevent future compromise.
Numbered for checking against the tool output

That is the belief this lesson exists to correct, stated with confidence, because the question named no evidence. The fix is not a longer question; it is the records. The session below is a real one, captured in OpenCode in REMnux with GPT-6.2 Astra as the model. The analyst pointed it at the lab pack, then at the mw04 folder:

Is access over?OpenCode in REMnux, the lab packCaptured: OpenCode 1.19.6 with GPT-6.2 Astra, 22 November 2026
  1. You
    analyse the files in /home/remnux/Desktop/mw-lab-pack
  2. OpenCode
    read mw-lab-pack (answers.json, prepared/)glob **/* (5 files)read answers.json (the answer key, 162 lines)read prepared/mw04/signins.json (6 sign-ins)read prepared/mw04/response-log.tsv (4 lines)read prepared/mw04/log/cookies.tsv (5 cookies)read prepared/mw04/log/info.txt (4 lines)
  3. Assistant
    I reviewed all five files in /home/remnux/Desktop/mw-lab-pack. The MW04 records are consistent with reuse of an authenticated Microsoft 365 session. Four successful sign-ins from a new source relied on an existing MFA claim. Two occurred after the user changed their password; none from that source appeared in the four-hour window after the analyst revoked all sessions. The records support replay as an explanation, but do not prove a particular cookie or token was stolen.
  4. You
    analyse the files in /home/remnux/Desktop/mw-lab-pack/prepared/mw04
  5. Assistant
    The four files in prepared/mw04 are consistent with reuse of an existing Microsoft 365 session for j.rivera@example.com (moderate confidence). The account normally used passwordless Authenticator sign-in. The suspicious sign-ins did not record a fresh Authenticator approval: Exchange and SharePoint accepted an MFA claim already present in a token.
  6. Assistant
    Nov 10, 08:55 and 13:10 UTC: signins.json establishes a baseline: interactive MFA succeeded from 198.51.100.10 (US), followed by a non-interactive Exchange sign-in from the same address using the existing MFA claim. Nov 10, 14:02 UTC: log/info.txt identifies Chrome's Default profile on LT-RIVERA-07. log/cookies.tsv lists five redacted cookie entries, including two for login.microsoftonline.com and one for outlook.office.com. Nov 11, 02:14 to 10:58 UTC: signins.json records four successful non-interactive sign-ins from a different source, 203.0.113.77 (NL): Exchange at 02:14 and 09:44, SharePoint at 02:31 and 10:58. All four relied on an existing MFA claim. Nov 11, 09:30 to 15:00: response-log.tsv records a password change at 09:30 and session revocation at 11:05. On that timeline, two sign-ins succeeded after the password change, and none from the NL-labeled source appeared after revocation through 15:00. The response log does not specify its timezone.
  7. Assistant
    What the evidence establishes: The password change alone did not end the observed activity. Session revocation was followed by a quiet period, although the export ends at 15:00. The cookie inventory makes browser-session theft plausible, but it contains neither cookie names nor values, and the sign-in records contain no session or device identifier linking them to that browser. The records also do not show whether anyone read mail or downloaded files. Best follow-up: Check whether the user's VPN or proxy accounts for the source change, correlate the full sign-in records by session and device ID, and review Exchange and SharePoint audit events for the 02:14 to 10:58 UTC window to determine what the account actually did.
BuildOpenCode 1.19.6 with

The answer's timeline was a table in OpenCode and is shown here as running text; the words are the assistant's.

The first prompt named the whole pack, so the assistant read the answer key along with the evidence. It treated the key as claims it had not verified, which is right, but a key in the folder is a key the assistant can repeat, so the lab pack now ships answers.json apart from the folders students analyze. Point the assistant at prepared/mw04, as the second prompt did.

Every point in the answer has to stand on a record before it goes to the response lead. The same files, read with jq:

$ jq -r '.[] | [.createdDateTime[5:16], .ipAddress,
    .isInteractive] | @tsv' signins.json
11-10T08:55	198.51.100.10	true
11-10T13:10	198.51.100.10	false
11-11T02:14	203.0.113.77	false
11-11T02:31	203.0.113.77	false
11-11T09:44	203.0.113.77	false  # ◄ after the change, if both are UTC
11-11T10:58	203.0.113.77	false
$ tail -n 3 response-log.tsv | tr '\t' ' '
2026-11-11T09:30 User changed own password (self-service)  # ◄ no zone written
2026-11-11T11:05 Analyst revoked all of the user's sessions
2026-11-11T11:05 to 15:00 No sign-in from 203.0.113.77 in the exported records
$ jq -r '.[] | select(.ipAddress == "203.0.113.77")
    | .authenticationDetails[0].authenticationStepResultDetail' \
    signins.json | sort | uniq -c
      4 MFA requirement satisfied by claim in the token  # ◄ all four by a claim

Each point holds: the baseline from 198.51.100.10, the four sign-ins from 203.0.113.77, all met by a claim in the token, two of them after the password change, and nothing after the revocation, since the export's last sign-in is at 10:58. The assistant also kept the claim-in-the-token detail straight, reading it as a stolen session carrying the user's earlier sign-in, not as the attacker holding the second factor.

It caught one thing an analyst could easily pass over. The sign-ins are in UTC; the response log's times carry no zone. The lesson's main finding, that the password change did not end the replay, rests on 09:44 coming after 09:30, so the zone is worth one question to whoever kept the log before the finding is reported.

It missed one thing the lesson cares about. The stolen cookies include one for crm.example.com, an application that issues its own sessions, and the revocation at 11:05 does not reach those. The answer lists the Microsoft cookies and stops. A prompt that asks for what the records cannot show tends to bring that out with any model:

PromptThe prompt that holds across models
The folder prepared/mw04 holds a stealer log summary, the sign-in export and our response log for j.rivera. Help me decide whether the attacker still has access. Build the timeline from the records, one command at a time, base each point on a record, and say what the records cannot show.
  1. The folder prepared/mw04the evidence, by path, so the assistant reads it and nothing else
  2. decide whether the attacker still has accessthe decision the answer is for
  3. one command at a timeevery step shows its output, so each point can be checked
  4. base each point on a recordno claim without a line in a file behind it
  5. say what the records cannot showsurfaces sessions outside Entra ID and gaps like a missing time zone

The short prompt worked here because the evidence was small and clean and the model was strong. In another run, on OpenCode's free default model, the answer placed the 10:58 sign-in after the revocation and missed what 09:44 meant; lesson 0.8 takes up model choice. The longer prompt states the decision and asks for the gaps, so it holds up when the model is weaker or the evidence is messier.

The time saved is in the reading. The assistant read four files, put six sign-ins and four log lines in one order and named the follow-up records in under a minute; the check with jq took a few minutes more, and it is the part that cannot be skipped.

The decision goes to the response lead on four lines, each from a record:

What the decision rests on

Replay

non-interactive sign-ins from 203.0.113.77 from 02:14 on 11 November

The reset

sign-ins from that address at 09:44 and 10:58, after the 09:30 change, once the log's times are confirmed as UTC

The revocation

no sign-in from that address between 11:05 and the end of the export at 15:00

What stays open

the CRM session, which only the CRM can end

The last line came from the analyst, not the assistant. Entra ID's revocation does not reach a session the CRM issued, and only the CRM's owner can end it.

Do

Practice

Which sessions are still open?
prepared evidence

The scenario below holds the captured session and the prepared sign-ins, stealer log and response log from this lesson. Check the answer against the records, then decide what is still open.

In the lab, the same evidence is in the lab pack under prepared/mw04. Run the same jq queries against them, then start opencode in REMnux and give it the prompt above, pointed at prepared/mw04 and not the whole pack.

Check each point it makes against the query output, and note whether it raises the CRM session and the log's missing time zone on its own. If you have a tenant of your own, read a test user's sign-ins before and after you revoke their sessions, and note how long a signed-in Outlook on the web tab keeps working.

A stolen session carries the real user's sign-in, second factor included, to whoever presents it, and it lasts as long as its tokens are allowed to.

A password change revokes only some kinds of session, depending on how the session began and who made the change, so the step that ends a theft is revoking all of the user's refresh tokens, with continuous access evaluation closing most of the remaining hour.

Applications that keep their own sessions have to end them themselves. In the sign-in records, replay is a non-interactive sign-in from a new place, meeting MFA by a claim in the token.

Resources

Vendors and projects revise these pages; where a page and this lesson disagree, the page is newer.