Detect Reversible Encryption in Google Chronicle
Adversaries may enable the AllowReversiblePasswordEncryption property on Active Directory user accounts to gain access to plaintext credentials. When enabled, Active Directory stores user passwords in a reversibly encrypted form (G$RADIUSCHAP in userParameters) rather than as one-way hashes. An adversary with SYSTEM access can decrypt these passwords using four components from AD user structures and LSA secrets. Adversaries can set this via PowerShell (Set-ADUser -AllowReversiblePasswordEncryption $true), Local Group Policy, or Fine-Grained Password Policy (FGPP) if Domain Functional Level is Windows Server 2008+.
MITRE ATT&CK
- Technique
- T1556 Modify Authentication Process
- Sub-technique
- T1556.005 Reversible Encryption
- Canonical reference
- https://attack.mitre.org/techniques/T1556/005/
YARA-L Detection Query
rule t1556_005_reversible_encryption_ad {
meta:
author = "Detection Engineering"
description = "Detects enabling of AllowReversiblePasswordEncryption on AD accounts via Security Event 4738 or PowerShell AD cmdlets — T1556.005"
mitre_attack_tactic = "Credential Access"
mitre_attack_technique = "T1556.005"
severity = "HIGH"
confidence = "HIGH"
events:
(
// Branch 1: Windows Security Event 4738 with reversible encryption UAC flag
$e1.metadata.event_type = "USER_CHANGE"
and $e1.metadata.product_event_type = "4738"
and (
re.regex($e1.target.resource.attribute.labels["UserAccountControl"], `(?i)ENCRYPTED_TEXT_PASSWORD_ALLOWED`)
or re.regex($e1.metadata.description, `%%2054`)
or re.regex($e1.metadata.description, `(?i)ENCRYPTED_TEXT_PASSWORD_ALLOWED`)
)
)
or
(
// Branch 2: PowerShell process invoking AD reversible encryption cmdlets
$e1.metadata.event_type = "PROCESS_LAUNCH"
and (
re.regex($e1.principal.process.file.full_path, `(?i)(powershell|pwsh)\.exe$`)
or re.regex($e1.target.process.file.full_path, `(?i)(powershell|pwsh)\.exe$`)
)
and re.regex($e1.target.process.command_line, `(?i)(AllowReversiblePasswordEncryption|ENCRYPTED_TEXT_PASSWORD_ALLOWED|Set-ADDefaultDomainPasswordPolicy|New-ADFineGrainedPasswordPolicy)`)
and re.regex($e1.target.process.command_line, `(?i)(\$true|\btrue\b|\s1\s|enable)`)
)
condition:
$e1
} Chronicle YARA-L 2.0 rule detecting reversible password encryption configuration changes in Active Directory. Covers both Security Event 4738 with ENCRYPTED_TEXT_PASSWORD_ALLOWED UserAccountControl flag and PowerShell-based enablement via Set-ADUser, Set-ADDefaultDomainPasswordPolicy, or New-ADFineGrainedPasswordPolicy cmdlets.
Data Sources
Required Tables
False Positives & Tuning
- RADIUS/NPS infrastructure changes where administrators intentionally enable reversible encryption to support legacy MS-CHAPv2 VPN or 802.1x wireless authentication
- Domain administrator scripts that configure Fine-Grained Password Policies (FGPP) for specific OUs where reversible encryption is a documented business requirement
- Privileged Access Workstation (PAW) configuration automation that evaluates and reports AllowReversiblePasswordEncryption states across all domain accounts
Other platforms for T1556.005
Testing Methodology
Validate this detection against 3 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 1Enable Reversible Password Encryption on a Test Account
Expected signal: Security Event ID 4738: User Account Changed for testuser_atomic, with UserAccountControl value showing ENCRYPTED_TEXT_PASSWORD_ALLOWED. PowerShell ScriptBlock Log Event ID 4104 with the Set-ADUser command. Sysmon Event ID 1 for powershell.exe with AllowReversiblePasswordEncryption in CommandLine.
- Test 2Audit Accounts with Reversible Encryption Enabled
Expected signal: PowerShell ScriptBlock Log Event ID 4104 with the Get-ADUser filter query. Active Directory query events. Security Event ID 4662 for directory object access on enumerated user objects.
- Test 3Set Reversible Encryption via Fine-Grained Password Policy
Expected signal: Security Event ID 4738/5136 (DS Object Modified): Fine-Grained Password Policy object creation with msDS-PasswordReversibleEncryptionEnabled attribute set. PowerShell ScriptBlock Log Event ID 4104 with New-ADFineGrainedPasswordPolicy.
References (5)
- https://attack.mitre.org/techniques/T1556/005/
- https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/store-passwords-using-reversible-encryption
- https://adsecurity.org/?p=2053
- http://blog.teusink.net/2009/08/passwords-stored-using-reversible.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1556.005/T1556.005.md
Unlock Pro Content
Get the full detection package for T1556.005 including response playbook, investigation guide, and atomic red team tests.