Contained isn’t clean, Part 2: staging the attack

Contained isn't clean - Part 2 - Staging the attack

Part 2 of 4 - The lab and the footholds

In the previous part: Defender’s automatic attack disruption and predictive shielding contain a compromised account, but the footholds an attacker leaves behind are a separate problem. The obvious endpoint route was blocked by antivirus, so the attack moves to the identity plane.

The lab

Everything runs in a dedicated Contoso test tenant:

  • Victim user: a licensed Microsoft 365 E5 account (the compromised user) with its own Authenticator registered
  • Second compromised account: an over-privileged helpdesk account holding Privileged Role Administrator and Application Administrator - more privilege than a helpdesk needs, which is exactly what attackers look for
  • Victim device: an Entra joined Windows 11 VM onboarded to Defender for Endpoint, signed in as the victim user
  • Attacker: a separate browser on a different public IP, using the stolen session

Prerequisites

  • Microsoft 365 E5 or A5, or Defender for Office 365 Plan 2 plus Defender for Endpoint P2
  • Defender for Endpoint device discovery set to Standard
  • The VM’s device group set to an automation level that lets disruption act without approval
  • Mailbox auditing on, including UpdateInboxRules
  • The test user not excluded from automated response (Settings > Microsoft Defender XDR > Identity automated response)
  • Microsoft 365 app connector in Defender for Cloud Apps, with Entra ID management events, Entra ID sign-in events, Entra ID apps and Microsoft 365 activities all ticked

Gotcha: the Microsoft 365 connector can show as Connected while only Entra users and groups is ticked. In that state CloudAppEvents stays empty and the hunting queries in Part 4 return nothing. Open the connector’s Edit settings and tick the event sources before you need them - it takes a few hours for data to start flowing.

The attacker changes tack: the identity plane

An adversary-in-the-middle attack needs no endpoint malware at all. The attacker phishes the user through a proxy, captures the session token once the user has completed MFA, and replays it. From that point they are the user, in a browser, with nothing on the device for antivirus to see. Everything that follows happens in Entra ID and Exchange Online.

Where predictive shielding fits: predictive shielding acts when Defender sees high-confidence credential theft on a device, restricting the accounts likely exposed there. In this run the endpoint tooling never executed, so that signal is never raised. That is precisely why the identity-plane footholds matter - there was no noisy on-device event to trip it.

The four footholds

With the stolen session, the attacker plants persistence. Two are done as the victim, two through the compromised helpdesk account. The planting steps are described here so the lab can be reproduced; the public companion repository ships only the detection and removal tooling.

As the victim user

  • Register a second Microsoft Authenticator (or software OATH) method, so the attacker holds a valid MFA method of their own (T1098.005). In the lab this is done through the My Sign-ins page; it registers as a new method with its own id.
  • Create an inbox rule that moves mail containing “invoice” or “payment” to RSS Feeds and marks it read (T1564.008).

Gotcha: registering the method is not finished until the verification step completes. A half-finished enrolment - scanning the QR but not approving the test notification - leaves nothing recorded in Entra, even though the authenticator app shows the account.

Through the compromised helpdesk account

  • Add a directory role to the victim (T1098.003) - a role the helpdesk account can assign because it holds Privileged Role Administrator.
  • Add a client secret to an app registration (T1098.001), using its Application Administrator rights. The secret belongs to the app, so it survives anything done to the user.

Note: the privileged footholds can only be planted from the helpdesk account, not the victim. That split - a phished user plus an over-privileged second account - is what turns a single compromised mailbox into tenant-wide persistence.

Next in the series: Part 3 contains both accounts and proves the footholds survive.

2 thoughts on “Contained isn’t clean, Part 2: staging the attack”

  1. Pingback: Contained isn’t clean, Part 1: why containment is only half the job | Cloud-Secure.ai

  2. Pingback: Contained isn’t clean, Part 3: containment and the gap | Cloud-Secure.ai

Leave a Reply