O365 Service Principal New Client Credentials

Original Source: [splunk source]
Name:O365 Service Principal New Client Credentials
id:a1b229e9-d962-4222-8c62-905a8a010453
version:4
date:2024-09-30
author:Mauricio Velazco, Splunk
status:production
type:TTP
Description:The following analytic detects the addition of new credentials for Service Principals within an Office 365 tenant. It uses O365 audit logs, focusing on events related to credential modifications or additions in the AzureActiveDirectory workload. This activity is significant because Service Principals represent application identities, and their credentials allow applications to authenticate and access resources. If an attacker successfully adds or modifies these credentials, they can impersonate the application, leading to unauthorized data access, data exfiltration, or malicious operations under the application's identity.
Data_source:
  • -O365
search:`o365_management_activity` Workload=AzureActiveDirectory Operation="Update application*Certificates and secrets management "
| stats earliest(_time) as firstTime latest(_time) as lastTime by user ModifiedProperties{}.NewValue object ObjectId
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `o365_service_principal_new_client_credentials_filter`


how_to_implement:You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events.
known_false_positives:Service Principal client credential modifications may be part of legitimate administrative operations. Filter as needed.
References:
  -https://attack.mitre.org/techniques/T1098/001/
  -https://www.mandiant.com/resources/blog/remediation-and-hardening-strategies-for-microsoft-365-to-defend-against-unc2452
  -https://microsoft.github.io/Azure-Threat-Research-Matrix/Persistence/AZT501/AZT501-2/
  -https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Cloud%20-%20Azure%20Pentest.md#add-credentials-to-all-enterprise-applications
drilldown_searches:
name:'View the detection results for - "$object$"'
search:'%original_detection_search% | search object = "$object$"'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
name:'View risk events for the last 7 days for - "$object$"'
search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$object$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Office 365 Persistence Mechanisms'
    - 'NOBELIUM Group'
  asset_type:O365 Tenant
  confidence:50
  impact:70
  message:New credentials added for Service Principal $object$
  mitre_attack_id:
    - 'T1098'
    - 'T1098.001'
  observable:
    name:'object'
    type:'User'
    - role:
      - 'Victim'
    name:'user'
    type:'User'
    - role:
      - 'Attacker'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  risk_score:35
  required_fields:
    - '_time'
    - 'Workload'
    - 'Operation'
    - 'object'
    - 'user'
  security_domain:identity

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1098.001/o365_service_principal_credentials/o365_service_principal_credentials.log
  sourcetype: o365:management:activity
  source: o365
manual_test:None