Practical Windows Commands

Basic Recon: System & Patch Info

Before launching privilege escalation or lateral movement, always enumerate the target machine:

systeminfo
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information

wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get architecture
wmic computersystem LIST full #Get PC info
wmic qfe list brief #Updates
wmic qfe get Caption,Description,HotFixID,InstalledOn #Patches

hostname

DRIVERQUERY #3rd party driver vulnerable?
  • Check patch levels: wmic qfe get Caption,Description,HotFixID,InstalledOn

  • Get only OS name/version: systeminfo | findstr /B /C:"OS Name" /C:"OS Version"


๐ŸŒ Environment Variables Worth Checking

Key variables:

  • %USERNAME%, %COMPUTERNAME%, %HOMEPATH%

  • %LOGONSERVER%, %USERDNSDOMAIN%, %USERDOMAIN%

  • %TEMP%, %windir%

Some env variables to highlight:

  • COMPUTERNAME: Name of the computer

  • TEMP/TMP: Temp folder

  • USERNAME: Your username

  • HOMEPATH/USERPROFILE: Home directory

  • windir: C:\Windows

  • OS:Windos OS

  • LOGONSERVER: Name of domain controller

  • USERDNSDOMAIN: Domain name to use with DNS

  • USERDOMAIN: Name of the domain

โžก๏ธ Identify the domain controller:


Drives and Disk Info


Windows Defender & Recycle Bin

  • Defender Status: (PowerShell-based commands are preferred for Defender bypass โ€” covered in other posts.)

  • Check for deleted data:


Processes, Services & Installed Software

Installed programs:


Active Directory Enumeration

Basic Domain Info

Enumerate Users

Check domain user details:

Enumerate Groups

List Domain Computers


Logs & Sessions

Password Policy

Credentials

Persistence with users


Local & Domain Users / Groups

โžก๏ธ Add local user to admin:


Network Enumeration

View DNS cache:


Windows Firewall Control

Check current config:

Disable firewall:

Allow port:

Full list:


Persistence & RDP Access

Enable RDP:

Create RDP-ready admin:


Shares, SNMP, and Wi-Fi Access

Wifi

SNMP


File Downloading Tricks

Using built-in tools:

Certutil:

Bitsadmin:

More download techniques: https://lolbas-project.github.ioarrow-up-right


Extra Tricks

Alternate Data Streams (ADS)

Hide malware in alternate data streams:

List ADS:

Execute ADS:


๐Ÿคฏ CMD Obfuscation & DNS Exfiltration

Bypass blacklists:

Use DNS as a covert exfiltration channel:


Run CMD from C (Persistence Example)

Compile:


Misc.

Bypass Char Blacklisting

DOSfuscation

Generates an obfuscated CMD line

Listen address ACLs

You can listen on http://+:80/Temporary_Listen_Addresses/arrow-up-right without being administrator.

Manual DNS shell

Attacker (Kali) must use one of these 2 options:

Victim

for /f tokens technique: This allows us to execute commands, get the first X words of each line and send it through DNS to our server

You can also redirect the output, and then read it.


circle-check

Last updated

Was this helpful?