Sometimes, interesting ports are running on localhost and sometimes ports are publicly blocked by some rules.
And, these ports can be identified by commands like ->
netstat -ano OR netstat -antp TCP #Provide the protocol at the end
And, the ports look like this -
Localhost Port --> 127.0.0.1:8080 #Only accessible through localhost
Blocked port --> 0.0.0.0:80 #Not showing up in Nmap scan (hence blocked)
Always, look for these kind of ports
Check if there are other drives available on the target or not -
Fetching PowerShell Console History file
Directories or Files free from Windows Defender -
This is useful to run scripts or executables which might get flagged as malicious by antivirus or defender -
To list hidden files in CMD & Powershell
In CMD, run this command to list hidden files & folders -
In PowerShell, run this command -
Check for Interesting Services -
1. Using tasklist
Run tasklist command for this or look at the winpEAS output carefully.
Run Get-Process from powershell in case tasklist doesn't work.
2. Checking default directories
Check "Program Files" and "Program Files (x86)" directories for interesting applications or softwares. Or, atleast search google for exploits for those applications.
Exploiting Teamviewer service -
If teamviewer service is running then we can look for user credentials there.
First, identify the version of teamviewer by visiting its installation directory in "Program Files" or "Program Files(x86)".
Second, according to the version of teamviewer installed, look for one of these registries -
Move into that registry -
Run this command to list various properties of that registry -
get-itemproperty -path .
Run this command to list "SecurityPasswordAES" property (which will dump a lot of integers) -
Now, using these integers, the password can be easily decrypted with the help of a python script used in this blog (HTB Remote 0xdf writeup) -
Replacing interesting binaries with malicious ones
If there is an interesting binary present in the target and we think that it is running in some intervals. We can try to replace it with our binary if we have enough permissions.
Steps ->
Create a backup of original binary (in case this hunch doesn't work)
Use msfvenom to create malicious binary or payload
Replace the existing one with your binary
Wait for your binary to get executed ( OR try executing it if you have permission to do so)
AlwaysInstallElevated PrivEsc
If we have this enabled, then we can very easily escalated our privileges to get SYSTEM shell.
PowerUp POC for AlwaysInstallElevated
To perform check, run PowerUp (check above screenshot) OR Run the below commands ->
dir /a:h C:<directory> #To display hidden files in a particular directory
dir /a:d #To display hidden directories
ls -Force
HKLM\SOFTWARE\WOW6432Node\TeamViewer\Versionx #Replace x by version number
HKLM\SOFTWARE\TeamViewer\Temp
HKLM\SOFTWARE\TeamViewer
cd HKLM:\software\wow6432node\teamviewer\versionx
(get-itemproperty -path .).SecurityPasswordAES
get-process
screenshot #take screenshots of desktop in regular intervals by running this command
screenshare #provides a kind of live streaming of user desktop actions