{"id":22353,"date":"2023-06-30T11:21:16","date_gmt":"2023-06-30T19:21:16","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2023\/06\/30\/news-16083\/"},"modified":"2023-06-30T11:21:16","modified_gmt":"2023-06-30T19:21:16","slug":"news-16083","status":"publish","type":"post","link":"https:\/\/www.palada.net\/index.php\/2023\/06\/30\/news-16083\/","title":{"rendered":"Investigator, API Yourself: Deploying Microsoft Graph on the trail of an attacker"},"content":{"rendered":"<p><strong>Credit to Author: gallagherseanm| Date: Fri, 30 Jun 2023 17:47:14 +0000<\/strong><\/p>\n<div class=\"entry-content lg:prose-lg mx-auto prose max-w-4xl\">\n<p>During the week of February 20, 2023, Sophos X-Ops MDR team received two separate requests for threat hunts related to unusual activity in two customers\u2019 Microsoft 365 (formerly Office 365) environments. This prompted an investigation into sets of Microsoft Graph security events forwarded to Sophos XDR, to identify whether suspicious or malicious activity occurred. Microsoft Graph handles dataflow and access in Microsoft\u2019s cloud (ie., 365, Windows, and Enterprise Mobility + Security); its Security API can connect multiple security providers and lets them operate in a federated fashion as needed.<\/p>\n<p>In this article, we will provide a detailed walkthrough of each step in the attack flow, along with the purpose of each attack technique and the query by which each is identified in XDR. Sophos MDR concluded that email account compromise took place in both cases, using remarkably similar tactics, techniques, and procedures (TTPs). Cross-referencing data from both cases showed that the two compromises may be related to the same (unknown) threat actor.<\/p>\n<p>(Please note that the queries and examples below refer to &#8216;CompromisedAdmin@example.com&#8217;, \u2018TargetUser@example.com\u2019, and so forth. These are placeholders and should be replaced in your queries with your own admin and user email addresses. As an obfuscation measure, we do not differentiate in this writeup which appearances of \u201cexample.com\u201d are connected to which customer\u2019s incident.)<\/p>\n<h2>Microsoft 365\u2019s MITRE ATT&amp;CK Matrix<\/h2>\n<p>The operating environment of Microsoft 365 is unique enough that a specific subset of adversarial TTPs are required to conduct threat hunts and investigations within these cloud environments. Figure 1 shows a screenshot of <a href=\"https:\/\/attack.mitre.org\/matrices\/enterprise\/cloud\/office365\/\">MITRE\u2019s ATT&amp;CK Matrix for Office 365<\/a>. (MITRE is so far using Microsoft\u2019s previous name for the service.) This article will focus on a subset of these TTPs relevant to email account compromise, and show how they were leveraged to identify the adversarial activity exposed in this double threat hunt. (Links to each of the MITRE tactics and techniques cited are provided at the end of this article.)<\/p>\n<figure id=\"attachment_92414\" aria-describedby=\"caption-attachment-92414\" style=\"width: 640px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2023\/06\/office365-attack.png\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-92414 size-full\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2023\/06\/office365-attack.png\" alt=\"Figure 1: Microsoft 365\u2019s modified ATT&amp;CK matrix. Note that there are 11 categories instead of the full ATT&amp;CK\u2019s 14 (Reconnaissance, Resource Development, and Command and Control are not used), and that each category uses a subset of techniques in the MITRE\u2019s full version of ATT&amp;CK\" width=\"640\" height=\"383\" srcset=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2023\/06\/office365-attack.png 1024w, https:\/\/news.sophos.com\/wp-content\/uploads\/2023\/06\/office365-attack.png?resize=300,179 300w, https:\/\/news.sophos.com\/wp-content\/uploads\/2023\/06\/office365-attack.png?resize=768,459 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><figcaption id=\"caption-attachment-92414\" class=\"wp-caption-text\">Figure 1: Microsoft 365\u2019s modified ATT&amp;CK matrix. Note that there are 11 categories instead of the full ATT&amp;CK\u2019s 14 (Reconnaissance, Resource Development, and Command and Control are not used), and that each category uses a subset of techniques in the MITRE\u2019s full version of ATT&amp;CK<\/figcaption><\/figure>\n<h2>Initial Access: TA0001<\/h2>\n<p>In both cases, the initial compromise took place approximately 90 days prior to any observed malicious execution. It is possible this delay was purposeful &#8212; to wait out the default 90-day logging period for Microsoft 365 to roll over, or perhaps due to a handover from an Initial Access Broker (IAB) to another threat actor. The threat actor accessed multiple accounts on the targeted systems, in one case changing the phone number associated with a specific account to a different phone number. We\u2019ll examine this specific technique in the Account Manipulation section below.<\/p>\n<p>&nbsp;<\/p>\n<h3>Valid Accounts: Cloud Accounts (T1078.004)<\/h3>\n<h3>External Logins<\/h3>\n<p>Multiple external IP addresses were used to log into accounts, which the actor compromised or created after gaining initial access by unknown means (see Persistence section below). Three of these IP addresses were observed to be identical in both cases.<\/p>\n<p>Analysis of these three IP addresses produced the following results:<\/p>\n<p><strong>104.161.20[.]102<\/strong><\/p>\n<ul>\n<li>Seven counts of IP abuse reports on AbuseIPDB<\/li>\n<li>Domain name of ioflood[.]com, which is a dedicated-server hosting provider<\/li>\n<li>Exposed ports: FTP (21\/TCP), RPC (135\/TCP), SMB (445\/TCP), RDP (3389\/TCP)<\/li>\n<\/ul>\n<p><strong>20.232.202[.]245<\/strong><\/p>\n<ul>\n<li>Hosted in Microsoft Azure Cloud (EastUS region)<\/li>\n<li>Exposed ports: RDP (3389\/TCP)<\/li>\n<\/ul>\n<p><strong>185.241.149[.]122<\/strong><\/p>\n<ul>\n<li>25 counts of IP abuse reports on AbuseIPDB<\/li>\n<li>Domain name of ipxo[.]com, which is an IP-address marketplace leasing IP resources<\/li>\n<li>Exposed ports: RPC (135\/TCP), SMB (445\/TCP), RDP (3389\/TCP)<\/li>\n<\/ul>\n<p>ioflood.com and ipxo.com, both legitimate companies, were contacted by MDR in connection with this observed abuse of their services.<\/p>\n<p>&nbsp;<\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip  FROM xdr_identity_o365  WHERE lower(user_id) IN (\u2018CompromisedAdmin@example.com', \u2018CompromisedAdmin@example.com)  AND operation IN ('UserLoggedIn', 'UserLoginFailed')<\/pre>\n<h2>Persistence: TA0003<\/h2>\n<h3>Create Account: Cloud Account (T1136.003)<\/h3>\n<p>During the early days of the compromise, the threat actor created an account or accounts on the targeted system to establish persistence, and then (as mentioned) waited months before acting further on their objectives.<\/p>\n<p>One such admin-level account was created during the first week of December; it was then used to create another account in late February, nearly eighty days later and a few days before Sophos was called in on the case. (Logs before the creation of the global admin account were not available to investigators.)<\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, object_id, modified_properties  FROM xdr_identity_o365  WHERE operation LIKE 'Add user.'<\/pre>\n<p>&nbsp;<\/p>\n<h2>Account Manipulation (T1098)<\/h2>\n<h3>User Updates<\/h3>\n<p>The threat actor added a new phone number to a compromised user account, likely to perform and intercept phone calls directly or via Microsoft Teams. There are various reasons the attacker might have done this, including social-engineering purposes, masquerading, or MFA subversion. Interestingly, this phone-number change happened nearly three weeks prior to further attacker activity.<\/p>\n<p><strong>Exchange Operation:<\/strong> \u2018Update User\u2019.<\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip, target, modified_properties  FROM xdr_identity_o365  WHERE lower(user_id)  IN (\u2018CompromisedAdmin@example.com\u2019, \u2018CompromisedAdmin@example.com\u2019)   AND operation LIKE \u2018Update user.\u2019<\/pre>\n<h3>Account Manipulation: Additional Email Delegate Permissions (T1098.002)<\/h3>\n<p>The threat actor leveraged their privileged account to grant themself full access to other users\u2019 mailboxes. They also used this privilege to \u201csend as\u201d (i.e., send email from other users\u2019 accounts) \u2013 potentially leading to further attack efforts at companies with which these two customers do business. Emails were also deleted.<\/p>\n<p><strong>Exchange Operations:<\/strong> \u2018Add-MailboxPermission\u2019, \u2018Add-RecipientPermission\u2019<\/p>\n<p>The following table gives an example of permission modification for full access as seen at this stage.<\/p>\n<p><em>Figure 2: Expanding permissions for an abused account<\/em><\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, object_id,  JSON_EXTRACT(parameters, \u2018$[2].Value\u2019) AS Access,  JSON_EXTRACT(parameters, \u2018$[2].Name\u2019) AS Name,  JSON_EXTRACT(parameters, \u2018$[1].Value\u2019) AS Source, parameters  FROM xdr_identity_o365  WHERE lower(user_id)   IN (\u2018CompromisedAdmin@example.com\u2019, \u2018CompromisedAdmin@example.com\u2019)  AND operation LIKE \u2018%Permission%\u2019<\/pre>\n<p>&nbsp;<\/p>\n<h3>Account Manipulation: Additional Cloud Roles (T1098.003)<\/h3>\n<h3>SharePoint Modifications<\/h3>\n<p>The threat actor added the compromised administrator account to the target organization\u2019s SharePoint with the \u201csite admin\u201d role. In addition, they also enabled \u201cshare using anonymous links,\u201d allowing the actor to create links to files that did not require authentication to access.<\/p>\n<p><strong>Exchange Operations:<\/strong> \u2018SiteLocksChanged\u2019, \u2018SiteCollectionCreated\u2019, \u2018SiteCollectionAdminAdded\u2019<\/p>\n<p>The following table gives examples of cloud roles changed to grant full access as seen at this stage<\/p>\n<table width=\"604\">\n<tbody>\n<tr>\n<th width=\"40\"><strong>User<\/strong><\/th>\n<th width=\"80\"><strong>Operation<\/strong><\/th>\n<th width=\"120\"><strong>Object ID<\/strong><\/th>\n<th width=\"360\"><strong>Modified Properties<\/strong><\/th>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>SiteLocksChanged<\/td>\n<td>https:\/\/sharepoint.com\/&lt;user_page&gt;<\/td>\n<td>[{&#8220;OldValue&#8221;:&#8221;True&#8221;,&#8221;NewValue&#8221;:&#8221;False&#8221;,&#8221;Name&#8221;:<br \/> &#8220;SiteAccess&#8221;}]<\/td>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>SiteCollectionAdminAdded<\/td>\n<td>https:\/\/sharepoint.com\/&lt;user_page&gt;<\/td>\n<td>[{&#8220;OldValue&#8221;:&#8221;&#8221;,&#8221;NewValue&#8221;:&#8221;CompromisedAdmin@example.com&#8221;,<br \/> &#8220;Name&#8221;:&#8221;SiteAdmin&#8221;}]<\/td>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>SharingPolicyChanged<\/td>\n<td>https:\/\/sharepoint.com\/&lt;user_page&gt;<\/td>\n<td>[{&#8220;OldValue&#8221;:&#8221;False&#8221;,&#8221;NewValue&#8221;:&#8221;True&#8221;,&#8221;Name&#8221;:<br \/> &#8220;ShareUsingAnonymousLinks&#8221;}]<\/td>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>SharingPolicyChanged<\/td>\n<td>https:\/\/sharepoint.com\/&lt;user_page&gt;<\/td>\n<td>[{&#8220;OldValue&#8221;:&#8221;Disabled&#8221;,&#8221;NewValue&#8221;:&#8221;Enabled&#8221;,<br \/> &#8220;Name&#8221;:&#8221;ShareUsingAnonymousLinks&#8221;}]<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>Figure 3: Altering roles to give the attacker-controlled account full access<\/em><\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip, object_id, modified_properties  FROM xdr_identity_o365 WHERE lower(user_id)  IN (\u2018CompromisedAdmin@example.com\u2019, \u2018CompromisedAdmin@example.com\u2019)  AND operation IN (\u2018SiteLocksChanged\u2019, \u2018SiteCollectionCreated\u2019,\u2019 SiteCollectionAdminAdded\u2019)<\/pre>\n<p>&nbsp;<\/p>\n<h2>Collection: TA0009<\/h2>\n<h3>Email Collection: Remote Email Collection (T1114.002)<\/h3>\n<p>After giving themselves full permissions to other users\u2019 mailboxes, the threat actor proceeded to read users\u2019 emails to learn more about the users and the organization. This level of access may also be used to gain personal and sensitive data surrounding banking, business operations, verifying MFA configuration, and much more, including activity related to the phone-number change mentioned in the Account Manipulation section. That user\u2019s emails were at this point accessed approximately 20 days prior to this phase, likely for further in-network reconnaissance.<\/p>\n<p>The threat actor could also access, create, respond, and send emails from the compromised admin account, masquerading as the targeted user whose mailbox they were interacting with. It\u2019s also possible that the phone number added to the account mentioned in Account Manipulation was used to masquerade as the account owner, following access of the user&#8217;s emails from another account owned by that user.<\/p>\n<p>Some interesting headers and email creations included responses to passcode requests, banking-related emails (as shown in the table below), and responding to internal project emails.<\/p>\n<p><strong>Exchange Operations:<\/strong> \u2018Update\u2019, \u2018Create\u2019, \u2018SendAs\u2019.<\/p>\n<p>The following table gives an example of the attack-controlled account masquerading as another account as seen at this stage.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>user<\/strong><\/td>\n<td><strong>operation<\/strong><\/td>\n<td><strong>mailbox_owner<\/strong><\/td>\n<td><strong>subject<\/strong><\/td>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>SendAs<\/td>\n<td>TargetUser@example.com<\/td>\n<td>\u201cAccepted: [BANK NAME REDACTED] Passcode\u201d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>Figure 4: The attacker-controlled account is adjusted to masquerade as another user<\/em><\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip, mailbox_owner_upn, modified_properties, JSON_EXTRACT(item, '$.Subject') AS Subject, item  FROM xdr_identity_o365  WHERE lower(user_id)  IN (\u2018CompromisedAdmin@example.com', \u2018CompromisedAdmin@example.com\u2019)  AND operation IN ('SendAs', 'Create', 'Update')<\/pre>\n<h2>Email Collection:\u00a0Email Forwarding Rule (T1114.003)<\/h2>\n<h3>Transport Rules<\/h3>\n<p>In both cases, the threat actor implemented transport rules or edited existing rules. These transport rules follow names related to blocking suspicious activity such as \u201cBlock Spoofing\u201d or \u201c[REDACTED] Compromise.\u201d<\/p>\n<p>These rules were used to redirect emails containing certain headers related to \u201cadmin\u201d or \u201cOnlineBanking\u201d to the compromised user\u2019s mailbox.<\/p>\n<p>Other rules were added to delete the emails in these transport rules (Indicator Removal: Clear Mailbox Data \/ T1070.008) so that mail is forwarded to the compromised account and deleted from the user\u2019s mailbox instantaneously.<\/p>\n<p><strong>Exchange Operations:<\/strong> \u2018New-TransportRule\u2019, \u2018Set-TransportRule\u2019, \u2018Enable-TransportRule\u2019.<\/p>\n<h3>Transport Rule Example 1<\/h3>\n<p>This rule enabled the actor to control which emails would be delivered to a target user\u2019s mailbox by abusing the ModerateMessageByUser feature of Exchange Online.<\/p>\n<pre>[  \u00a0\u00a0\u00a0 {  \u00a0\"Name\": \"Name\",   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Value\": \"Block Phishing\"   \u00a0\u00a0 },   \u00a0\u00a0 {.            \"Name\": \"ModerateMessageByUser\",   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Value\": \"CompromisedAdmin@example.com\"  \u00a0\u00a0\u00a0 },     \u00a0\u00a0 {   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Name\": \"SubjectOrBodyContainsWords\",   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Value\": \"Exchange admin privilege;Global Administrator;AddMailboxPermission;Add Mailbox Permissions;Add-MailboxPermission;User at risk detected;Risky sign-in;Mailbox Permission Changed;High-severity alert;[REDACTED BANKING SUBJECT LINE]\"   \u00a0\u00a0 },   \u00a0\u00a0 {   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Name\": \"DeleteMessage\",   \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"Value\": \"False\"   \u00a0\u00a0 }  ]<\/pre>\n<h3>Transport Rule Example 2<\/h3>\n<p>This rule enabled the actor to delete emails with specific subject or body content to avoid raising suspicion of administrators and users of the target organization.<\/p>\n<pre>[  \t{  \t\t\"Name\": \"Name\",  \t\t\"Value\": \"Display name spoofing\"  \t},  \t{  \t\t\"Name\":\"SubjectOrBodyContainsWords\"  \t\t\"Value\":\"Exchange admin privilege;A user account has been created or modified;Suspicious Inbox Rule;AddMailboxPermission;Add Mailbox Permissions;Add-MailboxPermission;High-severity alert;InsightIDR Incident Alert;Granted mailbox permission;New-InboxRule;CompromisedAdmin@example.com \",  \t},  \t{  \t\t\"Name\":\"DeleteMessage\"  \t\t\"Value\":\"True\",  \t},  \t{  \t\t\"Name\":\"RedirectMessageTo\"  \t\t\"Value\":\"\",  \t},  \t{  \t\t\"Name\":\"ExceptIfFrom\"  \t\t\"Value\":\"\",  \t},  \t{  \t\t\"Name\":\"HeaderMatchesMessageHeader\"  \t\t\"Value\":\"\",  \t},  \t{  \t\t\"Name\":\"HeaderMatchesPatterns\"  \t\t\"Value\":\"\",  \t}  ]    <\/pre>\n<p>The following table provides a list of transport rule names observed at this stage, with some redactions to protect customer identity.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>object_id<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Block Spoofing<\/td>\n<\/tr>\n<tr>\n<td>Block Phishing<\/td>\n<\/tr>\n<tr>\n<td>Copy of WarnAuditHigh-RiskPhishingPatterns<\/td>\n<\/tr>\n<tr>\n<td>WarnAuditHigh-RiskPhishingPatterns<\/td>\n<\/tr>\n<tr>\n<td>[REDACTED \/\/ BANKING]<\/td>\n<\/tr>\n<tr>\n<td>Display name spoofing<\/td>\n<\/tr>\n<tr>\n<td>Bypass SPAM Filter<\/td>\n<\/tr>\n<tr>\n<td>[REDACTED] Compromise<\/td>\n<\/tr>\n<tr>\n<td>redirect [REDACTED] email to DC<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>Figure 5: A selection of indicators supporting the hunters\u2019 conclusion that this is T1114.003 in action<\/em><\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip, object_id, parameters  FROM xdr_identity_o365  WHERE lower(user_id)  IN (\u2018CompromisedAdmin@example.com', \u2018CompromisedAdmin@example.com\u2019)  AND operation LIKE '%Transport%'<\/pre>\n<h2>Defense Evasion: TA0005<\/h2>\n<h3>Impair Defenses: Disable or Modify Tools (T1562.001)<\/h3>\n<h3>TenantAllowBlockListSpoofItems<\/h3>\n<p>In both cases, the threat actor leveraged the Exchange Online function \u201cTenantAllowBlockListSpoofItems\u201d to add spoofed sender entries to the tenant allow list, enabling them to bypass spoofed sender rules and send emails to targets from spoofed domains.<\/p>\n<p>In one of the cases, the threat actor went a step further and added a few additional domains as well as an IP address to the Tenant Allow\/Block list:<\/p>\n<ul>\n<li>iad3a.emailsrvr[.]com<\/li>\n<li>continental-database[.]com<\/li>\n<li>&#8220;104.161.20[.]102&#8221;<\/li>\n<\/ul>\n<p>Note that the IP in this rule was used in both cases to log into compromised accounts.<\/p>\n<p><strong>Exchange Operation:<\/strong> \u2018New-TenantAllowBlockListSpoofItems\u2019.<\/p>\n<h3>TenantAllowBlockListSpoofItems Example<\/h3>\n<pre>[      {          \"Name\": \"Identity\"          \"Value\": \"default\",      },      {          \"Name\": \"SpoofType\"          \"Value\": \"External\",      },      {          \"Name\": \"Action\"          \"Value\": \"Allow\",      },      {          \"Name\": \"SpoofedUser\"          \"Value\": \"impersonated-email-account.com\",      },      {          \"Name\": \"SendingInfrastructure\"          \"Value\": \"botasso.cl\",      }  ]  <\/pre>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip, object_id, parameters  FROM xdr_identity_o365  WHERE lower(user_id)  IN (\u2018CompromisedAdmin@example.com', \u2018CompromisedAdmin@example.com\u2019)  AND operation LIKE '%Spoof%'<\/pre>\n<h3>Indicator Removal: Clear Mailbox Data (T1070.008)<\/h3>\n<h3>Email Deletion<\/h3>\n<p>Deletion of emails was used as a tactic in both cases. Some deletions occurred due to transport rules that the attacker added (Email Collection:\u00a0Email Forwarding Rule \/ T1114.003).<\/p>\n<p>Deleted emails can provide context into the purpose of the attack. In one of the cases, we observed emails created regarding passcodes (including for online banking), as well as deleted emails revealing that a passcode had been reset. Further activity was observed, such as \u201clockouts\u201d and \u201cpassword resets,\u201d making it clear the actor had likely compromised authentication for the targeted users.<\/p>\n<p>The actor also deleted emails that were received from Microsoft 365 Security, likely to prevent third-party security controls from notifying the victim of the threat.<\/p>\n<p><strong>Exchange Operations:<\/strong> \u2018MoveToDeletedItems\u2019, \u2018HardDelete\u2019, \u2018SoftDelete\u2019.<\/p>\n<p>The following table provides a list of email deletion rules observed at this stage, with some redactions to protect customer identity.<\/p>\n<table>\n<tbody>\n<tr>\n<th>User<\/th>\n<th>Operation<\/th>\n<th>Mailbox Owner<\/th>\n<th>Subject<\/th>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>MoveToDeletedItems<\/td>\n<td>TargetUser@example.com<\/td>\n<td>\u201cMicrosoft 365 security: You have messages in quarantine\u201d<\/td>\n<\/tr>\n<tr>\n<td>CompromisedAdmin@example.com<\/td>\n<td>HardDelete<\/td>\n<td>TargetUser@example.com<\/td>\n<td>\u201cReset your Online Banking password\u201d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><em>Figure 6: Manipulating the rules to re-route emails that might potentially alert the targeted user to the attacker\u2019s presence<\/em><\/p>\n<h3>Sophos XDR Query<\/h3>\n<pre>SELECT creation_time, user_id, operation, client_ip, mailbox_owner_upn,    JSON_EXTRACT(affected_items, '$[0].Subject') AS Subject, affected_items  FROM xdr_identity_o365  WHERE lower(user_id)  IN (\u2018CompromisedAdmin@example.com', \u2018CompromisedAdmin@example.com\u2019)  AND operation IN ('MoveToDeletedItems', 'HardDelete', 'SoftDelete')<\/pre>\n<h2>Recommendations<\/h2>\n<p>There are many options available to combat email account compromises such as the two discussed here. Your best choice will depend upon your business operations, cost, risk model, and requirements.<\/p>\n<p>We\u2019ll put forth some basic suggestions here. However, we strongly recommend prevention and detection mechanisms, tailored to your environment and based on the tactics and techniques detailed in this article (i.e. XDR detections and regular threat hunts).<\/p>\n<ol>\n<li>Enable MFA for privileged users (or all users, if possible).<\/li>\n<li>Regularly conduct audits of user account creations and administrator accounts.<\/li>\n<li>Allowlist IPs of an approved range for authentication (e.g., your VPN subnet) and block non-approved ranges.<\/li>\n<li>Purchase extended data retention for your XDR product to maintain logging past the default 90-day retention period (or consider event forwarding \/ logging solutions).<\/li>\n<\/ol>\n<h2>Indicators of Compromise (IOCs)<\/h2>\n<p>A list of indicators of compromise associated with this investigation is available on our GitHub.<\/p>\n<p>All the ATT&amp;CK techniques and sub-techniques discussed above are documented on MITRE\u2019s site. Links to each description are provided below for reader convenience.<\/p>\n<ul>\n<li><a href=\"https:\/\/attack.mitre.org\/tactics\/TA0001\/\">Initial Access: TA0001<\/a>\n<ul>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1078\/004\/\">Valid Accounts: Cloud Accounts (T1078.004)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/tactics\/TA0003\/\">Persistence: TA0003<\/a>\n<ul>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1136\/003\/\">Create Account: Cloud Account (T1136.003)<\/a><\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1098\/\">Account Manipulation (T1098)<\/a><\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1098\/002\/\">Account Manipulation: Additional Email Delegate Permissions (T1098.002)<\/a><\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1098\/003\/\">Account Manipulation: Additional Cloud Roles (T1098.003)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/tactics\/TA0009\/\">Collection: TA0009<\/a>\n<ul>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1114\/002\/\">Email Collection: Remote Email Collection (T1114.002)<\/a><\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1114\/003\/\">Email Collection: Email Forwarding Rule (T1114.003)<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/tactics\/TA0005\/\">Defense Evasion: TA0005<\/a>\n<ul>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1562\/001\/\">Impair Defenses: Disable or Modify Tools (T1562.001)<\/a><\/li>\n<li><a href=\"https:\/\/attack.mitre.org\/techniques\/T1070\/008\/\">Indicator Removal: Clear Mailbox Data (T1070.008)<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>Acknowledgements<\/h4>\n<p>Imane Ismail was instrumental in the investigation of these cases.<\/p>\n<p>&nbsp;<\/p>\n<\/p><\/div>\n<p><a href=\"https:\/\/news.sophos.com\/en-us\/2023\/06\/30\/investigator-api-yourself-deploying-microsoft-graph-on-the-trail-of-an-attacker\/\" target=\"bwo\" >http:\/\/feeds.feedburner.com\/sophos\/dgdY<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2023\/06\/shutterstock_1936864873-e1688147919897.jpg\"\/><\/p>\n<p><strong>Credit to Author: gallagherseanm| Date: Fri, 30 Jun 2023 17:47:14 +0000<\/strong><\/p>\n<p>Two clients, two threat hunts \u2013 any connection? Using Microsoft\u2019s cloud-security API to parse piles of disparate data leads to fascinating findings<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10378,10377],"tags":[29684,129,25085,25038,21481,29685,17374,24552,16771],"class_list":["post-22353","post","type-post","status-publish","format-standard","hentry","category-security","category-sophos","tag-email-compromise","tag-featured","tag-human-led-threat-hunting","tag-mdr","tag-microsoft-365","tag-microsoft-graph","tag-office-365","tag-security-operations","tag-threat-research"],"_links":{"self":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/22353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=22353"}],"version-history":[{"count":0,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/22353\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=22353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=22353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=22353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}