Windows Persistence

Overview

Persistence is the art of maintaining access to a compromised system across reboots, user logouts, and other system changes. This guide covers the most common and effective Windows persistence techniques used in penetration testing.

What is Persistence?

Definition

Persistence refers to techniques that adversaries use to keep access to systems across restarts, changed credentials, and other interruptions that could cut off their access.

Why Persistence Matters for PJPT

  • Maintain access during long-term engagements

  • Survive system reboots and user logouts

  • Demonstrate impact to clients

  • Essential for advanced post-exploitation activities

Registry-Based Persistence

1. Registry Run Keys

The most common persistence method using Windows registry autorun locations.

Current User Run Key

Local Machine Run Key (Requires Admin)

Additional Registry Locations

2. Registry Persistence Examples

Service-Based Persistence

1. Creating Windows Services

2. Modifying Existing Services

3. Service DLL Hijacking

Scheduled Tasks Persistence

1. Basic Scheduled Task Creation

2. PowerShell Scheduled Tasks

3. Scheduled Task Management

Startup Folder Persistence

1. User Startup Folder

2. All Users Startup Folder (Admin Required)

WMI Persistence

1. WMI Event Subscription

2. WMI Persistence Cleanup

DLL Hijacking Persistence

1. DLL Search Order Hijacking

2. Phantom DLL Hijacking

Advanced Persistence Techniques

1. COM Hijacking

2. AppInit_DLLs

3. Accessibility Features Backdoor

PowerShell-Based Persistence

1. PowerShell Profile Modification

2. PowerShell ISE Persistence

Persistence Detection Evasion

1. Timestomping

2. File Attribute Manipulation

Practical Persistence Scenarios

Scenario 1: User-Level Persistence

Scenario 2: System-Level Persistence

Scenario 3: Stealth Persistence

Cleanup and Removal

Registry Cleanup

Service Cleanup

Scheduled Task Cleanup

PJPT Exam Tips

Essential Commands to Memorize

Documentation Requirements

  1. Show privilege level required for each technique

  2. Document persistence method used

  3. Provide cleanup instructions for client

  4. Test persistence across reboots

  5. Screenshot evidence of successful persistence

Common Mistakes to Avoid

  • Not testing persistence after reboot

  • Using obvious names for services/tasks

  • Forgetting to document cleanup procedures

  • Not considering detection/evasion

  • Failing to escalate privileges when needed


Note: Always ensure proper authorization before implementing persistence techniques. These methods should only be used in authorized penetration testing scenarios. Proper cleanup is essential to avoid impacting client systems after the engagement.

Last updated