pythonautoVolatility.py-fMEMFILE-dOUT_DIRECTORY-e/home/user/tools/volatility/vol.py# Will use most important plugins (could use a lot of space depending on the size of the memory)
Volatility has two main approaches to plugins, which are sometimes reflected in their names. “list” plugins will try to navigate through Windows Kernel structures to retrieve information like processes (locate and walk the linked list of _EPROCESS structures in memory), OS handles (locating and listing the handle table, dereferencing any pointers found, etc). They more or less behave like the Windows API would if requested to, for example, list processes.
That makes “list” plugins pretty fast, but just as vulnerable as the Windows API to manipulation by malware. For instance, if malware uses DKOM to unlink a process from the _EPROCESS linked list, it won’t show up in the Task Manager and neither will it in the pslist.
“scan” plugins, on the other hand, will take an approach similar to carving the memory for things that might make sense when dereferenced as specific structures. psscan for instance will read the memory and try to make out _EPROCESS objects out of it (it uses pool-tag scanning, which is basically searching for 4-byte strings that indicate the presence of a structure of interest). The advantage is that it can dig up processes that have exited, and even if malware tampers with the _EPROCESS linked list, the plugin will still find the structure lying around in memory (since it still needs to exist for the process to run). The downfall is that “scan” plugins are a bit slower than “list” plugins, and can sometimes yield false-positives (a process that exited too long ago and had parts of its structure overwritten by other operations).
As explained inside the readme you need to put the symbol table of the OS you want to support inside volatility3/volatility/symbols.
Symbol table packs for the various operating systems are available for download at:
If you want to use a new profile you have downloaded (for example a linux one) you need to create somewhere the following folder structure: plugins/overlays/linux and put inside this folder the zip file containing the profile. Then, get the number of the profiles using:
In the previous chunk you can see that the profile is called LinuxCentOS7_3_10_0-123_el7_x86_64_profilex64 , and you can use it executing something like:
As opposed to imageinfo which simply provides profile suggestions, kdbgscan is designed to positively identify the correct profile and the correct KDBG address (if there happen to be multiple). This plugin scans for the KDBGHeader signatures linked to Volatility profiles and applies sanity checks to reduce false positives. The verbosity of the output and number of sanity checks that can be performed depends on whether Volatility can find a DTB, so if you already know the correct profile (or if you have a profile suggestion from imageinfo), then make sure you use it (from here).
Always take a look in the number of procceses that kdbgscan has found. Sometimes imageinfo and kdbgscan can find more than one suitable profile but only the valid one will have some process related (This is because in order to extract processes the correct KDBG address is needed)
The kernel debugger block (named KdDebuggerDataBlock of the type _KDDEBUGGER_DATA64, or KDBG by volatility) is important for many things that Volatility and debuggers do. For example, it has a reference to the PsActiveProcessHead which is the list head of all processes required for process listing.
OS Information
#vol3 has a plugin to give OS information (note that imageinfo from vol2 will give you OS info)./vol.py-ffile.dmpwindows.info.Info
The plugin banners.Banners can be used in vol3 to try to find linux banners in the dump.
./vol.py-ffile.dmpwindows.hashdump.Hashdump#Grab common windows hashes (SAM+SYSTEM)./vol.py-ffile.dmpwindows.cachedump.Cachedump#Grab domain cache hashes inside the registry./vol.py-ffile.dmpwindows.lsadump.Lsadump#Grab lsa secrets
volatility--profile=Win7SP1x86_23418hashdump-ffile.dmp#Grab common windows hashes (SAM+SYSTEM)volatility--profile=Win7SP1x86_23418cachedump-ffile.dmp#Grab domain cache hashes inside the registryvolatility--profile=Win7SP1x86_23418lsadump-ffile.dmp#Grab lsa secrets
Memory Dump
The memory dump of a process will extract everything of the current status of the process. The procdump module will only extract the code.
Try to find suspicious processes (by name) or unexpected child processes (for example a cmd.exe as a child of iexplorer.exe).
It could be interesting to compare the result of pslist with the one of psscan to identify hidden processes.
python3vol.py-ffile.dmpwindows.pstree.PsTree# Get processes tree (not hidden)python3vol.py-ffile.dmpwindows.pslist.PsList# Get process list (EPROCESS)python3vol.py-ffile.dmpwindows.psscan.PsScan# Get hidden process list(malware)
volatility--profile=PROFILEpstree-ffile.dmp# Get process tree (not hidden)volatility--profile=PROFILEpslist-ffile.dmp# Get process list (EPROCESS)volatility--profile=PROFILEpsscan-ffile.dmp# Get hidden process list(malware)volatility--profile=PROFILEpsxview-ffile.dmp# Get hidden process list
Dump proc
./vol.py-ffile.dmpwindows.dumpfiles.DumpFiles--pid<pid>#Dump the .exe and dlls of the process in the current directory
python3vol.py-ffile.dmpwindows.cmdline.CmdLine#Display process command-line arguments
volatility--profile=PROFILEcmdline-ffile.dmp#Display process command-line argumentsvolatility--profile=PROFILEconsoles-ffile.dmp#command history by scanning for _CONSOLE_INFORMATION
Commands entered into cmd.exe are processed by conhost.exe (csrss.exe prior to Windows 7). So even if an attacker managed to kill the cmd.exeprior to us obtaining a memory dump, there is still a good chance of recovering history of the command line session from conhost.exe’s memory. If you find something weird (using the consoles modules), try to dump the memory of the conhost.exe associated process and search for strings inside it to extract the command lines.
Environment
Get the env variables of each running process. There could be some interesting values.
python3vol.py-ffile.dmpwindows.envars.Envars [--pid <pid>]#Display process environment variables
volatility--profile=PROFILEenvars-ffile.dmp [--pid <pid>]#Display process environment variablesvolatility--profile=PROFILE-ffile.dmplinux_psenv [-p <pid>]#Get env of process. runlevel var means the runlevel where the proc is initated
Token privileges
Check for privileges tokens in unexpected services.
It could be interesting to list the processes using some privileged token.
#Get enabled privileges of some processespython3vol.py-ffile.dmpwindows.privileges.Privs [--pid <pid>]#Get all processes with interesting privilegespython3vol.py-ffile.dmpwindows.privileges.Privs|grep"SeImpersonatePrivilege\|SeAssignPrimaryPrivilege\|SeTcbPrivilege\|SeBackupPrivilege\|SeRestorePrivilege\|SeCreateTokenPrivilege\|SeLoadDriverPrivilege\|SeTakeOwnershipPrivilege\|SeDebugPrivilege"
#Get enabled privileges of some processesvolatility--profile=Win7SP1x86_23418privs--pid=3152-ffile.dmp|grepEnabled#Get all processes with interesting privilegesvolatility--profile=Win7SP1x86_23418privs-ffile.dmp|grep"SeImpersonatePrivilege\|SeAssignPrimaryPrivilege\|SeTcbPrivilege\|SeBackupPrivilege\|SeRestorePrivilege\|SeCreateTokenPrivilege\|SeLoadDriverPrivilege\|SeTakeOwnershipPrivilege\|SeDebugPrivilege"
SIDs
Check each SSID owned by a process.
It could be interesting to list the processes using a privileges SID (and the processes using some service SID).
./vol.py-ffile.dmpwindows.getsids.GetSIDs [--pid <pid>]#Get SIDs of processes./vol.py-ffile.dmpwindows.getservicesids.GetServiceSIDs#Get the SID of services
volatility--profile=Win7SP1x86_23418getsids-ffile.dmp#Get the SID owned by each processvolatility--profile=Win7SP1x86_23418getservicesids-ffile.dmp#Get the SID of each service
Handles
Useful to know to which other files, keys, threads, processes... a process has a handle for (has opened)
./vol.py-ffile.dmpwindows.dlllist.DllList [--pid <pid>]#List dlls used by each./vol.py-ffile.dmpwindows.dumpfiles.DumpFiles--pid<pid>#Dump the .exe and dlls of the process in the current directory process
volatility--profile=Win7SP1x86_23418dlllist--pid=3152-ffile.dmp#Get dlls of a procvolatility--profile=Win7SP1x86_23418dlldump--pid=3152--dump-dir=.-ffile.dmp#Dump dlls of a proc
Strings per processes
Volatility allows to check to which process does a string belongs to.
Windows systems maintain a set of keys in the registry database (UserAssist keys) to keep track of programs that executed. The number of executions and last execution date and time are available in these keys.
./vol.py-ffile.dmpwindows.svcscan.SvcScan#List services./vol.py-ffile.dmpwindows.getservicesids.GetServiceSIDs#Get the SID of services
#Get services and binary pathvolatility--profile=Win7SP1x86_23418svcscan-ffile.dmp#Get name of the services and SID (slow)volatility--profile=Win7SP1x86_23418getservicesids-ffile.dmp
Network
./vol.py-ffile.dmpwindows.netscan.NetScan#For network info of linux use volatility2
volatility--profile=Win7SP1x86_23418netscan-ffile.dmpvolatility--profile=Win7SP1x86_23418connections-ffile.dmp#XPand2003onlyvolatility--profile=Win7SP1x86_23418connscan-ffile.dmp#TCPconnectionsvolatility--profile=Win7SP1x86_23418sockscan-ffile.dmp#Opensocketsvolatility--profile=Win7SP1x86_23418sockets-ffile.dmp#Scannerfortcpsocketobjectsvolatility--profile=SomeLinux-ffile.dmplinux_ifconfigvolatility--profile=SomeLinux-ffile.dmplinux_netstatvolatility--profile=SomeLinux-ffile.dmplinux_netfiltervolatility--profile=SomeLinux-ffile.dmplinux_arp#ARP tablevolatility--profile=SomeLinux-ffile.dmplinux_list_raw#Processes using promiscuous raw sockets (comm between processes)volatility--profile=SomeLinux-ffile.dmplinux_route_cache
Registry hive
Print available hives
./vol.py-ffile.dmpwindows.registry.hivelist.HiveList#List roots./vol.py-ffile.dmpwindows.registry.printkey.PrintKey#List roots and get initial subkeys
volatility--profile=Win7SP1x86_23418-ffile.dmphivelist#List rootsvolatility--profile=Win7SP1x86_23418-ffile.dmpprintkey#List roots and get initial subkeys
volatility--profile=Win7SP1x86_23418printkey-K"Software\Microsoft\Windows NT\CurrentVersion"-ffile.dmp# Get Run binaries registry valuevolatility-ffile.dmp--profile=Win7SP1x86printkey-o0x9670e9d0-K'Software\Microsoft\Windows\CurrentVersion\Run'
Dump
#Dump a hivevolatility--profile=Win7SP1x86_23418hivedump-o0x9aad6148-ffile.dmp#Offset extracted by hivelist#Dump all hivesvolatility--profile=Win7SP1x86_23418hivedump-ffile.dmp
Filesystem
Mount
#See vol2
volatility--profile=SomeLinux-ffile.dmplinux_mountvolatility--profile=SomeLinux-ffile.dmplinux_recover_filesystem#Dump the entire filesystem (if possible)
Scan/dump
./vol.py-ffile.dmpwindows.filescan.FileScan#Scan for files inside the dump./vol.py-ffile.dmpwindows.dumpfiles.DumpFiles--physaddr<0xAAAAA>#Offset from previous command
volatility--profile=Win7SP1x86_23418filescan-ffile.dmp#Scan for files inside the dumpvolatility--profile=Win7SP1x86_23418dumpfiles-n--dump-dir=/tmp-ffile.dmp#Dump all filesvolatility--profile=Win7SP1x86_23418dumpfiles-n--dump-dir=/tmp-Q0x000000007dcaa620-ffile.dmpvolatility--profile=SomeLinux-ffile.dmplinux_enumerate_filesvolatility--profile=SomeLinux-ffile.dmplinux_find_file-F/path/to/filevolatility--profile=SomeLinux-ffile.dmplinux_find_file-i0xINODENUMBER-O/path/to/dump/file
Master File Table
# I couldn't find any plugin to extract this information in volatility3
The NTFS file system contains a file called the master file table, or MFT. There is at least one entry in the MFT for every file on an NTFS file system volume, including the MFT itself. All information about a file, including its size, time and date stamps, permissions, and data content, is stored either in MFT entries, or in space outside the MFT that is described by MFT entries. From here.
SSL Keys/Certs
#vol3 allows to search for certificates inside the registry./vol.py-ffile.dmpwindows.registry.certificates.Certificates
#vol2 allos you to search and dump certificates from memory#Interesting options for this modules are: --pid, --name, --sslvolatility--profile=Win7SP1x86_23418dumpcerts--dump-dir=.-ffile.dmp
Malware
./vol.py-ffile.dmpwindows.malfind.Malfind [--dump] #Find hidden and injected code, [dump each suspicious section]#Malfind will search for suspicious structures related to malware./vol.py-ffile.dmpwindows.driverirp.DriverIrp#Driver IRP hook detection./vol.py-ffile.dmpwindows.ssdt.SSDT#Check system call address from unexpected addresses./vol.py-ffile.dmplinux.check_afinfo.Check_afinfo#Verifies the operation function pointers of network protocols./vol.py-ffile.dmplinux.check_creds.Check_creds#Checks if any processes are sharing credential structures./vol.py-ffile.dmplinux.check_idt.Check_idt#Checks if the IDT has been altered./vol.py-ffile.dmplinux.check_syscall.Check_syscall#Check system call table for hooks./vol.py-ffile.dmplinux.check_modules.Check_modules#Compares module list to sysfs info, if available./vol.py-ffile.dmplinux.tty_check.tty_check#Checks tty devices for hooks
volatility--profile=Win7SP1x86_23418-ffile.dmpmalfind [-D /tmp]#Find hidden and injected code [dump each suspicious section]volatility--profile=Win7SP1x86_23418-ffile.dmpapihooks#Detect API hooks in process and kernel memoryvolatility--profile=Win7SP1x86_23418-ffile.dmpdriverirp#Driver IRP hook detectionvolatility--profile=Win7SP1x86_23418-ffile.dmpssdt#Check system call address from unexpected addressesvolatility--profile=SomeLinux-ffile.dmplinux_check_afinfovolatility--profile=SomeLinux-ffile.dmplinux_check_credsvolatility--profile=SomeLinux-ffile.dmplinux_check_fopvolatility--profile=SomeLinux-ffile.dmplinux_check_idtvolatility--profile=SomeLinux-ffile.dmplinux_check_syscallvolatility--profile=SomeLinux-ffile.dmplinux_check_modulesvolatility--profile=SomeLinux-ffile.dmplinux_check_ttyvolatility--profile=SomeLinux-ffile.dmplinux_keyboard_notifiers#Keyloggers
Scanning with yara
Use this script to download and merge all the yara malware rules from github: https://gist.github.com/andreafortuna/29c6ea48adf3d45a979a78763cdc7ce9
Create the rules directory and execute it. This will create a file called malware_rules.yar which contains all the yara rules for malware.
It's possible to read from memory the bash history. You could also dump the .bash_history file, but it was disabled you will be glad you can use this volatility module
The MBR holds the information on how the logical partitions, containing file systems, are organized on that medium. The MBR also contains executable code to function as a loader for the installed operating system—usually by passing control over to the loader's second stage, or in conjunction with each partition's volume boot record (VBR). This MBR code is usually referred to as a boot loader. From here.