Access to a Sensitive LDAP Attribute

Identify access to sensitive Active Directory object attributes that contains credentials and decryption keys such as unixUserPassword, ms-PKI-AccountCredentials and msPKI-CredentialRoamingTokens.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2022/11/09"
 3integration = ["system", "windows"]
 4maturity = "production"
 5updated_date = "2025/01/22"
 6min_stack_version = "8.14.0"
 7min_stack_comments = "Breaking change at 8.14.0 for the Windows Integration."
 8
 9[rule]
10author = ["Elastic"]
11description = """
12Identify access to sensitive Active Directory object attributes that contains credentials and decryption keys such as
13unixUserPassword, ms-PKI-AccountCredentials and msPKI-CredentialRoamingTokens.
14"""
15from = "now-9m"
16index = ["winlogbeat-*", "logs-system.*", "logs-windows.*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Access to a Sensitive LDAP Attribute"
20references = [
21    "https://www.mandiant.com/resources/blog/apt29-windows-credential-roaming",
22    "https://social.technet.microsoft.com/wiki/contents/articles/11483.windows-credential-roaming.aspx",
23    "https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4662",
24]
25risk_score = 47
26rule_id = "764c9fcd-4c4c-41e6-a0c7-d6c46c2eff66"
27setup = """## Setup
28
29The 'Audit Directory Service Access' logging policy must be configured for (Success, Failure).
30Steps to implement the logging policy with Advanced Audit Configuration:

Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policies Configuration > Audit Policies > DS Access > Audit Directory Service Access (Success,Failure)

  1"""
  2severity = "medium"
  3tags = [
  4    "Domain: Endpoint",
  5    "OS: Windows",
  6    "Use Case: Threat Detection",
  7    "Tactic: Credential Access",
  8    "Tactic: Privilege Escalation",
  9    "Use Case: Active Directory Monitoring",
 10    "Data Source: Active Directory",
 11    "Data Source: System",
 12    "Resources: Investigation Guide",
 13]
 14timestamp_override = "event.ingested"
 15type = "eql"
 16
 17query = '''
 18any where event.code == "4662" and
 19
 20  not winlog.event_data.SubjectUserSid : "S-1-5-18" and
 21
 22  winlog.event_data.Properties : (
 23   /* unixUserPassword */
 24  "*612cb747-c0e8-4f92-9221-fdd5f15b550d*",
 25
 26  /* ms-PKI-AccountCredentials */
 27  "*b8dfa744-31dc-4ef1-ac7c-84baf7ef9da7*",
 28
 29  /*  ms-PKI-DPAPIMasterKeys */
 30  "*b3f93023-9239-4f7c-b99c-6745d87adbc2*",
 31
 32  /* msPKI-CredentialRoamingTokens */
 33  "*b7ff5a38-0818-42b0-8110-d3d154c97f24*"
 34  ) and
 35
 36  /*
 37   Excluding noisy AccessMasks
 38   0x0 undefined and 0x100 Control Access
 39   https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4662
 40   */
 41  not winlog.event_data.AccessMask in ("0x0", "0x100")
 42'''
 43note = """## Triage and analysis
 44
 45> **Disclaimer**:
 46> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
 47
 48### Investigating Access to a Sensitive LDAP Attribute
 49
 50LDAP (Lightweight Directory Access Protocol) is crucial for accessing and managing directory information in Active Directory environments. Adversaries may exploit LDAP to access sensitive attributes like passwords and decryption keys, facilitating credential theft or privilege escalation. The detection rule identifies unauthorized access attempts by monitoring specific event codes and attribute identifiers, excluding benign activities to reduce noise, thus highlighting potential security threats.
 51
 52### Possible investigation steps
 53
 54- Review the event logs for event code 4662 to identify the specific user or process attempting to access the sensitive LDAP attributes.
 55- Check the winlog.event_data.SubjectUserSid to determine the identity of the user or service account involved in the access attempt, excluding the well-known SID S-1-5-18 (Local System).
 56- Analyze the winlog.event_data.Properties field to confirm which sensitive attribute was accessed, such as unixUserPassword, ms-PKI-AccountCredentials, or msPKI-CredentialRoamingTokens.
 57- Investigate the context of the access attempt by correlating the event with other logs or alerts around the same timestamp to identify any suspicious patterns or activities.
 58- Verify the legitimacy of the access by checking if the user or process has a valid reason or permission to access the sensitive attributes, considering the organization's access control policies.
 59- Assess the potential impact of the access attempt on the organization's security posture, focusing on credential theft or privilege escalation risks.
 60- Document findings and, if necessary, escalate the incident to the appropriate security team for further action or remediation.
 61
 62### False positive analysis
 63
 64- Access by legitimate administrative accounts: Regular access by system administrators to sensitive LDAP attributes can trigger alerts. To manage this, create exceptions for known administrative accounts by excluding their SIDs from the detection rule.
 65- Scheduled system processes: Automated tasks or system processes that require access to certain LDAP attributes may cause false positives. Identify these processes and exclude their specific event codes or AccessMasks if they are consistently benign.
 66- Service accounts: Service accounts that perform routine directory operations might access sensitive attributes as part of their normal function. Exclude these accounts by adding their SIDs to the exception list to prevent unnecessary alerts.
 67- Monitoring tools: Security or monitoring tools that scan directory attributes for compliance or auditing purposes can generate false positives. Whitelist these tools by excluding their event sources or specific actions from the detection criteria.
 68
 69### Response and remediation
 70
 71- Immediately isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
 72- Conduct a thorough review of the access logs to identify any unauthorized users or systems that accessed the sensitive LDAP attributes.
 73- Reset passwords and revoke any potentially compromised credentials associated with the affected accounts, focusing on those with access to sensitive attributes.
 74- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine the scope of the breach.
 75- Implement additional monitoring on the affected systems and accounts to detect any further suspicious activities or attempts to access sensitive LDAP attributes.
 76- Review and update access controls and permissions for sensitive LDAP attributes to ensure they are restricted to only necessary personnel.
 77- Conduct a post-incident analysis to identify any gaps in security controls and update policies or procedures to prevent similar incidents in the future."""
 78
 79
 80[[rule.threat]]
 81framework = "MITRE ATT&CK"
 82[[rule.threat.technique]]
 83id = "T1003"
 84name = "OS Credential Dumping"
 85reference = "https://attack.mitre.org/techniques/T1003/"
 86
 87[[rule.threat.technique]]
 88id = "T1552"
 89name = "Unsecured Credentials"
 90reference = "https://attack.mitre.org/techniques/T1552/"
 91[[rule.threat.technique.subtechnique]]
 92id = "T1552.004"
 93name = "Private Keys"
 94reference = "https://attack.mitre.org/techniques/T1552/004/"
 95
 96
 97
 98[rule.threat.tactic]
 99id = "TA0006"
100name = "Credential Access"
101reference = "https://attack.mitre.org/tactics/TA0006/"
102[[rule.threat]]
103framework = "MITRE ATT&CK"
104[[rule.threat.technique]]
105id = "T1078"
106name = "Valid Accounts"
107reference = "https://attack.mitre.org/techniques/T1078/"
108[[rule.threat.technique.subtechnique]]
109id = "T1078.002"
110name = "Domain Accounts"
111reference = "https://attack.mitre.org/techniques/T1078/002/"
112
113
114
115[rule.threat.tactic]
116id = "TA0004"
117name = "Privilege Escalation"
118reference = "https://attack.mitre.org/tactics/TA0004/"

Triage and analysis

Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

Investigating Access to a Sensitive LDAP Attribute

LDAP (Lightweight Directory Access Protocol) is crucial for accessing and managing directory information in Active Directory environments. Adversaries may exploit LDAP to access sensitive attributes like passwords and decryption keys, facilitating credential theft or privilege escalation. The detection rule identifies unauthorized access attempts by monitoring specific event codes and attribute identifiers, excluding benign activities to reduce noise, thus highlighting potential security threats.

Possible investigation steps

  • Review the event logs for event code 4662 to identify the specific user or process attempting to access the sensitive LDAP attributes.
  • Check the winlog.event_data.SubjectUserSid to determine the identity of the user or service account involved in the access attempt, excluding the well-known SID S-1-5-18 (Local System).
  • Analyze the winlog.event_data.Properties field to confirm which sensitive attribute was accessed, such as unixUserPassword, ms-PKI-AccountCredentials, or msPKI-CredentialRoamingTokens.
  • Investigate the context of the access attempt by correlating the event with other logs or alerts around the same timestamp to identify any suspicious patterns or activities.
  • Verify the legitimacy of the access by checking if the user or process has a valid reason or permission to access the sensitive attributes, considering the organization's access control policies.
  • Assess the potential impact of the access attempt on the organization's security posture, focusing on credential theft or privilege escalation risks.
  • Document findings and, if necessary, escalate the incident to the appropriate security team for further action or remediation.

False positive analysis

  • Access by legitimate administrative accounts: Regular access by system administrators to sensitive LDAP attributes can trigger alerts. To manage this, create exceptions for known administrative accounts by excluding their SIDs from the detection rule.
  • Scheduled system processes: Automated tasks or system processes that require access to certain LDAP attributes may cause false positives. Identify these processes and exclude their specific event codes or AccessMasks if they are consistently benign.
  • Service accounts: Service accounts that perform routine directory operations might access sensitive attributes as part of their normal function. Exclude these accounts by adding their SIDs to the exception list to prevent unnecessary alerts.
  • Monitoring tools: Security or monitoring tools that scan directory attributes for compliance or auditing purposes can generate false positives. Whitelist these tools by excluding their event sources or specific actions from the detection criteria.

Response and remediation

  • Immediately isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
  • Conduct a thorough review of the access logs to identify any unauthorized users or systems that accessed the sensitive LDAP attributes.
  • Reset passwords and revoke any potentially compromised credentials associated with the affected accounts, focusing on those with access to sensitive attributes.
  • Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine the scope of the breach.
  • Implement additional monitoring on the affected systems and accounts to detect any further suspicious activities or attempts to access sensitive LDAP attributes.
  • Review and update access controls and permissions for sensitive LDAP attributes to ensure they are restricted to only necessary personnel.
  • Conduct a post-incident analysis to identify any gaps in security controls and update policies or procedures to prevent similar incidents in the future.

References

Related rules

to-top