Memory Forensics
Memory Forensics
1 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
Data stored in cache or RAM is called volatile data. This volatile data is not
permanent and can be lost if the power is lost. Volatile data should be
collected immediately. If we touch on the parts where memory analysis is
advantageous compared to other analysis, we can list it as being the most
appropriate analysis technique for detecting harmful activities in the system,
analyzing and tracking current activities on the system, and collecting
evidence that cannot be analyzed in other analysis methods. In addition, it is
the most suitable analysis method for the examination of advanced malware
(fileless) that executes without writing to disk.
2 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
Structure of KDBG
Another structure in the EPROCESS data struct that we frequently use in our
analyzes to examine active processes is ActiveProcessLinks.
ActiveProcessLinks is a LIST_ENTRY structure and it is a circular doubly link
list pointing to the node in the next EPROCESS for a different process. This
structure connects all processes running in memory. The pslist plugin we
3 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
use to list the processes in memory will analyze the list executed by
ActiveProcessLink and pointed by PsActiveProcessHead. If the attackers
unlink their malicious processes via the double-linked list, the related
processes cannot be viewed via the pslist plugin.
Where do i start?
In order to detect the first anomaly in the image, we can start by analyzing
the processes, which are the most important objects in the memory. Thus,
after a suspicious process is detected, we can determine our analysis plan
and see other suspicious occurrences.
4 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
the context. Many tools use KDBG structures to identify context in Windows
memory images. Imageinfo plugin in the Volatility tool searches the memory
image and looks for the KDBG signature. Signature of image may not be
specific to a single version of OS, in this case we can observe many profiles
on output. If there are many profiles compatible with our image after KDBG
scan, we should focus on the profile that gives meaningful output by running
the pslist plugin on the profiles in the list. If the KDBG hit is a false positive,
the number of processes and modules will be zero, compared to reasonable
number in case of true KDBG.
5 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
After listing operations with the pslist plugin in cases where no process appears on
the memory image we received from the system and we think it has the specific
operating system (the pslist plugin analyzes the first KDBG in memory via the
process list header), the profile obtained using the imageinfo plugin can be cross-
checked using the kdbgscan plugin.
After choosing the most suitable profile for the image we have, we can start
the analysis.
We can use the pslist, psscan, pstree and psxview plugins on Volatility to list
the processes on the image. We may observe differences between the
outputs as each analyzes on different structures.
pslist : It is used to list the processes on the image we have obtained. This
plugin walks the linked list that is pointed by PsActiveProcessHead and is
run by ActiveProcessLink. Additionally, it shows the offset at which the
process was started and terminated, the process name, the process ID, the
parent process ID, the thread count, the handle count, and the date/time.
6 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
As mentioned above, Windows uses the double linked list in the EPROCESS
structure to track all active processes. This area, called ActiveProcessLinks,
contains the flink and blink pointers. The Flink (forward link) points to the
_LIST_ENTRY of the next _EPROCESS structure, and the Blink (backward link)
points to the _LIST_ENTRY of the previous _EPROCESS structure.
7 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
API. After creating a new process, it checks whether the path is included in
the global process list, then connects the flink of the process to its blink and
removes it via ActiveProcessLink of the process. When the process is
removed via ActiveProcessLink, it will not be seen in programs such as Task
Manager, and it will not be included in the pslist plugin on Volatility.
Structure of Flink/Blink
8 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
psscan : The psscan plugin doesn’t trust the linked list (called
ActiveProcessLinks) of the processes. Instead searches memory by
heuristically looking for EPROCESS structure that represent processes. Using
the Psscan plugin pool tag scaninng, it can find processes that are hidden
by malware and terminated processes. Pool tag scanning was originally
used for discovering structures associated with processes and threads, but is
now widely used to target many kinds of data structures. It is particularly
effective in detecting direct kernel object manipulation (DKOM), which is
commonly used by malware to hide processes by removing references to
the _EPROCESS allocation from other data structures.
9 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
psxview : EPROCESS kernel structure is not the only (kernel) object that
holds information aboutprocesses running on the system. From the nature
of Windows OS, this information is maintained at several other locations.
Psxview is a plugin designed for this reason and provides detailed
information about running processes. In addition to providing information
about running processes, it collects data from the following structures.
• PspCid is a special table in memory that stores reference for all active
and threads objects. This table can be manipulated to remove any
process, thread reference.
• Session and Desktop : Session will attach all the process to a particular
user session, and desktop will find each thread attached to the desktop
which can be mapped to its owning process.
10 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
11 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
If process needs to access any object such as a file, registry key, process,
output.
thread, it must first create a handle. Then the process can access the object
referenced by the handle using this handle. Using these outputs, other
objects that the suspected process interacts with can be detected.
Wow64 processes have a limited list of DLLs in the PEB lists, but that doesn’t
mean they’re the only DLLs loaded in the process address space. Thus
Volatility will remind you to use the ldrmodules instead for these processes.
12 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
dlldump : This plugin used with pid parameter to export DDL files for a
13 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
specific process and used with offset parameter to export DLL files related to
a hidden or unline process. Since code injection or malicious unlinking
process may not appear in the dll list, we prefer use base parameter to
examine that.
14 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
information during the analysis, and many attackers imitate the version
information of malicious PE files with legit processes.
15 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
getsid : This plugin displays SIDs associated with a process. It can help us
identify processes which have maliciously escalated privileges and which
processes belong to specific users.
16 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
We often see conhost.exe launching simultaneously with command line tools like
cmd and powershell. Conhost.exe acts as a buffer for command line commands,
such as bash history on Unix systems. Command line history can be accessed by
examining the memory space of the conhost.exe process.
memmap : This plugin displays exactly which pages are memory resident,
given a specific process DTB. It shows the virtual address of the page, the
corresponding physical offset of the page, and the size of the page.
17 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
VAD is a structure that we often need during process memory analysis. The Virtual
Address Descriptor (VAD) tree is used by the Windows memory manager to
describe memory ranges used by a process as they are allocated. When a process
18 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
allocates memory with VitualAlloc, the memory manager creates an entry in the
VAD tree. The corresponding page directory and page table entries are not created
until the process tries to referance that memory page, which can provide
significant memory saving for processes that allocate a large amount of memory
but access it sparsely. For example, one of user-mode rootkit is capable of injecting
libraries into processes and then hiding the injected DLLs by unlinking them from
the module list stored in the PEB. Such modification of the PEB, does not affect
the VAD tree, and the loaded DLL can be seen as a mapped file in the address
space of the affected process using vadinfo, such evidence can not be found with
tools that simply walk the PEB’s module list. By looking at the VAD tree, an
examiner can also say whether such string occured in a loaded DLL, a
dynamically allocated memory region, or the process execuable itself.
19 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
20 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
vadtree : This plugin uses to display the VAD nodes in a visual tree form.
vaddump : This plugin uses to extract the range of pages described by a VAD
node. This is similar to memdump, except the pages belonging to each VAD
node are placed in separate files (named according to the starting and
ending addresses) instead of one large conglomerate file.
connections : This plugin uses to view TCP connections that were active at
the time of the memory acquisition. It is for x86 and x64 Windows XP and
Windows 2003 Server only.
21 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
connscan : This plugin can find artifacts from previous connections that
have since been terminated, in addition to the active ones. It is for x86 and
x64 Windows XP and Windows 2003 Server only.
sockets : This plugin uses to detect listening sockets for any protocol. It is for
x86 and x64 Windows XP and Windows 2003 Server only.
netscan : This plugin uses to scan for network artifacts in 32- and 64-bit
Windows Vista, Windows 2008 Server and Windows 7 memory dumps. This
finds TCP endpoints, TCP listeners, UDP endpoints, and UDP listeners. The
output also includes local and remote IP addresses, the status of the socket,
and the time the connection was established.
22 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
Usage of VolShell
After specifying the physical offset with the cc command (can be obtained
from the psxview output), we can access the information about the process
on the EPROCESS structure.
23 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
We can determine the forward process by obtaining the flink and blink
offset values of the processes that unlike themselves from the
ActiveProcessLink list.
Blink/Flink Analysis
Another analysis that I frequently use the volshell module for is command
lines of processes that cannot be detected by AV/EDR. After we find the PEB
24 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
25 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
26 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
After exporting the suspicious file with the procdump plugin, the hash
information was checked on the VT and it was found to be associated with
emotet by many authorities.
27 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
Emotet related iocs was also detected when a string search was performed
on the file.
28 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
The dlllist plugin was used to list the DLL files related to the file we are
reviewing. Then, using the malfind plugin, it was determined whether there
are hidden DLL files.
29 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
The malfind command aims to find hidden or injected code/DLL files based on the
VAD tag and page permissions. However, the malfind plugin cannot list DLLs
added to the process using the CreateRemoteThread and LoadLibrary functions.
We can display the DLLs added with this method using the dlllist plugin.
We are displaying one function and two executables files in the output of the
malfind plugin. We can also display the outputs that we display via the
malfind plugin via the vadinfo plugin, but the fact that there are too many
VAD nodes being examined makes our analysis difficult. We can say that the
malfind plugin brings us objects that it considers suspicious in the VAD. At
this point, we are detecting that there are 2 PE injected into the harmful
process.
30 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
The protected area in the VAD specifies the type of access allowed to the memory
region. The following are memory protection options:
31 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
32 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
should not be both executable and writable. If a suspicious process has both,
• eforensicsmag.com/windows-process-internals-a-few-concepts-to-know-before-
then it may have code that would alter parts of itself while executing.
jumping-on-memory-forensics-by-kirtar-oza/
• resources.infosecinstitute.com/topic/finding-and-enumerating-processes-
As a result of our analysis, we can clearly detect that 2 PE files were injected
within-memory-part-1/
into the memory of the malicious process.
• sciencedirect.com/science/article/pii/S1742287607000503
Happy hunting �
48 Followers
www.linkedin.com/in/alpbatursahin/
33 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
34 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
35 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
Lists
36 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
Mar 27 3 Jun 15
37 of 38 7/4/2024, 11:13 AM
Investigating Memory Forensic -Processes, DLLs, Consoles, Process Memory and Networking... https://alpbatursahin.medium.com/investigating-memory-forensic-processes-dlls-consoles-pro...
montysecurity Olympix
Mar 1 57 Jan 17 62
See more recommendations
Help Status About Careers Press Blog Privacy Terms Text to speech Teams
38 of 38 7/4/2024, 11:13 AM