Windows Privilege Escalation
Here are some techniques for achieving privilege escalation on Windows systems:
Abusing SSH keys
Check if we have reading permissions on the SSH private keys of a user
#On the target machine
type C:\Users\$user\.ssh\$keyfile #For a userCopy the keys to a file, assign permissions to the file, and use it to log in using the key
#On our machine
nano $filename #Copy here the keys
chmod 600 $filename
ssh $username@$IP -i $filenameWhen having writing permissions on the
.ssh/directory of a user, we can generate an SSH key with the current user and pass it to the system
ssh-keygen -f $keyfilePass the public key to the authorized keys file of the root user
Use this to log in as the user using the key
Abusing .bat files with full control permissions
In the situation where a .bat file (script file for Windows) is being executed on the system and it has full-control permissions, it's possible to abuse this to modify the content of the .bat file and execute commands with privileges arbitrarily
Try spawning a PowerShell from the CMD with any user we have access to
Find a .bat file, and check if it has full-control permissions. In case it has, check if it is calling any process and if any of them is still running
Download and import a Netcat executable for Windows
Set Netcat listener to catch the connection and replace the content of the .bat file with a command spawning the Netcat executable
Last updated