IncidentResponsev2

4.62 Validate No Persistence Mechanisms Remain (Local, AD, Cloud - Backdoors, Accounts, Automation)

Task

Detect and remove unauthorized persistence mechanisms including rogue accounts, backdoors, startup tasks, cloud functions, IAM backdoors, and unauthorized automation from local systems, Active Directory (AD), and cloud environments (AWS, Azure, GCP).


Conditions

Given access to local, enterprise, and cloud platform administrative tools and logs.


Standards


End State

No unauthorized accounts, services, jobs, or automated tasks remain that provide unauthorized or hidden access paths into the environment.


Notes


Manual Steps

Step 1: Enumerate and Review Local Persistence Mechanisms

User Accounts (Local)

Windows
Get-LocalUser
Linux/macOS
cat /etc/passwd

Look for:

Operator Note: Flag users with unusual usernames or not in authorized list.


Startup Items / Scheduled Tasks

Windows
Get-ScheduledTask

Check:

Linux (cron)
crontab -l
cat /etc/cron.*
ls /etc/systemd/system/

Check:

macOS
launchctl list

Check:

Operator Note: Unknown or recently modified startup tasks → high priority for investigation.


Registry / WMI / Services (Windows Advanced Persistence)

Get-WmiObject -Namespace root\subscription -Class __EventFilter

Check:

Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run"

Operator Note: Registry autoruns are easy to hide → validate all entries.


Step 2: Enumerate and Review Active Directory Persistence

AD Accounts

Get-ADUser -Filter * -Properties LastLogonDate, Enabled

Look for:

AD Delegation / GPO Backdoors

Get-GPResultantSetOfPolicy
Get-ADObject -LDAPFilter "(adminCount=1)"

Look for:

AD Computers

Get-ADComputer -Filter * -Properties LastLogonDate

Operator Note: Unused or “phantom” computer accounts could be attacker-placed.


Step 3: Enumerate and Review Cloud Persistence Mechanisms

AWS

aws iam list-users
aws iam list-roles
aws iam list-policies

Look for:

aws lambda list-functions

Look for:


Azure

Get-AzADUser
Get-AzRoleAssignment
Get-AzFunctionApp

Look for:

Azure Portal → Logic Apps / Automation Accounts:


Google Cloud (GCP)

gcloud iam roles list
gcloud projects get-iam-policy [PROJECT_ID]
gcloud functions list

Look for:

Operator Note: External identities → attacker backdoors.


Step 4: Remove Unauthorized Persistence Mechanisms

Local (Windows, Linux, macOS)

Active Directory

AWS

aws iam delete-user --user-name USER
aws iam delete-role --role-name ROLE
aws lambda delete-function --function-name FUNCTION

Azure

Remove-AzADUser -ObjectId USERID
Remove-AzFunctionApp -Name "FunctionName"

GCP

gcloud iam roles delete [ROLE_ID] --project=[PROJECT_ID]
gcloud functions delete [FUNCTION_NAME]

Operator Note: Disable before deletion where possible to avoid accidental service interruption.


Step 5: Validate and Document


Dependencies


Other Available Tools

Tool Platform Installation Usage
PowerShell / Bash Cross-platform Native Local + AD validation
AWS CLI / Azure CLI / gcloud Cross-platform Package manager Cloud IAM and automation validation
Sysinternals Autoruns Windows Download In-depth autorun review
Microsoft Sentinel / Splunk SIEM Native Cross-correlation and detection of abnormal persistence

Operator Recommendations and Additional Tools

Operator Checklist

Best Practices


References


Revision History

Date Version Description Author
2025-05-02 1.0 Created from scratch with deep operator-focused persistence discovery and removal guidance Leo