Windows Forensics

Identify persistent threats on a comrpomised Windows machine

By Ren Sie

Refer to Investigating Windows for the challenge room on TryHackMe

Scenario

This challenge involves investigating a previously compromised Windows machine, presenting several key obstacles.

Tasks

By going to "About" in Windows settings, we can find the machine's version and year.

To identify successful logon processes in the Windows Event Log, we will filter for Event ID 4624. Then, we'll check the Security event date before our logon session (2024/11/2) to find the last logged-in user.

Note: Event ID 4625 indicates a failed logon attempt.

To determine when the user "John" last logged onto the system, use utility net.

C:\> net user <username>

Note: “Net” is a CLI tool in Windows used for network-related tasks. It can manage network resources, user accounts, and share files or printers.

I first searched for the DHCP server IP address, which was incorrect. Then I navigated to the SOFTWARE Registry Key (Microsoft\Windows\CurrentVersion\Run), which contains entries for executables that run automatically at startup, and found the correct IP address.

Note: This command executes p.exe with the -s flag, which typically indicates a silent or specific mode of operation. It runs the net user command on a remote machine at IP address 10.34.2.3 and outputs the result to a text file named o2.txt in the same C:\TMP directory.

We can list all accounts in the Administrators group using the PowerShell:

PS C:\> Get-LocalGroupMember -Group "Administrators"

Upon reviewing the scheduled tasks in Task Scheduler, I identified three that appear suspicious.

The previous screenshot shows a task scheduled to run daily. Clicking on the task reveals more details.

Refer to the previous screenshot.

Note: -l indicates listen.

Regarding the third task, we used it to identify John's last logon time.

C:\> net user <username>

Reviewing the creation dates of the scheduled tasks suggests that this is likely the initial compromise date, as attackers typically implement persistence mechanisms after breaching a system.,

While investigating the security logs from the compromise period (3/2/2019, 16:00 – 17:00) and Event ID 4672, which records users logging on with special privileges, we tracked down the event related to the special logon.

Note: Event ID 4672 signifies that a logon session was created with elevated privileges. In this case, it was initiated by the SYSTEM account.
The PrivilegeList shows the specific privileges assigned, which include important rights like SeDebugPrivilege and SeImpersonatePrivilege, indicating that the logon was granted administrator control over the system.

While investigating scheduled tasks in Task Scheduler, I noticed a task named "GameOver" that executes mim.exe every five minutes. Analyzing the arguments reveals it is associated with a known password extraction tool.

NOTE: The command extract and display stored logon credentials from the Windows memory, specifically focusing on the password information of logged-on users. Then it stores the extracted credentials to o.txt

While investigating task #4, I noticed an unusual IP address linked to google.com in the DNS host file (C:\Windows\System32\drivers\etc), likely indicating an external C2 server.

After investigating another suspicious directory (C:\inetpub\wwwroot), I found several .jsp files likely associated with file extraction. Which the attacker leveraged the JSP file on the victim machine to facilitate data exfiltration to the external server.

NOTE: According to Introduction to JSP on Geeksforgeeks, JSP is used in Java for building dynamic web applications. It combines HTML and Java code, allowing developers to create interactive web pages. When a JSP page is requested, it is first converted into a Java program (a servlet) by the server before being sent to the user.

Following the hint to investigate the firewall, we found several rules allowing unusual local ports to remain open. And one of them is the answer.

Refer to task #13 for the domain affected by DNS poisoning.

Share: X (Twitter) Facebook LinkedIn