# Investigating Windows

This is a challenge that is exactly what is says on the tin, there are a few challenges around investigating a windows machine that has been previously compromised.

Connect to the machine using RDP. The credentials the machine are as follows:

Username: Administrator\
Password: letmein123!

Please note that this machine does not respond to ping (ICMP) and may take a few minutes to boot up.

**1) Whats the version and year of the windows machine?**

There are multiple approaches to solving this question. Let's examine them.

Access the command prompt and run the `winver`command.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FxBT8wsTrhJBwzgqV1RW2%2FScreenshot(17).png?alt=media&#x26;token=b0bf9b90-47a5-4ce2-b3ef-742363ddc562" alt=""><figcaption></figcaption></figure>

Or using `msinfo32` command

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FGVTrApiYr2lN2zZIUyYn%2FScreenshot(18).png?alt=media&#x26;token=c128e98e-ec3f-4f35-b26d-a731b1d49843" alt=""><figcaption></figcaption></figure>

Or through powershell execute `Get-ComputerInfo -Property "os*"`

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fv6PiH0gJlXtXpNZij3mm%2FScreenshot(19).png?alt=media&#x26;token=d0817e36-75b1-4616-937f-ee69533e8bcd" alt=""><figcaption></figcaption></figure>

Answer:  Windows Server 2016

2\) Which user logged in last?

To identify the last user who logged in on a Windows machine, access Event Viewer, locate Security Logs, filter for EventID 4624, and review the most recent logon event.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FNInZ7gk8WhQL65FV3wxc%2FScreenshot(20).png?alt=media&#x26;token=c1035c73-3662-4ee4-8ad8-5e75377e8b9f" alt=""><figcaption></figcaption></figure>

The answer can be obtained also using the `Get-WinEvent` PowerShell cmdlet.

```
 Get-WinEvent -FilterHashtable @{LogName="Security"; ID=4624} | Select-Object -First 5 | Format-List
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FvcILYl1tdKsq7npSxVyr%2FScreenshot(21).png?alt=media&#x26;token=e2bd024d-cbc5-4918-8ecb-25793142b843" alt=""><figcaption></figcaption></figure>

Answer:  Administrator

3\) When did John log onto the system last?

I reviewed the Security Logs in Event Viewer, filtered for EventID 4624, and searched for user John.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FB8OxkscTgFNHaQKeENue%2FScreenshot(22).png?alt=media&#x26;token=26d96b46-13c7-45f3-b2f5-4c6fa430e6d2" alt=""><figcaption></figcaption></figure>

The answer can be obtained also using the `Get-WinEvent` PowerShell cmdlet.

```
Get-WinEvent -FilterHashtable @{LogName="Security"; ID=4624} | Where-Object { $_.Properties[5].Value -eq "John" } | Select-Object -First 1 | Format-List TimeCreated
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FNqfv7yZ6soGsol2N6rcS%2FScreenshot(23).png?alt=media&#x26;token=f04cc3a6-3f47-4b85-818d-58911c1d166b" alt=""><figcaption></figcaption></figure>

4\) What IP does the system connect to when it first starts?

The IP address was located in the Windows Registry under HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FhVjb4mgyHycMDUcbl3Nw%2FScreenshot(24).png?alt=media&#x26;token=6d6c4d3f-ea8c-4833-9d35-5f49240d7ca9" alt=""><figcaption></figcaption></figure>

Alternatively, you can use PowerShell.

```
Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" | Select-Object *
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FmGAvLtROBl5Yu9GmZ0nv%2FScreenshot(68).png?alt=media&#x26;token=5003f66f-42fa-453d-8237-8a9d2e9e27f0" alt=""><figcaption></figcaption></figure>

Answer:  10.34.2.3

5\) What two accounts had administrative privileges (other than the Administrator user)?

```
Get-LocalGroupMember -Group "Administrators"
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FrWBHueWqzgkFU3PW2pe4%2FScreenshot(1).png?alt=media&#x26;token=e6a63aee-866a-41c5-b04d-3b67ab6a9090" alt=""><figcaption></figcaption></figure>

```
net localgroup Administrators
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FWDsE9WIJ8UIRskeATQAR%2FScreenshot(2).png?alt=media&#x26;token=6fc733ce-89cd-471b-8c5b-07e1b0c99f9e" alt=""><figcaption></figcaption></figure>

Answer:  Jenny, Guest

6\) Whats the name of the scheduled task that is malicous.

```
Get-ScheduledTask | Select-Object TaskName, TaskPath, State, Actions | Format-List | Select-Object -First 5
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FiSmn1IiNgSRgwmQNTgZ7%2FScreenshot(3).png?alt=media&#x26;token=66a1ea36-af84-4f3c-8677-547fc2a9ac09" alt=""><figcaption></figcaption></figure>

Or we can use Task Scheduler

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FB6jBH3vmUudHIMOjeKGF%2FScreenshot(10).png?alt=media&#x26;token=010ab47f-12de-47c3-8163-eb304dadd90e" alt=""><figcaption></figcaption></figure>

Answer:  Clean file system

7\) What file was the task trying to run daily?

