MITRE ATT&CK Technique: T1552.004 (Unsecured Credentials: Private Keys)
CVE: N/A (Logical vulnerability)
Platforms: Entra ID, Windows Server, Enterprise Cloud Infrastructure
Severity: CRITICAL
Viability: ACTIVE
| Author | SERVTEP – Artur Pchelnikau |
TPM (Trusted Platform Module) key extraction is a critical credential access attack that compromises cryptographic keys protected by the TPM, enabling attackers to impersonate devices, forge authentication tokens, and decrypt sensitive data in hybrid cloud environments. Threat actors who extract TPM-sealed keys, device authentication certificates, or service principal credentials can bypass multi-factor authentication, circumvent Conditional Access policies, and maintain persistent access across on-premises and cloud infrastructure. The Storm-0501 incident (August 2025) demonstrated real-world exploitation of hybrid environments lacking TPM protection on Entra Connect Sync servers, enabling account takeover of privileged identities. This module covers detection, response, and mitigation strategies specific to Entra ID hybrid deployments and Windows security infrastructure.
Stage 1: Reconnaissance & Access Acquisition
Stage 2: TPM Key Extraction
Stage 3: Token Forging & Impersonation
Stage 4: Lateral Movement & Persistence
Timeline:
Attack Characteristics:
Microsoft’s Response:
| Component | Function | Protection Level | Extractability |
|---|---|---|---|
| Storage Root Key (SRK) | Primary wrapping key in TPM | Hardware-protected | Non-exportable |
| Endorsement Key (EK) | RSA key pair for attestation | Hardware-protected | Non-exportable |
| Platform Configuration Registers (PCRs) | Hash values of boot components (0-7 measured, 8-15 app-controlled) | Hardware-protected | Readable but tamper-obvious |
| Sealed Keys | Keys bound to specific PCR values | Hardware-protected + firmware measurement | Unseals only if PCRs match |
| Device Keys | Keys for Entra ID device authentication | TPM-protected if TPM available, else software | Hardware: non-exportable, Software: extracted via CNG |
| Service Principal Certificates | OAuth2 certificates in CNG KSP | Software-based encryption (DPAPI) | DPAPI decryptable with system privileges |
Sealing Process (During Boot):
Unsealing Process (Normal Boot):
Attack Scenario (Rootkit/Bootkit):
Attack Vector 1: Entra Connect Sync Credential Extraction
Tool: AADInternals PowerShell Module v0.9.4
# Attacker gains local admin on Entra Connect server
$SyncCredentials = Get-AADIntSyncCredentials
# Decrypts DPAPI-encrypted Entra Connector Account password
# Result: Plaintext credentials for cloud admin account
Extraction Points:
Attack Vector 2: TPM PCR Bypass (Boot-Level)
Method: PCR Reset via Firmware/Sleep Mode
# Attacker with physical access or UEFI backdoor
# Option 1: Reset TPM via UEFI
tpm2_startup --clear
# Option 2: Manipulate PCR values via S3 sleep exploitation
# Reboot into custom OS, record PCR extensions
# S3 sleep state leaves some PCRs unmeasured
# On resume, extend PCRs to expected values
# TPM unseals key with fake measurement
# Option 3: Direct TPM power glitching
# Briefly disconnect TPM power, restart with reset values
# Requires hardware equipment (~$200 budget)
Impact: Bypass of BitLocker/MIP encryption without knowing encryption key
Attack Vector 3: Device Key Export (Hybrid-Joined Device)
# Attacker with RDP access to Entra ID-joined device
# Query CNG (Cryptography API: Next Generation) for device keys
$KeyStore = Get-Item "HKLM:\Software\Microsoft\Cryptography\Calais"
# Device transport key + device authentication key accessible
# Export via CNG provider (if permissions allow)
Impact: Impersonate device to Entra ID, bypass device compliance checks
Attack Vector 4: Service Principal Certificate Extraction
# Attacker with local admin on server running Azure AD Connect
# Access service principal certificates from registry/files
$CertPath = "C:\ProgramData\Microsoft\Crypto\RSA\S-1-5-18"
# DPAPI-encrypted certificate material
# Decrypt using SYSTEM privileges
$Cert = Get-Item $CertPath -Force
# Use extracted certificate to forge tokens
$Token = New-SignedJWT -Certificate $Cert -Claim {...}
Impact: Forge Azure AD access tokens, impersonate service principal
Technique: T1552.004 - Unsecured Credentials: Private Keys
Tactics Executed:
Sub-techniques Associated:
Related Techniques:
| Tool | Purpose | Viability Status | Download URL |
|---|---|---|---|
| AADInternals | Entra Connect credential dumping | ACTIVE | https://github.com/Gerenios/AADInternals |
| Chipsec | TPM and firmware analysis | ACTIVE | https://github.com/chipsec/chipsec |
| tpm2-tools | TPM 2.0 command-line interface | ACTIVE | https://github.com/tpm2-software/tpm2-tools |
| Mimikatz CRYPTO | Certificate extraction from CNG | ACTIVE | https://github.com/gentilkiwi/mimikatz |
| Impacket GetNPUsers | Kerberos preauthentication bypass | ACTIVE | https://github.com/fortra/impacket |
| WinPwn | Sensitive file discovery & credential harvesting | ACTIVE | https://github.com/S3cur3Th1sSh1t/WinPwn |
| adconnectdump | Extract credentials from AD Connect database | ACTIVE | https://github.com/fox-it/adconnectdump |
| Infineon TPM Tools | TPM manufacturer-specific tools | ACTIVE | Manufacturer support portals |
Supported Platforms: Windows, Linux, macOS
| Test Name | Command | Executor | Detection Trigger |
|---|---|---|---|
| Find private SSH keys | find / -name "id_rsa" -o -name "id_dsa" |
bash/sh | File enumeration process |
| Export PKCS12 certificate | openssl pkcs12 -export -in cert.pem -inkey key.pem |
bash | Child process + file write |
| Enumerate Windows certs | Get-ChildItem Cert:\LocalMachine\My |
PowerShell | Certificate store access |
| Extract device keys (Windows) | certutil -store MY |
cmd.exe | Certificate enumeration |
| LSASS memory dump (Mimikatz) | mimikatz.exe "crypto::certificates /export" |
cmd.exe | Credential dumping detection |
| TPM key extraction (tpm2-tools) | tpm2_readpublic -c 0x81000001 |
bash | TPM command execution |
| Extract from AD Connect database | adconnectdump.py |
python3 | Database query + file access |
Execution Example:
# Atomic test execution
Invoke-AtomicTest T1552.004 -TestName "Find private SSH keys"
# Expected telemetry:
# - Process: bash/PowerShell.exe
# - Event: File enumeration in ~/.ssh directories
# - Registry: HKLM\Software\Microsoft\Cryptography access
| Registry Path | Event ID | Significance | Attacker Indicator |
|---|---|---|---|
HKLM\SYSTEM\CurrentControlSet\Services\TPM |
4657 | TPM service status | Service disabled = mitigation bypass |
HKLM\SYSTEM\CurrentControlSet\Services\Tbs |
4657 | TPM Base Services | Service restart attempts |
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Device |
4657 | Device compliance policy | Policy modifications |
HKLM\Software\Microsoft\Cryptography\Calais |
4663 | CNG key store | Unauthorized key enumeration |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG |
4663 | Random number generator config | Tampering indicators |
HKCU\Software\Microsoft\Office\Outlook\Security |
4657 | Certificate-based auth config | Security setting changes |
HKLM\SOFTWARE\Policies\Microsoft\Windows\DeviceGuard |
4657 | Hypervisor Code Integrity | Disabled virtualization protection |
| Artifact Path | Artifact Type | Significance |
|---|---|---|
C:\Windows\System32\drivers\etc\hosts |
Text | TPM service domain redirection |
C:\ProgramData\Microsoft\Crypto\RSA\* |
Binary | Service principal certificates (DPAPI-encrypted) |
C:\Program Files\Microsoft Azure AD Connect\Data\* |
Database | Entra Connect configuration + credentials |
%APPDATA%\Microsoft\Crypto\RSA\* |
Binary | User certificate storage |
C:\Windows\Tasks\* |
XML | Scheduled tasks for credential harvesting |
C:\ProgramData\Microsoft\Crypto\RSA\S-1-5-18\* |
Binary | SYSTEM account certificates |
D:\Entra Connect Backup\* |
Files | Unencrypted backups containing secrets |
/sys/kernel/security/tpm0/ |
Directory (Linux) | TPM device interface (if Entra on Linux) |
| Event ID | Log Source | Significance | Detection Condition |
|---|---|---|---|
| 4663 | Security | Object Access | TPM device or cryptography registry accessed |
| 4657 | Security | Registry Value Modified | TPM policy or device compliance settings changed |
| 4688 | Security | Process Creation | AADInternals, Mimikatz, tpm2-tools executed |
| 4696 | Security | Backup/Restore Key | Attempt to export/backup encryption keys |
| 4768 | Security | Kerberos TGT Requested | Forged tokens with unusual pre-auth types |
| 4769 | Security | Service Ticket Requested | Anomalous service ticket requests |
| 1 | Sysmon | Process Creation | Parent process chain analysis for suspicious tools |
| 10 | Sysmon | Process Access | LSASS access for credential dumping |
| 12/13/14 | Sysmon | Registry Operations | Registry access to cryptography paths |
| 18 | Sysmon | Pipe Created | Named pipe connections to elevated processes |
wineventlog:security, azure:aad:signin, powershell:operations, XmlWinEventLog:Microsoft-Windows-Sysmon/OperationalDetection Type: Threat Pattern Matching
Alert Severity: CRITICAL
Frequency: Real-time
Applies To: Windows Systems running Entra Connect Sync
Splunk Query:
index=windows source=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational EventCode=1
(CommandLine="*AADInternals*" OR CommandLine="*Get-AADIntSyncCredentials*" OR CommandLine="*Set-AADIntSyncPassword*")
OR (Image="*powershell.exe" AND ParentImage="*services.exe" AND CommandLine CONTAINS "AAD")
| stats count, values(User) as ExecutingUser, values(ComputerName) as ComputerName,
values(CommandLine) as CommandLines by Image
| where count >= 1
| eval RiskScore = 100
What This Detects:
Alert Action: Immediate isolation of affected system, credential reset, forensic analysis
Detection Type: Configuration Baseline
Alert Severity: HIGH
Frequency: Every 15 minutes
Splunk Query:
index=windows source=wineventlog:security EventCode=4657
(ObjectName="*\\Services\\TPM\\*" OR ObjectName="*\\Services\\Tbs\\*" OR
ObjectName="*\\Policies\\System\\Device\\*")
NewValue IN ("0", "Stopped", "Disabled")
| stats count, values(SubjectUserName) as User, values(Computer) as Host,
values(ObjectName) as ModifiedKey, values(OperationType) as Operation by _time
| where count >= 1
| eval Severity=if(SubjectUserName LIKE "%SYSTEM%", "Critical", "High")
False Positive Analysis:
Tuning:
index=windows source=wineventlog:security EventCode=4657
ObjectName LIKE "%Services%TPM%" NewValue="0"
| where NOT (SubjectUserName IN ("admin@domain.com", "SystemAccount")
AND _time >= "2024-01-01 02:00:00" AND _time < "2024-01-01 04:00:00")
Detection Type: Behavioral Anomaly
Alert Severity: HIGH
Applies To: Server with service principals
Splunk Query:
index=windows source=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational EventCode IN (12, 13, 14)
TargetObject LIKE "%Cryptography%"
OR TargetObject LIKE "%Crypto\RSA%"
| stats count by Computer, User, TargetObject, CommandLine
| where count > 20 AND User != "NT AUTHORITY\SYSTEM"
| eval RiskScore=case(
Image LIKE "%mimikatz%", 95,
Image LIKE "%powershell%", 80,
count > 50, 85,
1=1, 70
)
Rule Configuration:
KQL Query:
SigninLogs
| where ServicePrincipalName contains "Microsoft Azure Active Directory Connect"
and ResultType == 0 // Successful authentication
| extend SyncAccountName = ServicePrincipalName
| join kind=inner (
AuditLogs
| where OperationName in ("Update Directory Settings", "Enable-AipServiceSuperUserFeature", "Add Temporary Access Pass")
| extend AuditActivityTime = TimeGenerated
) on $left.TimeGenerated, $right.TimeGenerated
| where TimeGenerated between ((now(-1h)) .. now())
| extend IPRiskLevel = case(
ClientIP startswith "192.168" or ClientIP startswith "10.", "Low",
ClientIP startswith "172.16" or ClientIP startswith "172.31", "Low",
1=1, "Unknown"
)
| summarize SigninCount = count(),
AuditChangeCount = dcount(OperationName),
UniqueClaims = dcount(Claims),
MostRecentSignin = max(TimeGenerated)
by SyncAccountName, ClientIP, IPRiskLevel, DeviceDetail
| where SigninCount > 5 or AuditChangeCount > 2
| extend RiskScore =
case(
IPRiskLevel == "Unknown" and SigninCount > 10, 85,
AuditChangeCount > 3, 90,
1=1, 65
)
| where RiskScore >= 70
What This Detects:
Manual Configuration Steps (Azure Portal):
Detect Suspicious Entra Connect Sync ActivityHigh30 minutes1 hourManual Configuration Steps (PowerShell):
# Connect to Sentinel workspace
Connect-AzAccount
$ResourceGroup = "YourResourceGroup"
$WorkspaceName = "YourSentinelWorkspace"
# Create the analytics rule
New-AzSentinelAlertRule -ResourceGroupName $ResourceGroup -WorkspaceName $WorkspaceName `
-DisplayName "Detect Suspicious Entra Connect Sync Activity" `
-Query @"
SigninLogs
| where ServicePrincipalName contains 'Microsoft Azure Active Directory Connect'
| where ResultType == 0
| stats count() by ServicePrincipalName, ClientIP
| where count > 5
"@ `
-Severity "High" `
-Enabled $true `
-Frequency (New-TimeSpan -Minutes 30) `
-Period (New-TimeSpan -Hours 1)
Rule Configuration:
KQL Query:
SecurityEvent
| where EventID == 4663 // File accessed
and ObjectName contains "Cryptography"
| extend ExtractedPath = tostring(split(ObjectName, "\\")[-1])
| join kind=inner (
DeviceInfo
| where IsCompliant == false // Non-compliant devices = higher risk
) on $left.Computer == $right.DeviceName
| summarize AccessCount = count(),
FirstAccess = min(TimeGenerated),
LastAccess = max(TimeGenerated),
Users = make_set(Account)
by Computer, ObjectName, ExtractedPath, IsCompliant
| where AccessCount > 10 or TimeGenerated < ago(1h)
| extend RiskIndicator = case(
IsCompliant == false and AccessCount > 15, "Very High",
AccessCount > 25, "High",
1=1, "Medium"
)
Log Source: Security
Trigger: Read/Write access to TPM device or cryptography registry keys
Applies To Versions: Server 2016+, Windows 10+
Manual Configuration Steps (Group Policy):
gpupdate /force on target machinesForensic Query (PowerShell):
$StartTime = (Get-Date).AddHours(-24)
Get-WinEvent -FilterHashtable @{
LogName = "Security"
Id = 4663
StartTime = $StartTime
} | Where-Object {
$_.Properties[10].Value -match "Cryptography|TPM" -and
$_.Properties[7].Value -match "Read|Write"
} | Select-Object TimeCreated,
@{N="User";E={$_.Properties[1].Value}},
@{N="Object";E={$_.Properties[10].Value}},
@{N="AccessType";E={$_.Properties[7].Value}}
Log Source: Security
Trigger: Execution of credential harvesting or TPM manipulation tools
Detection Condition: CommandLine contains “AADInternals”, “mimikatz”, “tpm2-tools”, “chipsec”
Manual Configuration Steps (Local Policy):
auditpol /set /subcategory:"Process Creation" /success:enable /failure:enableMinimum Sysmon Version: 13.0+
Supported Platforms: Windows 10, Windows Server 2016+
Sysmon Event IDs to Monitor:
Sysmon XML Configuration:
<Sysmon schemaversion="4.22">
<HashAlgorithms>md5,sha256</HashAlgorithms>
<!-- Detect credential harvesting tools -->
<ProcessCreate onmatch="include">
<Image condition="image">AADInternals.ps1</Image>
<Image condition="image">mimikatz.exe</Image>
<CommandLine condition="contains">Get-AADIntSyncCredentials</CommandLine>
<CommandLine condition="contains">crypto::certificates</CommandLine>
</ProcessCreate>
<!-- Detect LSASS access for credential dumping -->
<ProcessAccess onmatch="include">
<TargetImage condition="image">lsass.exe</TargetImage>
<GrantedAccess condition="is">0x1438</GrantedAccess> <!-- Full access -->
</ProcessAccess>
<!-- Detect TPM/Cryptography registry access -->
<RegistryEvent onmatch="include">
<TargetObject condition="contains">Services\TPM</TargetObject>
<TargetObject condition="contains">Cryptography\RNG</TargetObject>
<TargetObject condition="contains">Crypto\RSA</TargetObject>
</RegistryEvent>
<!-- Detect suspicious file operations -->
<FileCreate onmatch="include">
<TargetFilename condition="contains">\.pfx</TargetFilename>
<TargetFilename condition="contains">\.p12</TargetFilename>
<TargetFilename condition="contains">\.cer</TargetFilename>
<Image condition="is">powershell.exe</Image>
</FileCreate>
</Sysmon>
Manual Configuration Steps:
sysmon-tpm-config.xml with XML abovesysmon64.exe -accepteula -i sysmon-tpm-config.xml
Get-Service Sysmon64
Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational" -MaxEvents 10
Alert Name: CryptoKeyExtractionAttempt
Severity: High
Description: Microsoft Defender for Cloud detects process attempting to access or export cryptographic keys protected by TPM or CNG, indicating potential credential theft
Applies To: All servers with Defender for Servers enabled
Remediation:
Manual Configuration Steps:
Reference: Microsoft Defender for Cloud Alerts
Operations: Update Directory Settings, Add Credentials, Modify Sync Settings
Workload: Azure Active Directory, Azure Administrative Activity
PowerShell Query:
Search-UnifiedAuditLog `
-Operations "Update Directory Settings", "Add service principal credentials",
"Update application", "Set service principal" `
-StartDate (Get-Date).AddDays(-7) `
-EndDate (Get-Date) `
-ResultSize 10000 |
Where-Object {$_.UserIds -like "*sync*" -or $_.UserIds -like "*Connector*"} |
Select-Object CreationDate, UserIds, Operations, AuditData |
Export-Csv -Path "C:\EntraConnect-Audit.csv"
Manual Configuration Steps (Enable Audit Log):
Manual Configuration Steps (Search):
Update Directory SettingsAdd Temporary Access PassModify Service PrincipalUpdate Sync Features*sync* or *Connector*1.1 Enable TPM 2.0 on All Entra Connect Servers
Rationale: TPM 2.0 provides hardware-protected key storage with anti-hammering protection against brute force attacks; prevents local key extraction attacks
Applies To: Entra Connect Sync servers, hybrid-joined devices
Manual Steps (BIOS/UEFI):
Manual Steps (Verify TPM in Windows):
# Check TPM status
Get-WmiObject -Namespace "root\cimv2\security\microsofttpm" -Class Win32_Tpm |
Select-Object IsEnabled, IsActivated
# Verify TPM 2.0
Get-Item -Path Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tbs |
Get-ItemProperty | Select-Object -ExpandProperty Description
Manual Steps (Group Policy - Windows Server):
gpupdate /force1.2 Migrate Entra Connect to TPM-backed Certificate Authentication (v2.5.3.0+)
Rationale: Eliminates plaintext password storage on Entra Connect servers; uses TPM-protected certificates instead
Applies To: New deployments or upgrades of Entra Connect Sync v2.5.3.0+
Manual Steps (Upgrade Entra Connect):
# Download latest Entra Connect from Microsoft
# https://www.microsoft.com/en-us/download/details.aspx?id=47594
# Stop Entra Connect sync service
Stop-Service ADSync
# Backup current configuration (CRITICAL)
$BackupPath = "C:\ADConnectBackup\$(Get-Date -Format 'yyyyMMdd_HHmmss')"
New-Item -Path $BackupPath -ItemType Directory | Out-Null
Copy-Item "C:\Program Files\Microsoft Azure AD Connect" -Destination $BackupPath -Recurse
# Install upgraded version
# Run installer: AzureADConnect.msi
# Select "Configure device options"
# Choose "Application-based authentication with TPM backing"
# Verify TPM-backed certificate created
Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.Subject -like "*Entra*"} |
Select-Object Subject, Thumbprint, @{N="StorageProvider";E={$_.PrivateKey.CspKeyContainerInfo.MachineKeyStore}}
Expected Output:
StorageProvider: True # Indicates TPM storage
1.3 Enforce MFA for Directory Synchronization Service Account
Rationale: Adds second factor to sync account authentication, preventing account takeover even if password compromised
Applies To: All Entra Connect Sync service accounts
Manual Steps (Azure Portal):
Require MFA for Sync AccountsManual Steps (PowerShell):
# Identify sync accounts
$SyncAccounts = Get-MgRoleManagementDirectoryRoleAssignment -Filter "roleDefinitionId eq 'Directory Synchronization Accounts'"
# For each account, enforce MFA
foreach ($Account in $SyncAccounts) {
$User = Get-MgUser -UserId $Account.PrincipalId
# MFA enforcement via Conditional Access (not direct assignment in modern Azure)
Write-Output "Sync Account: $($User.UserPrincipalName)"
}
1.4 Restrict Entra Connect Server Access via Network Segmentation
Rationale: Limits lateral movement and credential extraction by isolating Entra Connect on dedicated subnet
Manual Steps (Network Security Group):
Entra-Connect-Server-NSG2.1 Enable Measured Boot and TPM Attestation
Rationale: Creates cryptographic record of boot components; enables detection of tampering
Manual Steps (Group Policy):
gpupdate /forceVerification:
# Check Measured Boot status
Get-WmiObject -Namespace "root\cimv2\security\microsofttpm" -Class Win32_Tpm |
Select-Object @{N="MeasuredBootSupported";E={$_.IsEnabled}}
# View PCR values
Get-WmiObject -Namespace "root\cimv2\security\microsofttpm" -Class Win32_LogicalProcessorGroup |
ForEach-Object {$_.Description}
2.2 Configure TPM Anti-Hammering Parameters
Rationale: Prevents brute force attacks on TPM-protected keys
Manual Steps (Group Policy):
3210 minutes320 minutesgpupdate /force2.3 Implement Certificate Pinning for Entra Connect Service Principal
Rationale: Prevents certificate substitution attacks; binds service principal to specific certificate
Manual Steps (PowerShell):
# Get current service principal certificate
$ServicePrincipal = Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Azure Active Directory Connect'"
$CurrentCert = $ServicePrincipal.KeyCredentials[0]
# Extract certificate thumbprint for pinning
$Thumbprint = $CurrentCert.CustomKeyIdentifier | ForEach-Object {([System.Convert]::ToHexString($_))}
# Store in secure location for baseline comparison
"Thumbprint,$Thumbprint" | Out-File "C:\Secure\AzureAD_SPN_Cert_Baseline.txt" -Force
# Regularly compare against baseline
$CurrentThumbprint = (Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Azure Active Directory Connect'").KeyCredentials[0].CustomKeyIdentifier
if ($CurrentThumbprint -ne $Thumbprint) {
Write-Error "ALERT: Service principal certificate has changed!"
# Trigger incident response
}
| Compliance Framework | Control ID | Requirement | Mitigation |
|---|---|---|---|
| NIST 800-53 | SC-12 | Cryptographic Key Establishment and Management | Enable TPM on all systems; enforce 90-day key rotation |
| NIST 800-53 | SC-7 | Boundary Protection | Network segmentation for Entra Connect servers |
| CIS Microsoft 365 | 5.2 | MFA for Privileged Accounts | Enable MFA for sync service accounts |
| DISA STIG (Windows) | WN10-00-000050 | TPM Initialization | Enable and initialize TPM 2.0 |
| ISO 27001:2022 | A.10.1.1 | Policy on use of cryptographic controls | Document TPM usage; implement key lifecycle management |
| DORA (EU) | Article 17 | ICT cryptographic security | Use FIPS 140-3 validated TPM; implement HSM for sensitive keys |
| NIS2 Directive | 4.2.1 | Technical security measures | Implement TPM attestation; monitor key access logs |
Assume Breach Timeline:
Containment Actions:
# Step 1: Isolate Entra Connect server from network
Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "IPEnabled=true" |
ForEach-Object { $_.SetDNSServerSearchOrder(@()) } # Clear DNS
# Step 2: Force password reset for all service accounts
$ServiceAccounts = Get-ADUser -Filter {Name -like "*sync*" -or Name -like "*Connector*"}
foreach ($Account in $ServiceAccounts) {
Set-ADAccountPassword -Identity $Account -Reset -NewPassword (ConvertTo-SecureString -AsPlainText (New-Guid).Guid -Force)
Set-ADUser -Identity $Account -ChangePasswordAtLogon $true
}
# Step 3: Invalidate all active refresh tokens
Revoke-AzureADUserAllRefreshToken -ObjectId (Get-AzADUser -UserPrincipalName "sync_*@domain.onmicrosoft.com").Id
# Step 4: Clear cached credentials
Remove-Item -Path "HKLM:\Software\Microsoft\Cryptography\Calais" -Force
# Step 5: Rotate service principal credentials
$ServicePrincipal = Get-MgServicePrincipal -Filter "displayName eq 'Microsoft Azure Active Directory Connect'"
Remove-MgServicePrincipalKey -ServicePrincipalId $ServicePrincipal.Id -KeyId $OldKeyId
New-MgServicePrincipalPasswordCredential -ServicePrincipalId $ServicePrincipal.Id