AutoRun entries tell Windows to execute programs automatically at startup or login. If an AutoRun program has weak permissions - meaning we can replace it - we can hijack the execution.
Patience Required
AutoRun exploitation requires waiting for the target user to log in or the system to reboot. This is a plant and wait attack.
AutoRun Locations
Enumerating AutoRun Entries
Using PowerUp
Checking File Permissions
Check Directory Too
Even if the file isn't directly writable, if the DIRECTORY is writable, you can rename the original and place your malicious file.
Exploitation
Alternative: Directory Writable
Startup Folder Exploitation
Payload Considerations
AV Detection
AutoRun exploitation often fails due to antivirus. The malicious executable may be scanned and blocked. Consider obfuscation.
AutoRun Exploitation Methodology
AutoRun Hijacking Flow
1
EnumerateQuery registry Run keys and Startup folders
2
IdentifyFind entries pointing to modifiable files
3
VerifyCheck permissions with icacls/accesschk
4
BackupSave original binary if needed
5
ReplaceOverwrite with malicious executable
6
WaitWait for login/reboot to trigger
7
AccessUse new credentials or catch shell
Knowledge Check
Key Takeaways
- AutoRun entries in HKLM Run execute for all users at login
- Check file AND directory permissions with icacls
- Hijack by replacing the binary the AutoRun points to
- Startup folders are another AutoRun mechanism
- Must wait for login/reboot to trigger exploitation