To determine what file the "Clean file system" task is attempting to run daily, you can examine the details of this scheduled task using PowerShell. Here’s how you can do it:

```
Get-ScheduledTask -TaskName "Clean file system" | Select-Object -ExpandProperty Actions
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FroGiuShYklWSAZoZ2fj9%2FScreenshot(4).png?alt=media&#x26;token=0a737029-79a2-454d-81c6-d67c75ca71a5" alt=""><figcaption></figcaption></figure>

Answer:  nc.ps1

8\) What port did this file listen locally for?

Refer to the output from the previous question. The port number is listed in the Arguments column.

Answer:  1348

9\) When did Jenny last logon?

```
net user jenny
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F7g478dGWuUMeMoTf7uSO%2FScreenshot(7).png?alt=media&#x26;token=2678b7ab-d1e2-4c0e-92e6-80903f283665" alt=""><figcaption></figcaption></figure>

The answer can be obtained also using the `Get-WinEvent` PowerShell cmdlet.

```
Get-WinEvent -FilterHashtable @{LogName="Security"; Id=4624} | Where-Object {$_.Properties[5].Value -eq "Jenny"} | Select-Object TimeCreated -First 1
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fpa7XCwfdwZfW8mdq0smN%2FScreenshot(6).png?alt=media&#x26;token=d56dddc0-14d4-4023-a261-1089dc1cca0e" alt=""><figcaption></figcaption></figure>

I attempted to retrieve Jenny's last login time using Get-WinEvent, but the command produced no output.

Answer:  Never

10\)  At what date did the compromise take place?

During routine system, I discovered an unexpected directory on the C:\ drive containing potentially suspicious files.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FHT23H12CCUyksdP9d2NC%2FScreenshot(8).png?alt=media&#x26;token=748cd4ee-772e-4c46-a44c-2ceab5c102b6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FsVVLLebSPYlBXcfIajiv%2FScreenshot(9).png?alt=media&#x26;token=7bc6d3a7-6e5a-41e0-89b5-760a63f1c360" alt=""><figcaption></figcaption></figure>

Answer:  03/02/2019

11\) During the compromise, at what time did Windows first assign special privileges to a new logon?

I filtered between 4:00 PM and 4:30 PM on March 2, 2019, during the time of the attack.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FyvczslqNqNBlNsIUYSun%2FScreenshot(69).png?alt=media&#x26;token=fc416798-afe7-4aa2-951a-d3aa662bb82c" alt=""><figcaption></figcaption></figure>

Answer:  03/02/2019 4:04:49 PM

12\) What tool was used to get Windows passwords?

Answer:  Mimikatz

13\) What was the attackers external control and command servers IP?

Navigate to the 'C:\Windows\System32\drivers\etc' directory to access the hosts file. This file acts as a local DNS, allowing your machine to associate hostnames with IP addresses.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FcQAne1x21wK0qf58EhuX%2FScreenshot(70).png?alt=media&#x26;token=a5307a78-0820-435c-a194-1e50fb6a63c7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2F2GA4KUWUcuDJ75fMjIGk%2FScreenshot(71).png?alt=media&#x26;token=fe0a651f-c6d7-4cc7-be70-1613bd03f1cf" alt=""><figcaption></figcaption></figure>

Answer:  76.32.97.132

13\) What was the extension name of the shell uploaded via the servers website?

```
Get-ChildItem -Path "C:\inetpub\wwwroot\" | Select-Object Name, Extension
```

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FHK1e5nGvkJ8avDE3wC1u%2FScreenshot(73).png?alt=media&#x26;token=9ebea76b-b875-4f27-b600-8db2eff942da" alt=""><figcaption></figcaption></figure>

Answer:  .jsp

14\) What was the last port the attacker opened?

Let’s begin by accessing the firewall settings.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FT2yopzBLLEX6KT64vt12%2FScreenshot(75).png?alt=media&#x26;token=a45a1af9-5ea6-4661-9313-b94e386025d9" alt=""><figcaption></figcaption></figure>

First, navigate to ‘Inbound Rules’ on the left. There, you’ll find the initial rule, which allows external connections for development purposes.

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2Fn4wEnjcMUejLvbigPjyD%2FScreenshot(76).png?alt=media&#x26;token=a274c91c-4794-4970-b8ed-b26995623b64" alt=""><figcaption></figcaption></figure>

Next, right-click on this rule and select `Properties` Then, choose `Protocols and Ports.`

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FDVTpEEOdMBgxxVMBOcRK%2FScreenshot(77).png?alt=media&#x26;token=53397845-cf7b-42d4-ae14-4fcee5398a52" alt=""><figcaption></figcaption></figure>

Answer:  1337

15\) Check for DNS poisoning, what site was targeted?

<figure><img src="https://2537271824-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIswWWP3l0rGuQmG2WUcr%2Fuploads%2FEAD4Quz6XRKjndp0sd8P%2FScreenshot(78).png?alt=media&#x26;token=aea40caa-aff8-4ddb-a841-2b44032e8a40" alt=""><figcaption></figcaption></figure>

Answer:  google.com


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://faresbltagy.gitbook.io/footprintinglabs/tryhackme-rooms/investigating-windows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
