Detect Trusted Relationship in Elastic Security
Adversaries may breach or otherwise leverage organizations who have access to intended victims. Access through trusted third-party relationships abuses an existing connection that may not be protected or receives less scrutiny than standard mechanisms of gaining access to a network. Organizations often grant elevated access to second or third-party external providers in order to allow them to manage internal systems as well as cloud-based environments. These relationships include IT services contractors, managed security providers, and infrastructure contractors. In Office 365 and Azure AD environments, organizations may grant Microsoft partners or resellers delegated administrator permissions. By compromising a partner or reseller account, an adversary may be able to leverage existing delegated administrator relationships or send new delegated administrator offers to clients in order to gain administrative control over the victim tenant.
MITRE ATT&CK
- Tactic
- Initial Access
- Technique
- T1199 Trusted Relationship
- Canonical reference
- https://attack.mitre.org/techniques/T1199/
Elastic Detection Query
any where
(
event.dataset == "azure.auditlogs" and
azure.auditlogs.operation_name in~ (
"Add delegated permission grant",
"Add partner to cross-tenant access setting",
"Add policy to cross-tenant access setting",
"Set partner information",
"Add member to role",
"Add app role assignment to service principal",
"Add service principal"
) and
azure.auditlogs.result == "success"
) or
(
event.dataset == "azure.signinlogs" and
azure.signinlogs.properties.cross_tenant_access_type != "none" and
azure.signinlogs.properties.cross_tenant_access_type != null and
azure.signinlogs.properties.resource_display_name : ("*Exchange*", "*SharePoint*", "*Teams*", "*Security*", "*Compliance*", "*Graph*") and
event.outcome == "success"
) or
(
event.category == "authentication" and
event.action == "logged-in" and
winlog.event_id == 4624 and
winlog.event_data.LogonType == "3" and
not source.ip : (
"10.*", "172.16.*", "172.17.*", "172.18.*", "172.19.*",
"172.20.*", "172.21.*", "172.22.*", "172.23.*", "172.24.*",
"172.25.*", "172.26.*", "172.27.*", "172.28.*", "172.29.*",
"172.30.*", "172.31.*", "192.168.*", "127.*", "::1"
) and
user.name : ("*svc_*", "*_svc*", "*admin*", "*mgmt*", "*msp*", "*vendor*", "*partner*", "*managed*")
) Detects T1199 Trusted Relationship abuse across three vectors: (1) Azure AD audit events for delegated admin grant operations and cross-tenant access policy modifications, (2) Azure AD sign-in logs showing cross-tenant authentication to privileged Microsoft 365 workloads (Exchange, SharePoint, Teams, Graph), and (3) Windows Security Event 4624 LogonType 3 network logons from external IPs by accounts matching service provider naming patterns. Requires the Elastic Azure integration and Windows Security log forwarding.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate MSP or IT outsourcing partners being formally onboarded — delegated admin grant events fire during standard third-party provisioning workflows approved via change management
- Scheduled automation or RPA service accounts performing network logons from cloud-hosted infrastructure (Azure Automation, GitHub Actions runners) with public IPs not in RFC1918 space
- Corporate mergers or acquisitions where cross-tenant access is intentionally configured to allow Azure AD tenant integration, and authorized B2B guests access shared resources like SharePoint or Teams
Other platforms for T1199
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Simulate Delegated Admin Permission Grant via Azure AD PowerShell
Expected signal: Azure AD AuditLogs: OperationName 'Add delegated permission grant', Result 'success', InitiatedBy.user.userPrincipalName = executing account, TargetResources[0].displayName = 'Microsoft Graph'. Visible in Microsoft 365 compliance portal under Audit search with Activity = 'Add delegated permission grant'.
- Test 2Assign Privileged Role to External Guest Account Simulating MSP Onboarding
Expected signal: Azure AD AuditLogs: OperationName 'Add member to role', Result 'success', TargetResources[1].displayName = 'Global Reader', TargetResources[0].userPrincipalName contains '#EXT#'. Also generates 'Invite external user' event. Both visible in AuditLogs table within 5-10 minutes.
- Test 3Simulate MSP Network Logon from External IP Using Service Account
Expected signal: Windows Security Event ID 4624: LogonType=3 (Network), TargetUserName='svc_msp_test', SourceNetworkAddress=127.0.0.1. Security Event ID 4672 if the account has elevated privileges. Visible in Windows Event Viewer under Security log within seconds of execution.
- Test 4Create New Service Principal and Grant API Permissions Simulating Post-Access Backdoor
Expected signal: Azure AD AuditLogs: OperationName 'Add application', Result 'success', TargetResources[0].displayName = 'df00tech-detection-test-app'. Followed by OperationName 'Update application' with ModifiedProperties showing RequiredResourceAccess including Mail.Read scope. Both events include InitiatedBy.user.userPrincipalName of the executing account.
References (9)
- https://attack.mitre.org/techniques/T1199/
- https://us-cert.cisa.gov/APTs-Targeting-IT-Service-Provider-Customers
- https://support.microsoft.com/en-us/topic/partners-offer-delegated-administration-26530dc0-ebba-415b-86b1-b55bc06b073e
- https://www.microsoft.com/security/blog/2021/10/25/nobelium-targeting-delegated-administrative-privileges-to-facilitate-broader-attacks/
- https://www.pwc.co.uk/cyber-security/pdf/cloud-hopper-annex-b-final.pdf
- https://www.secureworks.com/research/revil-sodinokibi-ransomware
- https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/reference-audit-activities
- https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/security-operations-privileged-accounts
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1199/T1199.md
Unlock Pro Content
Get the full detection package for T1199 including response playbook, investigation guide, and atomic red team tests.