In this task, we assume you have access to cmd
on a Microsoft Windows host. You might have gained this access by exploiting a vulnerability and getting a shell or a reverse shell. You may also have installed a backdoor or set up an SSH server on a system you exploited. In all cases, the commands below require cmd
to run.
In this task, we focus on enumerating an MS Windows host. For enumerating MS Active directory, you are encouraged to check the Enumerating Active Directory room. If you are interested in a privilege escalation on an MS Windows host, we recommend the Windows Privesc 2.0 room.
We recommend that you click โStart AttackBoxโ and โStart Machineโ so that you can experiment and answer the questions at the end of this task.
System
One command that can give us detailed information about the system, such as its build number and installed patches, would be systeminfo
. In the example below, we can see which hotfixes have been installed.
You can check installed updates using wmic qfe get Caption,Description
. This information will give you an idea of how quickly systems are being patched and updated.
You can check the installed and started Windows services using net start
. Expect to get a long list; the output below has been snipped.
If you are only interested in installed apps, you can issue wmic product get name,version,vendor
. If you run this command on the attached virtual machine, you will get something similar to the following output.
Users
To know who you are, you can run whoami
; moreover, to know what you are capable of, i.e., your privileges, you can use whoami /priv
. An example is shown in the terminal output below.
Moreover, you can use whoami /groups
to know which groups you belong to. The terminal output below shows that this user belongs to the NT AUTHORITY\Local account and member of Administrators group
among other groups.
You can view users by running net user
.
You can discover the available groups using net group
if the system is a Windows Domain Controller or net localgroup
otherwise, as shown in the terminal below.
You can list the users that belong to the local administratorsโ group using the command net localgroup administrators
.
Use net accounts
to see the local settings on a machine; moreover, you can use net accounts /domain
if the machine belongs to a domain. This command helps learn about password policy, such as minimum password length, maximum password age, and lockout duration.
Networking
You can use the ipconfig
command to learn about your system network configuration. If you want to know all network-related settings, you can use ipconfig /all
. The terminal output below shows the output when using ipconfig
. For instance, we could have used ipconfig /all
if we wanted to learn the DNS servers.
On MS Windows, we can use netstat
to get various information, such as which ports the system is listening on, which connections are active, and who is using them. In this example, we use the options -a
to display all listening ports and active connections. The -b
lets us find the binary involved in the connection, while -n
is used to avoid resolving IP addresses and port numbers. Finally, -o
display the process ID (PID).
In the partial output shown below, we can see that netstat -abno
showed that the server is listening on TCP ports 22, 135, 445 and 3389. The processessshd.exe
, RpcSs
, and TermService
are on ports 22
, 135
, and 3389
, respectively. Moreover, we can see two established connections to the SSH server as indicated by the state ESTABLISHED
.
You might think that you can get an identical result by port scanning the target system; however, this is inaccurate for two reasons. A firewall might be blocking the scanning host from reaching specific network ports. Moreover, port scanning a system generates a considerable amount of traffic, unlike netstat
, which makes zero noise.
Finally, it is worth mentioning that using arp -a
helps you discover other systems on the same LAN that recently communicated with your system. ARP stands for Address Resolution Protocol; arp -a
shows the current ARP entries, i.e., the physical addresses of the systems on the same LAN that communicated with your system. An example output is shown below. This indicates that these IP addresses have communicated somehow with our system; the communication can be an attempt to connect or even a simple ping. Note that 10.10.255.255
does not represent a system as it is the subnet broadcast address.
Start the attached MS Windows Server if you have not done so already, as you need it to answer the questions below. You can connect to the MS Windows VM via SSH from the AttackBox, for example, using ssh user@10.10.222.213
where the login credentials are:
- Username:
user
- Password:
THM33$$88