> For the complete documentation index, see [llms.txt](https://notes.cavementech.com/pentesting-quick-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.cavementech.com/pentesting-quick-reference/privilege-escalation/windows-priv-esc/initial-enumeration.md).

# Initial Enumeration

### System Enumeration

```
systeminfo
```

<figure><img src="/files/ogV3Jo1Y0md0gfCcNJpD" alt=""><figcaption></figcaption></figure>

```
systeminfo | findstr /b /c:"OS Name" /c:"OS Version" /c:"System Type"
```

<figure><img src="/files/rNVK28tT8uijT4RY62Yb" alt=""><figcaption></figcaption></figure>

#### Enumerating Quick Fixes

```
wmic qfe
```

<figure><img src="/files/dUBAXle3eDJZyWHbji6U" alt=""><figcaption></figcaption></figure>

```
wmic qfe get Caption,Description,HotFixID,InstalledOn
```

<figure><img src="/files/yloHcDUPdBRs9FVfBofs" alt=""><figcaption></figcaption></figure>

#### Enumerate Drives

```
wmic logicaldisk
```

```
wmic logicaldisk get caption,description,providername
```

<figure><img src="/files/NzxWMYSiEhI9tyZTQtYI" alt=""><figcaption></figcaption></figure>

### User Enumeration

```
whoami
```

<figure><img src="/files/6EcNH1bttZr8GxaUTLVu" alt=""><figcaption></figcaption></figure>

#### Current User Privileges

```
whoami /priv
```

<figure><img src="/files/n2swcLqUiM6rBmmdbqG2" alt=""><figcaption></figcaption></figure>

#### Current User Groups

```
whoami /groups
```

<figure><img src="/files/qKyExssNg35ZUoLqDUBN" alt=""><figcaption></figcaption></figure>

#### Users on Current Machine

```
net user
```

<figure><img src="/files/7zwCLwAUM0NpupwoSRR1" alt=""><figcaption></figcaption></figure>

#### Details about a single user including group memberships

```
net user Administrator
```

<figure><img src="/files/TlCXZM2DSThK6frrDQ1f" alt=""><figcaption></figcaption></figure>

#### Enumerate Groups

```
net localgroup
```

<figure><img src="/files/3QCaPCq0z7SjMhgRBsmu" alt=""><figcaption></figcaption></figure>

#### Check the members of a group

```
net localgroup administrators
```

<figure><img src="/files/Iyxj7SuabpgpkdSHIUqx" alt=""><figcaption></figcaption></figure>

### Network Enumeration

```
ipconfig /all
```

#### Check arp table

```
arp -a
```

<figure><img src="/files/FeQ34ZhZPCVWoP6qQcUs" alt=""><figcaption></figcaption></figure>

#### Check Routing Table

```
route print
```

<figure><img src="/files/fDho2gqUoFP2vkiGGh9z" alt=""><figcaption></figcaption></figure>

#### Check Open Ports

```
netstat -ano
```

<figure><img src="/files/xY0yHFkMFhnFh5iBiRXK" alt=""><figcaption></figcaption></figure>

### AV and Firewall Enumeration

```
sc query windefend
```

<figure><img src="/files/5y78jEPqChmwvSg49Ew0" alt=""><figcaption></figcaption></figure>

#### List all services

```
sc queryex type= service
```

This lists all active services on the machine, including their process IDs (PIDs) and status. We can manually check if some antivirus is running on target.

#### Firewall Enumeration

```
netsh advfirewall firewall dump
```

Displays or "dumps" the entire current configuration and rule set of the Windows Defender Firewall.

If it does not work use the older command.

```
netsh firewall show state
```

* `netsh`: A command-line utility that allows you to display or modify the network configuration of a computer that is currently running.
* `firewall`: Enters the context for managing the Windows Firewall.
* `show state`: Specifically requests the current operational status of the firewall.

<figure><img src="/files/ZkwdULx0DsEaGEmE5JyK" alt=""><figcaption></figcaption></figure>

```
netsh firewall show config
```

<figure><img src="/files/UIP3RcxVKkTUbGHGHhqv" alt=""><figcaption></figcaption></figure>

### Cleartext Passwords <a href="#cleartext-passwords" id="cleartext-passwords"></a>

#### Search for them <a href="#search-for-them" id="search-for-them"></a>

```
findstr /si password *.txt
findstr /si password *.xml
findstr /si password *.ini

#Find all those strings in config files.
dir /s *pass* == *cred* == *vnc* == *.config*

# Find all passwords in all files.
findstr /spin "password" *.*
findstr /spin "password" *.*
```

#### In Files <a href="#in-files" id="in-files"></a>

These are common files to find them in. They might be base64-encoded. So look out for that.

```
c:\sysprep.inf
c:\sysprep\sysprep.xml
c:\unattend.xml
%WINDIR%\Panther\Unattend\Unattended.xml
%WINDIR%\Panther\Unattended.xml

dir c:\*vnc.ini /s /b
dir c:\*ultravnc.ini /s /b 
dir c:\ /s /b | findstr /si *vnc.ini
```

#### In Registry <a href="#in-registry" id="in-registry"></a>

```
# VNC
reg query "HKCU\Software\ORL\WinVNC3\Password"

# Windows autologin
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon"

# SNMP Paramters
reg query "HKLM\SYSTEM\Current\ControlSet\Services\SNMP"

# Putty
reg query "HKCU\Software\SimonTatham\PuTTY\Sessions"

# Search for password in registry
reg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /s
```

### Service only available from inside <a href="#service-only-available-from-inside" id="service-only-available-from-inside"></a>

Sometimes there are services that are only accessible from inside the network. For example a MySQL server might not be accessible from the outside, for security reasons. It is also common to have different administration applications that is only accessible from inside the network/machine. Like a printer interface, or something like that. These services might be more vulnerable since they are not meant to be seen from the outside.

```
netstat -ano
```

Example output:

```
Proto  Local address      Remote address     State        User  Inode  PID/Program name
    -----  -------------      --------------     -----        ----  -----  ----------------
    tcp    0.0.0.0:21         0.0.0.0:*          LISTEN       0     0      -
    tcp    0.0.0.0:5900       0.0.0.0:*          LISTEN       0     0      -
    tcp    0.0.0.0:6532       0.0.0.0:*          LISTEN       0     0      -
    tcp    192.168.1.9:139    0.0.0.0:*          LISTEN       0     0      -
    tcp    192.168.1.9:139    192.168.1.9:32874  TIME_WAIT    0     0      -
    tcp    192.168.1.9:445    192.168.1.9:40648  ESTABLISHED  0     0      -
    tcp    192.168.1.9:1166   192.168.1.9:139    TIME_WAIT    0     0      -
    tcp    192.168.1.9:27900  0.0.0.0:*          LISTEN       0     0      -
    tcp    127.0.0.1:445      127.0.0.1:1159     ESTABLISHED  0     0      -
    tcp    127.0.0.1:27900    0.0.0.0:*          LISTEN       0     0      -
    udp    0.0.0.0:135        0.0.0.0:*                       0     0      -
    udp    192.168.1.9:500    0.0.0.0:*                       0     0      -
```

Look for **LISTENING/LISTEN**. Compare that to the scan you did from the outside.\
Does it contain any ports that are not accessible from the outside?

If that is the case, maybe you can make a remote forward to access it.

```
# Port forward using plink
plink.exe -l root -pw mysecretpassword 192.168.0.101 -R 8080:127.0.0.1:8080

# Port forward using meterpreter
portfwd add -l <attacker port> -p <victim port> -r <victim ip>
portfwd add -l 3306 -p 3306 -r 192.168.1.101
```

So how should we interpret the netstat output?

**Local address 0.0.0.0**\
Local address 0.0.0.0 means that the service is listening on all interfaces. This means that it can receive a connection from the network card, from the loopback interface or any other interface. This means that anyone can connect to it.

**Local address 127.0.0.1**\
Local address 127.0.0.1 means that the service is only listening for connection from the your PC. Not from the internet or anywhere else. **This is interesting to us!**

**Local address 192.168.1.9**\
Local address 192.168.1.9 means that the service is only listening for connections from the local network. So someone in the local network can connect to it, but not someone from the internet. **This is also interesting to us!**
