Privilege Escalation [Searching]

Checking Environment Variable

# To list all variable 

Get-ChildItem Env:

cmd /c "set"

Searching for Hidden Plain text

PowerShell
# Searching for KeePass Database.
Get-ChildItem -Path C:\ -Include *.kdbx -File -Recurse -ErrorAction SilentlyContinue

# Searching for Text file and configuration file in Xampp
Get-ChildItem -Path C:\xampp -Include *.txt,*.ini -File -Recurse -ErrorAction SilentlyContinue

# Searching credential files in Home Directory of the user.
Get-ChildItem -Path C:\Users\<USERNAME> -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx,*.ini,*.exe, *.log, *.bak -File -Recurse -ErrorAction SilentlyContinue

# To search for running binary
tasklist /v


# You want to get Full name with above command
Get-ChildItem -Path C:\Users -Include *.txt,*.pdf,*.xls,*.xlsx,*.doc,*.docx,*.ini,*.exe, *.log, *.bak -File -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName

# If Above command output looks overwhelming then run command for each extention one by one.

Try to Compromise the user who is member of Remote Desktop Users So, that you can get GUI access for easy enumeration.

Accessing User account

More Details on Xfreerdp and Run as Tool

You can use Cyberchef for decoding purpose.

Finding Hidden information

Evil-winrm tool provides various built-in functions for penetration testing such as pass the hash, in-memory loading, and file upload/download.

If evil winrm is confirged then connect using below command:

Script Block Logging can also be used for finding crucial information.

Searching in Script Block Logging

Shortcut:

As there is a lots of content in the Script block Logging, It's Difficult to check All logs one by one.

Manual approach:

location of script block logging

I fount the operational file at the location:

Event Viewer > application and service logs > Microsoft > windows > Powershell > Operational

create Filter in this:

Now look for sensitive data in logs one by one 🤣.

Looking Inside Hidden Directory

Sometimes Hidden directories may contain sensitive information. For example, AppData Present in the Administrator Directory. So, We should check that also.

You can check for critical information in above files using below command:

Using Automated tool

We can also use Seatbelt for the same.

Last updated