Detect Trusted Relationship in IBM QRadar
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/
QRadar Detection Query
SELECT
DATEFORMAT(devicetime, 'yyyy-MM-dd HH:mm:ss') AS event_time,
QIDNAME(qid) AS event_name,
username,
sourceip,
LOGSOURCENAME(logsourceid) AS log_source,
CATEGORYNAME(category) AS log_category,
'TrustedRelationshipAbuse' AS detection_category,
payload
FROM events
WHERE devicetime > NOW() - 86400000
AND (
-- Arm 1: O365 delegated admin and partner configuration events
(
LOGSOURCETYPEID(devicetype) = 397
AND LOWER(QIDNAME(qid)) 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'
)
)
OR
-- Arm 2: O365 external user (UserType=4) logon events
(
LOGSOURCETYPEID(devicetype) = 397
AND LOWER(QIDNAME(qid)) IN ('userloggedin', 'userloginfailed')
AND TEXT(payload) LIKE '%"UserType":4%'
)
OR
-- Arm 3: Windows network logon from external IP by service/admin-named account
(
LOGSOURCETYPEID(devicetype) = 12
AND qid = 4624
AND TEXT(payload) LIKE '%LogonType=3%'
AND NOT (
sourceip STARTSWITH '10.' OR
sourceip STARTSWITH '192.168.' OR
sourceip STARTSWITH '172.16.' OR sourceip STARTSWITH '172.17.' OR
sourceip STARTSWITH '172.18.' OR sourceip STARTSWITH '172.19.' OR
sourceip STARTSWITH '172.20.' OR sourceip STARTSWITH '172.21.' OR
sourceip STARTSWITH '172.22.' OR sourceip STARTSWITH '172.23.' OR
sourceip STARTSWITH '172.24.' OR sourceip STARTSWITH '172.25.' OR
sourceip STARTSWITH '172.26.' OR sourceip STARTSWITH '172.27.' OR
sourceip STARTSWITH '172.28.' OR sourceip STARTSWITH '172.29.' OR
sourceip STARTSWITH '172.30.' OR sourceip STARTSWITH '172.31.' OR
sourceip = '127.0.0.1' OR sourceip = '::1'
)
AND (
LOWER(username) LIKE '%svc%' OR LOWER(username) LIKE '%admin%' OR
LOWER(username) LIKE '%msp%' OR LOWER(username) LIKE '%vendor%' OR
LOWER(username) LIKE '%partner%' OR LOWER(username) LIKE '%mgmt%' OR
LOWER(username) LIKE '%managed%'
)
)
)
ORDER BY devicetime DESC QRadar AQL query detecting T1199 Trusted Relationship abuse across three log source arms: Microsoft Office 365 DSM (LOGSOURCETYPEID 397) for delegated admin grant and partner configuration events, O365 external UserType=4 logon events, and Windows Security Event Log DSM (LOGSOURCETYPEID 12) for EventID 4624 LogonType 3 network logons from external IPs using service provider account naming patterns. Covers MSP compromise, delegated admin relationship establishment, and external service account lateral movement visible on Windows endpoints.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate partner onboarding events where the IT department creates new delegated admin relationships with contracted MSPs or cloud migration consultants through an approved IAM process
- Service accounts used by cloud-hosted monitoring, backup, or SIEM forwarders (e.g., Azure-based Sentinel connectors) that authenticate from non-RFC1918 IPs classified by QRadar as external
- External auditors or penetration testers granted temporary guest access to Office 365 generating UserType=4 logon events during authorized assessment engagements
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.