Skip to content

SenseOn SOC Playbook: M365 Compromised Account

This page gives the process that SenseOn recommends to managed providers of SenseOn, to extend the investigation of incidents in end customer estates. It also gives best practice guidance for additional manual threat hunting and containment.

This playbook gives the steps that an analyst must do to investigate a suspected compromised account. The analyst uses the M365 Response Actions feature, which is part of the Entra ID integration at SenseOn.

  • M365 Unfamiliar sign-in properties
  • M365 Atypical travel
  • M365 Anonymous IP address
  • M365 Password Spray

Process Flowchart

Malware flowchart

Identification

Other alerts

Use the Hunt Lab query that follows to find any other unusual alerts for the suspect IP or the compromised user:

SELECT
  _time_observed,
  title,
  description,
  severity,
  user_logon_ip,
  user_principal
FROM
  cloud_ms_graph_alert
WHERE
  has(user_logon_ip, '<ip_address>')
  OR arrayStringConcat(user_principal, ',') LIKE '%<compromised_user>%'

Logon Behaviour

With the telemetry from the Microsoft Graph API integration, find any other unusual logons for the user or the suspect IP address:

SELECT
  _time_observed,
  ip_address,
  user_principal_name,
  location_country_code,
  location_city,
  sign_in_error_code
FROM
  cloud_ms_sign_in_log
WHERE
  user_principal_name LIKE '%<compromised user>%'
  OR ip_address = '<suspect IP>'

Suspicious Cloud Actions

With the telemetry from the Microsoft Entra ID integration, find any suspicious O365 actions by the compromised user or the suspect IP address:

SELECT
  _time_observed,
  client_ip,
  user_id,
  workload,
  operation,
  raw
FROM
  cloud_ms_o365_activity_log
WHERE
  user_principal_name LIKE '%<compromised user>%'
  OR ip_address = '<suspect IP>'

Suspicious Account Modification

With the telemetry from the Microsoft Entra ID integration, find any suspicious account modifications by the compromised user or the suspect IP address:

SELECT
  _time_observed,
  initiator_user_ip,
  initiator_user_principal_name,
  initiator_app_name,
  activity_name,
  operation_type,
  category,
  target_resource_user_principal_names,
  target_resource_modified_properties
FROM
  cloud_ms_directory_audit_log
WHERE
  initiator_user_principal_name LIKE '%<compromised user>%'
  OR initiator_user_ip = '<suspect IP>'
  OR arrayStringConcat(target_resource_user_principal_names,',') LIKE '%<compromised user>%'

Review the User’s Device

Use the Hunt Lab query that follows to find the device of the user:

SELECT
  DISTINCT user,
  _hostname
FROM
  endpoint_logged_in_user
WHERE
  lower(user) LIKE lower('%<user>%')
To understand the cause of this compromise, use the query that follows to find any malicious behaviour:
SELECT
    _time_observed, _hostname, username, command
FROM
    endpoint_process
WHERE
    lower(_hostname) LIKE lower(‘%<device>%’)
ORDER BY
    _time_observed ASC
If this compromise is the result of a malware infection, follow the malware playbook.

Containment

After you make sure that the account is compromised, do an impact assessment. Do this before you take containment actions.

Impact Assessment

  1. Find the number of affected users. If more than 2 users are affected, escalate internally.
  2. Assess the account severity of these users.
  3. Is customer escalation necessary? If any user is on the list of priority accounts, follow the standard escalation procedure to a senior analyst. Do this before you notify the customer.

Contain Account

💡 To disable accounts and revoke sessions from SenseOn, you must have the Entra ID User Containment connector and Active Response access.

  1. After you get approval, disable the user account through the SenseOn platform.
    1. Each customer must have pre-agreed decision criteria. These criteria make prompt containment possible, with the minimum of business impact.
  2. Revoke active M365 sessions through the SenseOn platform.
  3. Quarantine Endpoint: If you suspect endpoint compromise, isolate the device.

Action for customer

  1. Block offending IP Addresses: If you find malicious/unauthorised IPs, block them at the firewall, proxy, or cloud gateway.

Review

  1. Review all IOCs across the environment. Make sure that no additional compromise occurred during the incident.
  2. Review the user lockout status. Make sure that nobody unlocked the account during the incident, through the Service desk or by other means.
  3. Review active user sessions across the device. New sessions after the lockout can show a gap. Escalate this gap.

Eradication

Action for customer

  1. Enforce a new strong and unique password.
  2. Make sure that MFA is enabled and correctly configured.
  3. Force a new authentication on all devices.
  4. Disable any backdoor accounts or malicious OAuth applications.
  5. Remove any mailbox rules that a threat actor added.
  6. Remove unauthorised admin accounts or service tokens.

Recovery

Joint action for customer and provider of SenseOn MDR

  1. The SenseOn MDR provider must monitor for continued activity with the threat hunting queries that it created. This makes sure that there are no gaps in the containment and eradication stages.
  2. Create ‘health monitoring’ tasks for endpoint & user behaviour. These tasks are checks that you do frequently.
  3. Before you enable the account again, do a check of the user identity.
  4. After you secure the account, restore legitimate access for the user.
  5. Do a full audit of permissions. Make sure that least privilege applies.
  6. When you find no additional anomalous behaviour after the eradication period, agree with the customer that the recovery is successful.