Ir al contenido

Volatility 2: Windows commands (Full List with Examples)

Note: --profile=X is mandatory. Example base: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64

0views

Note: --profile=X is mandatory. Example base: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64

  • Description: We identify the OS profile.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw imageinfo
  • Why: To know which -profile we must use for the rest of the analysis.
  • Description: We look for the KDBG block.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw kdbgscan
  • Why: If imageinfo fails, this gives us the correct profile with greater precision.
  • Description: We look for KPCR (Processor Control Region) blocks.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 kpcrscan
  • Why: To analyze the state of each CPU/Core in multicore systems.
  • Description: Hibernation file information.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 hibinfo
  • Why: If we analyze a hiberfil.sys, we need to know its structure to convert it.
  • Description: Crash Dump information.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 crashinfo
  • Why: If we analyze a Blue Screen of Death (BSOD), it tells us the error and the causing driver.
  • Description: We convert raw memory to DMP format.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 raw2dmp --output-file=out.dmp
  • Why: To be able to open the image with Microsoft tools like WinDbg.

We must execute these commands to obtain the necessary information about the operating system and its state at the time of the memory dump. We will use imageinfo to determine the OS profile, kdbgscan and kpcrscan to obtain additional information about the system state, and hibinfo, crashinfo and raw2dmp to analyze hibernation files, crash dumps, and convert raw memory to DMP format, respectively.

  • Description: We list active processes (EPROCESS).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 pslist
  • Why: To quickly see what is running. If malware unlinks itself, it will not appear here.
  • Description: Process tree.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 pstree
  • Why: To detect anomalies in the hierarchy (for example, notepad.exe launching cmd.exe).
  • Description: We scan memory to find processes (Pool scanning).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 psscan
  • Why: To find hidden processes (Rootkits) or processes that have already finished (closed).
  • Description: We compare process lists.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 psxview
  • Why: If pslist is False but psscan is True, then a Rootkit has been detected.
  • Description: We list DLLs of a process.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 dlllist -p 1234
  • Why: To see if a legitimate process loads malicious DLLs or from temporary folders.
  • Description: We extract a DLL from memory.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 dlldump -p 1234 --dump-dir /dumps/
  • Why: To analyze the suspicious DLL with an antivirus or reverse engineering.
  • Description: We detect unlinked DLLs.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 ldrmodules -p 1234
  • Why: If a DLL is in memory but not in the load list (InLoad=False), it is a stealth injection.
  • Description: Execution arguments.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 cmdline
  • Why: To see if a legitimate process is being used maliciously (e.g., svchost.exe -k malware).
  • Description: Environment variables.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 envars -p 1234
  • Why: To see if malware has defined specific paths or configurations for its session.
  • Description: Shows SIDs (users).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 getsids -p 1234
  • Why: To determine if the process is running as SYSTEM, Admin, or a compromised user.
  • Description: Process privileges.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 privs -p 1234
  • Why: To see if malware has enabled SeDebugPrivilege to inject itself elsewhere.
  • Description: Dumping process memory.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 memdump -p 1234 -D /dumps/
  • Why: To analyze all the content of a process's memory (strings, encryption keys).
  • Description: Extracting the executable.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 procdump -p 1234 -D /dumps/
  • Why: To obtain the original .exe of the malware.
  • Description: Searching for code injections (RWX).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 malfind -p 1234
  • Why: It is the #1 tool for finding fileless malware or injected code.
  • Description: VAD (Virtual Address Descriptor) information.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 vadinfo -p 1234
  • Why: For in-depth analysis of how a process uses memory.
  • Description: Scanning with Yara rules.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 yarascan --yara-rules="cadena"
  • Why: To search for known malware signatures throughout memory.
  • Description: We scan connections (Win7+).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 netscan
  • Why: To find malicious remote IPs (C2) and open ports.
  • Description: We scan TCP connections (XP).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=WinXPSP2x86 connscan
  • Why: Equivalent to netscan for legacy systems.
  • Description: We list sockets (XP).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=WinXPSP2x86 sockets
  • Why: To view listening open ports on legacy systems.
  • Description: We list registry keys.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 hivelist
  • Why: To obtain the memory addresses of SAM, SYSTEM, and SOFTWARE for other commands.
  • Description: We print the registry key.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 printkey -K "Run"
  • Why: To check for persistence (programs that start automatically).
  • Description: We extract NTLM hashes.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 hashdump
  • Why: To obtain user passwords for cracking.
  • Description: We analyze UserAssist keys.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 userassist
  • Why: To see which programs the user has executed (even if they have been deleted).
  • Description: Shutdown time.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 shutdowntime
  • Why: To know when the machine was shut down.
  • Description: We analyze ShimCache.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 shimcache
  • Why: To see traces of old application execution (very useful for the timeline).
  • Description: We scan open files.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 filescan | grep "flag"
  • Why: To find file paths of interest in memory.
  • Description: We extract files.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 dumpfiles -Q 0x12345 -D /dumps/
  • Why: To recover documents or executables from RAM.
  • Description: We analyze the MFT.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 mftparser > mft.txt
  • Why: To find deleted files and file timestamps (creation, access).
  • Description: Folder history.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 shellbags
  • Why: To know which folders the user has visited (evidence of data access).
  • Description: We scan drivers.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 driverscan
  • Why: To find malicious drivers (Rootkits).
  • Description: We scan services.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 svcscan
  • Why: To see services installed by malware for persistence.
  • Description: We detect API hooks.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 apihooks
  • Why: To see if someone is intercepting system functions (Keyloggers, Rootkits).
  • Description: Screenshot.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 screenshot -D /dumps/
  • Why: To visually see what the user was doing.
  • Description: Clipboard.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 clipboard
  • Why: To recover passwords or copied/pasted text.
  • Description: CMD History (XP/Win7).
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 cmdscan
  • Why: To recover commands typed in the console.
  • Description: Console history.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 consoles
  • Why: To view command console input and output.
  • Description: Searching for TrueCrypt passwords.
  • Example: sudo docker run --rm -v $PWD:/dumps:ro vol2 -f /dumps/victim.raw --profile=Win7SP1x64 truecryptpassphrase
  • Why: To decrypt encrypted volumes if the key was in memory.