Hunt persistence

From op7ic/amphunt · View interactive version

Hunt persistence is an AI agent skill from the GitHub repository op7ic/amphunt. Detect attacker persistence mechanisms including scheduled tasks, registry run keys, service creation, WMI subscriptions, and startup folder modifications. This is a composite hunt using keyword searc

How to use this skill

Skill file

Hunt: Persistence Mechanism Detection

Description

Detect attacker persistence mechanisms including scheduled tasks, registry run keys, service creation, WMI subscriptions, and startup folder modifications. This is a composite hunt using keyword searches for persistence-related commands.

Scripts

Important Note

multikeyword_search.py performs plain-text substring matching against AMP activity records. Do NOT use regex patterns (e.g., .*) in keyword files -- they will be searched literally and will not match. Use the shortest distinctive substring that identifies the technique.

Execution Plan

Step 1: Registry Persistence

echo "CurrentVersion\Run" > persistence.txt
echo "CurrentVersion\RunOnce" >> persistence.txt
echo "Winlogon" >> persistence.txt
echo "Explorer\Run" >> persistence.txt
echo "reg add" >> persistence.txt
python3 multikeyword_search.py -c config.txt persistence.txt --csv registry_persistence.csv

Step 2: Scheduled Tasks

echo "schtasks /create" > schtask_persist.txt
echo "schtasks /change" >> schtask_persist.txt
echo "at /every" >> schtask_persist.txt
python3 multikeyword_search.py -c config.txt schtask_persist.txt --csv schtask_persistence.csv

Step 3: Service-Based Persistence

echo "sc create" > service_persist.txt
echo "sc config" >> service_persist.txt
echo "New-Service" >> service_persist.txt
python3 multikeyword_search.py -c config.txt service_persist.txt --csv service_persistence.csv

Step 4: WMI Persistence

echo "wmic" > wmi_persist.txt
echo "startup" >> wmi_persist.txt
echo "EventSubscription" >> wmi_persist.txt
echo "__EventFilter" >> wmi_persist.txt
echo "CommandLineEventConsumer" >> wmi_persist.txt
python3 multikeyword_search.py -c config.txt wmi_persist.txt --csv wmi_persistence.csv

Step 5: DLL Hijacking / Side-Loading

python3 hash2processarg.py -c config.txt hashset/windows-dll/advpack.dll.txt --csv dll_sideload.csv
python3 hash2processarg.py -c config.txt hashset/windows-dll/comsvcs.dll.txt --csv comsvcs_abuse.csv

MITRE ATT&CK Coverage

When to Use

Follow-Up Skills

False Positive Guidance

Keywords like sc create, sc config, reg add, and wmic appear frequently in legitimate software installations and system administration. To reduce noise:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.