Skip to content

Commit ada3ddc

Browse files
committed
update Module Memory Analysis
1 parent ea37773 commit ada3ddc

File tree

3 files changed

+249
-1
lines changed

3 files changed

+249
-1
lines changed
622 KB
Loading

docs/Modules/Memory Analysis/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Analyze a memory dump of a Windows host and uncover malicious processes.
2424

2525
Trace user behavior, command execution, file access, and macro-based payload delivery from memory.
2626

27-
## Windows Memory & Network
27+
## [Windows Memory & Network](windowsmemoryandnetwork.md)
2828

2929
Identify C2 traffic & post-exploit activity in Windows memory.
3030

Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
---
2+
sidebar_position: 5
3+
---
4+
5+
# Windows Memory & Network
6+
7+
## Task 1 Introduction
8+
9+
This room continues the memory investigation from the previous analysis. This is the last room out of 3, and we will be focusing on how network activity and post-exploitation behavior are captured in RAM. We’ll examine artifacts from a live attack involving advance payloads like Meterpreter, suspicious child processes, and unusual outbound connections. All analyses will be performed using Volatility 3 and hands-on techniques applied directly to the memory dump.
10+
11+
We’ll walk through real indicators tied to remote shells, persistence via startup folder abuse, and malware attempting outbound communications. Users will use memory structures, plugin outputs, and process inspection to track network behavior step by step.
12+
13+
### Learning Objectives
14+
15+
- Identify network connections in a memory dump.
16+
- Identify suspicious ports and remote endpoints.
17+
- Link connections to processes.
18+
- Detect reverse shells and memory injections in a memory dump.
19+
- Trace PowerShell and C2 activity in memory.
20+
21+
### Prerequisites
22+
23+
- [Volatility](https://tryhackme.com/room/volatility)
24+
- [Yara](https://tryhackme.com/room/yara)
25+
- [Windows Memory & Processes](https://tryhackme.com/room/windowsmemoryandprocs)
26+
- [Windows Memory & User Activity](https://tryhackme.com/room/windowsmemoryanduseractivity)
27+
28+
:::info Answer the questions below
29+
30+
<details>
31+
32+
<summary> Click to continue to the room. </summary>
33+
34+
```plaintext
35+
No answer needed
36+
```
37+
38+
</details>
39+
40+
:::
41+
42+
## Task 2 Scenario Information
43+
44+
### Scenario
45+
46+
You are part of the incident response team handling an incident at TryHatMe - a company that exclusively sells hats online. You are tasked with analyzing a full memory dump of a potentially compromised Windows host. Before you, another analyst had already taken a full memory dump and gathered all the necessary information from the TryHatMe IT support team. You are a bit nervous since this is your first case, but don't worry; a senior analyst will guide you.
47+
48+
### Information Incident THM-0001
49+
50+
- On May 5th, 2025, at 07:30 CET, TryHatMe initiated its incident response plan and escalated the incident to us. After an initial triage, our team found a Windows host that was potentially compromised. The details of the host are as follows:
51+
- Hostname: WIN-001
52+
- OS: Windows 1022H 10.0.19045
53+
- At 07:45 CET, our analyst Steve Stevenson took a full memory dump of the Windows host and made a hash to ensure its integrity. The memory dump details are:
54+
- Name: `THM-WIN-001_071528_07052025.dmp`
55+
- MD5-hash: `78535fc49ab54fed57919255709ae650`
56+
57+
### Company Information TryHatMe
58+
59+
#### Network Map
60+
61+
![Image showing the current scenario as a network diagram with the DMZ internal, User LAN and Server Lan networks ](img/image_20251221-092118.png)
62+
63+
:::info Answer the questions below
64+
65+
<details>
66+
67+
<summary> I went through the case details and am ready to find out more. </summary>
68+
69+
```plaintext
70+
No answer needed
71+
```
72+
73+
</details>
74+
75+
:::
76+
77+
## Task 3 Environment & Setup
78+
79+
Before moving forward, start the VM by clicking the **Start Machine** button on the right.
80+
81+
It will take around 2 minutes to load properly. The VM will be accessible on the right side of the split screen. If the VM is not visible, use the blue **Show Split View** button at the top of the page.
82+
83+
The details for the assignment are:
84+
85+
- File Name: **THM-WIN-001_071528_07052025.mem**
86+
- File MD5 Hash: **78535fc49ab54fed57919255709ae650**
87+
- File Location: `/home/ubuntu`
88+
89+
To run volatility, you can use the `vol` command in the VM. For example: `vol -h` will display the help menu for volatility.
90+
91+
:::info Answer the questions below
92+
93+
<details>
94+
95+
<summary> Click here if you were able to start your environment. </summary>
96+
97+
```plaintext
98+
No answer needed
99+
```
100+
101+
</details>
102+
103+
:::
104+
105+
## Task 4 Analyzing Active Connections
106+
107+
In the previous room, we focused on identifying user activity within memory. Now, we shift our attention to network connections established by the suspected malicious actor. We'll begin by searching for artifacts in memory that reveal what connections were made and what kind of network activity took place during the intrusion.
108+
109+
### Scanning Memory for Network Evidence
110+
111+
Let's start by scanning the memory dump with the **Windows.netscan** plugin. This plugin inspects kernel memory pools for evidence of **TCP** and **UDP** socket objects, regardless of whether the connections are still active. It's beneficial in cases where the process we are investigating may have terminated or cleaned up connections.
112+
113+
To inspect the network connections, volatility locates the [EPROCESS](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/eprocess#eprocess) structure to extract PIDs and map these to active **TCP ENDPOINT** or **UDP ENDPOINT** objects (undocumented) found in memory. This approach works even if a connection has already been closed, making it more useful than **netstat** on a live system.
114+
115+
When analysing connections to look for supicious traffic, we should be aware of the following:
116+
117+
- Unusual port activity or outbound connections to unfamiliar addresses
118+
- Communication with external IPs on non-standard ports
119+
- Local processes holding multiple sockets
120+
- PIDs tied to previously identified suspicious binaries
121+
122+
Let's look for the patterns mentioned above. We'll start by running the following command `vol -f THM-WIN-001_071528_07052025.mem windows.netscan > netscan.txt`, which will save the output in the `netscan.txt` file as shown below. We can then inspect it using the `cat` command or any text visualizer.
123+
124+
**Note**: This command can take some time to finish, depending on CPU usage and the size of the memory dump. In case you do not want to wait, you can access the same output in the already existing file **netscan-saved.txt**. There are also some other commands that have been pre-saved to save time if needed.
125+
126+
```shell title="Example Terminal"
127+
user@tryhackme~$ vol -f THM-WIN-001_071528_07052025.mem windows.netscan > netscan.txt
128+
user@tryhackme$cat netscan.txt
129+
130+
Offset Proto LocalAddr LocalPort ForeignAddr ForeignPort State PID Owner Created
131+
[REDACTED]
132+
0x990b28ae34c0 UDPv4 169.254.106.169 138 * 0 4 System 2025-05-07 07:08:58.000000 UTC
133+
0x990b28bf3230 TCPv4 169.254.106.169 139 0.0.0.0 0 LISTENING 4 System 2025-05-07 07:08:58.000000 UTC
134+
0x990b28bf3650 TCPv4 0.0.0.0 4443 0.0.0.0 0 LISTENING 10084 windows-update 2025-05-07 07:13:05.000000 UTC
135+
[REDACTED]
136+
0x990b299a81f0 UDPv4 127.0.0.1 1900 * 0 9496 svchost.exe 2025-05-07 07:09:11.000000 UTC
137+
0x990b29ab8010 TCPv4 192.168.1.192 [REDACTED] 192.168.0.30 22 ESTABLISHED 6984 powershell.exe 2025-05-07 07:15:15.000000 UTC
138+
0x990b29ade8a0 TCPv4 192.168.1.192 4443 10.0.0.129 47982 ESTABLISHED 10084 windows-update 2025-05-07 07:13:35.000000 UTC
139+
0x990b2a32ca20 TCPv4 192.168.1.192 [REDACTED] 10.0.0.129 8081 ESTABLISHED 10032 updater.exe [REDACTED] UTC
140+
0x990b2a630a20 TCPv6 ::1 55986 ::1 445 CLOSED 4 System 2025-05-07 07:14:06.000000 UTC
141+
0x990b2a824770 UDPv6 fe80::185b:1837:f9f7:bffd 49595 * 0 9496 svchost.exe 2025-05-07 07:09:11.000000 UTC
142+
0x990b2a824900 UDPv6 fe80::185b:1837:f9f7:bffd 1900 * 0 9496 svchost.exe 2025-05-07 07:09:11.000000 UTC
143+
0x990b2a824db0 UDPv6 ::1 1900 * 0 9496 svchost.exe 2025-05-07 07:09:11.000000 UTC
144+
[REDACTED]
145+
```
146+
147+
We can observe in the output above that some connections are marked as **ESTABLISHED**. We can notice that PID **10032** (**updater.exe**) is connected to IP **10.0.0.129 on port 8081**. That is an external network and suggests it may be the attacker's infrastructure. Another connection of interest is from PID **6984** (**powershell.exe**) reaching out to **192.168.0.30:22**, suggesting lateral movement. Also, as we know from previous analysis, the binary windows-update.exe is also part of the chain of execution we are investigating and was placed for persistence purposes in the `C:\Users\operator\AppData\Roaming\Microsoft\Windows\StartMenu\Programs\Startup\` directory. It is listening on port **4443**, which makes sense to be set up like that since it seems to be the one listening for instructions. Let’s now move on to confirm this and spot which active listening ports are.
148+
149+
```shell title="Example Terminal"
150+
user@tryhackme~$ cat netscan.txt |grep LISTENING
151+
0x990b236b3310 TCPv4 0.0.0.0 445 0.0.0.0 0 LISTENING 4 System 2025-05-07 07:08:50.000000 UTC
152+
[REDACTED]
153+
0x990b27ffee90 TCPv4 0.0.0.0 3389 0.0.0.0 0 LISTENING 364 svchost.exe 2025-05-07 07:08:49.000000 UTC
154+
0x990b27ffee90 TCPv6 :: 3389 :: 0 LISTENING 364 svchost.exe 2025-05-07 07:08:49.000000 UTC
155+
0x990b28bf3230 TCPv4 169.254.106.169 139 0.0.0.0 0 LISTENING 4 System 2025-05-07 07:08:58.000000 UTC
156+
0x990b28bf3650 TCPv4 0.0.0.0 4443 0.0.0.0 0 LISTENING 10084 windows-update 2025-05-07 07:13:05.000000 UTC
157+
0x990b28de7e10 TCPv4 0.0.0.0 49671 0.0.0.0 0 LISTENING 3020 svchost.exe 2025-05-07 07:08:51.000000 UTC
158+
0x990b28de80d0 TCPv4 0.0.0.0 49671 0.0.0.0 0 LISTENING 3020 svchost.exe 2025-05-07 07:08:51.000000 UTC
159+
0x990b28de80d0 TCPv6 :: 49671 :: 0 LISTENING 3020 svchost.exe 2025-05-07 07:08:51.000000 UTC
160+
0x990b28de8390 TCPv4 0.0.0.0 5040 0.0.0.0 0 LISTENING 6124 svchost.exe 2025-05-07 07:08:59.000000 UTC
161+
0x990b28de8910 TCPv4 192.168.1.192 139 0.0.0.0 0 LISTENING 4 System 2025-05-07 07:08:51.000000 UTC
162+
```
163+
164+
We can observe several system processes like **svchost.exe** and **lsass.exe** listening on [common Windows ports](http://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/service-overview-and-network-port-requirements). However, we can also confirm that the only non-standard process listening is **windows-update.exe** (**PID 10084**), which is listening on port **4443**.
165+
166+
This seems to be highly irregular. We already know that the process had established a connection with the potential attacker and is accepting inbound connections. This could be for **file staging**, **secondary payloads**, or as we already confirmed, for **persistence**.
167+
168+
**Note**: As a sanity check, try also running **windows.netstat**. This plugin relies on live system structures instead of scanning memory, so it may return fewer results, but it is useful to compare what's still **active** and also to check the connection's order by timestamp.
169+
170+
Great, at this point, we’ve confirmed:
171+
172+
- **updater.exe** (PID **10032**) was in an active session with a known attacker IP using port **8081**.
173+
- **windows-update.exe** (PID **10084**) had its own established session and was listening on port **4443**.
174+
- **powershell.exe** (PID **6984**) connected to **192.168.0.30:22**, likely the next internal target.
175+
176+
These findings help confirm suspicions of remote control via **C2**, plus lateral movement activity. In the next section, we'll explore more into this in order to confirm our findings.
177+
178+
:::info Answer the questions below
179+
180+
<details>
181+
182+
<summary> What is the remote source port number used in the connection between 192.168.1.192 and 10.0.0.129:8081? </summary>
183+
184+
```plaintext
185+
186+
```
187+
188+
</details>
189+
190+
<details>
191+
192+
<summary> Which internal IP address received a connection on port 22 from the compromised host? </summary>
193+
194+
```plaintext
195+
196+
```
197+
198+
</details>
199+
200+
<details>
201+
202+
<summary> What is the exact timestamp when the connection from the IP addresses in question 1 was established? </summary>
203+
204+
```plaintext
205+
206+
```
207+
208+
</details>
209+
210+
<details>
211+
212+
<summary> What is the local port used by the system to initiate the SSH connection to 192.168.0.30? </summary>
213+
214+
```plaintext
215+
216+
```
217+
218+
</details>
219+
220+
<details>
221+
222+
<summary> What is the protocol used in the connection from 192.168.1.192:55985 to 10.0.0.129:8081? </summary>
223+
224+
```plaintext
225+
226+
```
227+
228+
</details>
229+
230+
<details>
231+
232+
<summary> What is the order in which the potential malicious processes established outbound connections? </summary>
233+
234+
```plaintext
235+
No answer needed
236+
```
237+
238+
</details>
239+
240+
:::
241+
242+
## Task 5 Investigating Remote Access and C2 Communications
243+
244+
## Task 6 Post-Exploitation Communication
245+
246+
## Task 7 Putting it All Together
247+
248+
## Task 8 Conclusion

0 commit comments

Comments
 (0)