Skip to content

Instantly share code, notes, and snippets.

View Ghost-Developmentx's full-sized avatar
πŸ’­
Talk Less, Do More

Ghost Ghost-Developmentx

πŸ’­
Talk Less, Do More
View GitHub Profile
# Enable audit policy for process access
auditpol /set /subcategory:"Sensitive Privilege Use" /success:enable /failure:enable
auditpol /set /subcategory:"Process Creation" /success:enable
# Create scheduled task to monitor LSASS access
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument @"
-NoProfile -WindowStyle Hidden -Command "
Get-WinEvent -FilterHashtable @{LogName='Security';ID=4656,4663} |
Where-Object {`$_.Message -match 'lsass.exe'} |
ForEach-Object {
# Enable Credential Guard (requires restart)
# Requires: Windows 10 Enterprise/Education, Windows 11, Server 2016+
# Hardware: TPM 2.0, UEFI, Virtualization extensions
# Enable via registry
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" `
-Name "EnableVirtualizationBasedSecurity" -Value 1 -PropertyType DWORD -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\DeviceGuard" `
-Name "RequirePlatformSecurityFeatures" -Value 3 -PropertyType DWORD -Force
# Remote execution using WMI
$target = "DC01.contoso.com"
$cred = Get-Credential
# Create remote CIM session
$session = New-CimSession -ComputerName $target -Credential $cred
# Execute remote dump
Invoke-CimMethod -CimSession $session -ClassName Win32_Process -MethodName Create -Arguments @{
CommandLine = 'rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump 652 C:\Windows\Temp\lsass.dmp full'
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Attack Chain Timeline
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1. Initial Access (T1078β€Š-β€ŠValid Accounts)
β”‚ β†’ Phishing email with malicious attachment
β”‚ β†’ User opens document, macro executes
β”‚Β 
β”‚ 2. Execution (T1059β€Š-β€ŠCommand and Scripting)
β”‚ β†’ PowerShell beacon established
β”‚ β†’ C2 communication initiated
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Defense Layers (Zero Trust)
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚
β”‚ Layer 7: Security Monitoring & IR
β”‚ β”œβ”€ SIEM/SOAR integration
β”‚ β”œβ”€ 24/7 SOC monitoring
β”‚ └─ Automated response playbooks
β”‚
β”‚ Layer 6: Identity Protection
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Detection Pipeline
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚
β”‚ 1. Endpoint Detection (EDR)
β”‚ β”œβ”€ Process monitoring (API hooks)
β”‚ β”œβ”€ Memory access detection
β”‚ └─ Behavioral analysis
β”‚ ↓
β”‚ 2. Event Collection (Sysmon/Windows Event Log)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Future Protection Mechanisms β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ β€’ Hardware-based isolation (Pluton, TPM 3.0) β”‚
β”‚ β€’ Machine learning anomaly detection β”‚
β”‚ β€’ Passwordless authentication (FIDO2, Windows Hello) β”‚
β”‚ β€’ Zero Trust architecture (continuous verification) β”‚
β”‚ β€’ Ephemeral credentials (short-lived tokens) β”‚
β”‚ β€’ Confidential computing (encrypted memory) β”‚
# Windows Hello for Business deployment
# Replaces passwords with cryptographic keys
# Benefits:
# - Credentials never in memory as plaintext
# - Biometric or PIN authentication
# - TPM-protected private keys
# - Phishing-resistant
# Check Windows Hello status
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Modern Defense Strategy β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ β”‚
β”‚ Short Term: Harden existing systems β”‚
β”‚ β”œβ”€ Credential Guard everywhere possible β”‚
β”‚ β”œβ”€ RunAsPPL on all systems β”‚
β”‚ β”œβ”€ WDigest disabled globally β”‚
β”‚ └─ Comprehensive monitoring β”‚
β”‚ β”‚
# Force password resets
Set-ADUser -Identity USERNAME -ChangePasswordAtLogon $true
# Revoke Kerberos tickets
Invoke-Command -ComputerName HOSTNAME -ScriptBlock {klist purge}
# Reset computer account
Reset-ComputerMachinePassword -Server DC01