SCENARIO 05 / IDENTITY

Device-code and authentication-transfer abuse

Control unusual authentication flows and verify who requested the resulting access.

M365-05IdentityInvestigation playbook

How the scenario unfolds

A user can be tricked into entering an attacker-supplied code on a genuine Microsoft sign-in page. The attacker may receive the resulting session for the client they initiated. Authentication transfer is a separate convenience flow with its own access considerations; assess it independently rather than equating all QR codes with an attack.

Conditions to examine

Device-code or transfer flows enabled without a known business need, unmanaged device access and users accepting unsolicited pairing instructions.

Signals to investigate

  • Device-code sign-ins for users who do not use an approved device-code application.
  • A genuine sign-in followed by unfamiliar client or resource activity.
  • A message or support call asking the user to enter a code they did not request.

Evidence to collect

Use Entra sign-ins, authentication protocol and Conditional Access details. Record application and resource IDs, account ID and the reported lure; inspect original transfer information when present.

Open related example Q02

Investigation sequence

  1. Confirm the initiating application and whether the user was intentionally pairing an approved device.
  2. Identify all resources reached by the session, including activity after a refresh.
  3. Review authentication-flow policy scope, exclusions and report-only results against the affected user and resource.

Reduce the exposure

  • Block device-code flow where it is not needed. Before restricting it, identify legitimate Teams device and registration workflows, test Conditional Access policies against those dependencies, and document narrowly scoped exceptions where required.
  • Review authentication transfer separately and constrain it to the intended use cases.
  • Teach users that a genuine sign-in page does not make an unsolicited code request safe.

Contain and recover

  • Contain the identity and revoke relevant sessions when access is unauthorised.
  • Remove associated persistence and investigate any registered device or downstream resource access.
VERIFY THE OUTCOME

Test the approved flow and an out-of-scope flow using test accounts. Record actual policy outcomes and confirm that exception owners and expiry dates are assigned.

Interpret with care

Device-code authentication is also legitimate. The query identifies use of the flow, not phishing. Authentication-flow controls can affect refreshed sessions and device-registration scenarios; pilot the exact journey.

Technical references

[47] [15] [60]