17. Metasploit Persistence
Persistence ensures you retain access to the compromised machine after a reboot or loss of session.
A. Meterpreter Persistence Module¶
Run the following in Meterpreter:
-U: Start on user logon.-i 10: Retry interval in seconds.-p 4444: Port to connect.-r 192.168.1.10: Remote IP.
B. Windows Registry Key¶
Add a payload to the registry:
-
Generate payload:
-
Add to registry via PowerShell:
C. Scheduled Task¶
Create a task to execute payload: