SlideShare a Scribd company logo
1 of 40
Download to read offline
Hunting malware with
   Volatility v2.0



      Frank Boldewin
        CAST Forum
     December 2011
     (English edition)
What is Volatility?


   Forensics framework to acquire digital
   artifacts from memory dumps
   Completely written in Python
   Current stable version is 2.0.1
   Easy to use plugin interface
   Supports the following x86 Windows versions
     Windows    XP SP 2, 3
     Windows    2003 Server SP 0, 1, 2
     Windows    Vista SP 0, 1, 2
     Windows    2008 Server SP 1, 2
     Windows    7 SP 0, 1


                                            2
How does Volatility work?


  Volatility versions <=1.3 only supported
  Windows XP and searched for hardcoded
  values, e.g. to detect the Kernel Processor
  Control Region (KPCR)
  Starting with version 2.0 advanced scanning
  techniques are being used to detect the KPCR
  If KPCR.baseaddr == *(baseaddr +10)
       Then Start_Sanity_checks()
  or _DBGKD_DEBUG_DATA_HEADER64 Scan
  For details on these scanning techniques
  read the following articles
  http://blog.schatzforensic.com.au/2010/07/finding-object-roots-in-vista-kpcr/
  http://gleeda.blogspot.com/2010/12/identifying-memory-images.html

                                                                                  3
How does Volatility work?


  After detecting the right Windows version and its KPCR,
  volatility scans for dozens of other structures inside a dump
  file. Additional plugins like malware.py hunt for malicious
  activities by using strong heuristics or comparing results
  from different structures
  Typical structures being parsed are:
      _EPROCESS und _KPROCESS
      _KTIMER
      _TCPT_OBJECT
      _ETHREAD und _KTHREAD
      _CMHIVE
      _LDR_DATA_TABLE_ENTRY
      _KMUTANT …..


                                                              4
Show active processes via _EPROCESS list parsing




                                                   5
Show running modules/libraries to processes via Process
Environment Block parsing




                                                          6
Hunting for the C&C server with the connscan feature via
_TCPT_OBJECT parsing




                                                           7
Virtual Address Descriptor (VAD)


  The VAD is a kernel data structure that
  describes the allocated memory pages of a
  process, e.g. loaded modules, mapped files
  or private heap
  A very often used malware technique is to
  inject its malicious code into
  trusted/privileged processes, e.g.
  Services.exe, Svchost.exe, Winlogon.exe




                                               8
VAD parsing to find injected code with “malfind”


  Regular loaded libraries in the address space of a
  process are of type _MMVAD or _MMVAD_LONG
  Dynamically allocated memory pages created via
  VirtualAllocEx/WriteProcessMemory are of type
  _MMVAD_SHORT
  If these memory pages additionally are marked as
  PAGE_EXECUTE_READWRITE, this is a good indication
  for the malfind feature to write this page to a dump
  directory
  With the YARA library in combination further malware
  indicators could be detected




                                                     9
Hunting for injected code inside trusted/privileged processes
and scan for typical malware pattern with YARA




                                                                10
PE-File fixing via impscan to have clean importnames inside
IDA Pro




                                                              11
View of named mutexes to identify typical malware pattern




                                                            12
Hunting for code hooks to detect manipulated system functions




                                                           13
Memory, disassembler and structures view via the interactive
shell




                                                           14
Registry Hives


  Table of standard hives and their supporting files


Registry hive                 Supporting files
HKEY_CURRENT_CONFIG           System, System.alt, System.log, System.sav

HKEY_CURRENT_USER             Ntuser.dat, Ntuser.dat.log

HKEY_LOCAL_MACHINESAM        Sam, Sam.log, Sam.sav

HKEY_LOCAL_MACHINESecurity   Security, Security.log, Security.sav

HKEY_LOCAL_MACHINESoftware   Software, Software.log, Software.sav

HKEY_LOCAL_MACHINESystem     System, System.alt, System.log, System.sav

HKEY_USERS.DEFAULT           Default, Default.log, Default.sav




                                                                           15
Show registry hives of a system via _CMHIVE parsing, e.g.
…configsystem points to registered services on a windows
system




                                                             16
Show registry key that looks suspicious or was hidden through
API hooking on a live system




                                                            17
Interrupt Descriptor Table (IDT)


  The Interrupt Descriptor Table (IDT) is a structure
  which is used when dispatching interrupts
  Interrupts can interrupt an execution of a program to
  to handle an event
  Interrupts could be a result of a hardware signal or
  software based using the INT instruction
  The IDT descriptor table can handle 256 entries
  The descriptor to the table can be written with the
  instruction LIDT and read with SIDT




                                                      18
Show IDT to detect manipulated interrupts




                                            19
Show registered services (incl. hidden) and status via _SERVICE*
records




                                                            20
Comparing the results of function “modules” via
PsLoadedModuleList and function “driverscan” via
_DRIVER_OBJECT parsing. Driverscan shows the hidden driver




                                                         21
SSDT and Shadow SSDT


  The SSDT is a data array in kernel memory, that
  stores pointers to the native API functions of
  Windows, e.g. NtCreateFile, NtEnumerateKey
  These functions are handled in NTOSKRNL
  Some older rootkits hooked some distinctive
  functions to hide its files or registry entries when
  queried from usermode
  Another data array is the Shadow SSDT, pointing to
  native graphic and windows related functions,
  handled in Win32k.sys




                                                         22
Finding manipulated SSDT und Shadow SSDT entries




                                                   23
Global Descriptor Table (GDT) and callgates


  The GDT is a table used in protected mode of a x86
  CPU to manage memory, multitasking and different
  callgates
  A callgate is a mechanism in Intel x86 arch to change
  privilege level of the CPU
  Some rootkits install such callgates to execute code
  with the highest privilege (Ring 0) from usermode
  (Ring 3) without the need to have a driver, e.g. by
  calling DeviceIOControl
  Callgate usage works by executing “call far ptr <addr>”
  from usermode code




                                                        24
Show Global Descriptor Table to detect installed callgates




                                                             25
Kernel callback which is being called when a bugcheck occurs and
possibly a crashdump is being created, e.g. to clean up malicious
code pages




                                                             26
Kernel callback which is being called when a system is about to
shut down, e.g. to check if MBR is still properly infected




                                                             27
Kernel callback which is being called whenever a new module
(Kernel+Usermode) gets loaded, e.g. to inject usermode code
into the target process




                                                              28
Kernel callbacks to fake NTOSKRNL.EXE, which is being called
whenever a new module (Kernel+Usermode) gets loaded and a
new process is created




                                                          29
Kernel callback to get notified whenever a filesystem registers,
e.g. to attach to filesystems as filterdriver and control/intercept
IRP packets




                                                                30
Show device tree via _DEVICE_OBJECT parsing, e.g. to detect
unknown file devices




                                                              31
Hunting for orphan threads


  Drivers requiring delayed processing usually use a work
  item, using IoQueueWorkItem with a pointer to its callback
  routine
  When a system worker thread processes the queued item it
  gets removed and the callback gets invoked
  System worker threads run in the system process context
  (PID 4)
  Whenever work items have been processed or other system
  threads have been created this leaves traces on the
  callstack
  Modern rootkits often map themself into the non paged
  kernel pool, start this code as system thread and unload
  the original driver. These system threads without an
  existing driver entry can be detected with the Volatility
  “OrphanThread” function


                                                           32
System Worker Threads parsing (SYSTEM process) to detect
orphan threads




                                                           33
Hunting for suspicious functions in kernel timers


  Kernel timer DPCs are being used to
  schedule an execution of a function to a
  particular time
  Some rootkits install timers, e.g. to start
  C&C communication after an elapsed time or
  to check if the system is currently being
  traced or debugged




                                                    34
Show installed kernel timer routines and its owners via
_KTIMER parsing




                                                          35
Show driver IRPs to detect manipulated dispatcher functions
(Example: DriverStartIo hook)




                                                              36
Show driver IRPs to detect manipulated dispatcher functions
But where’s the hook?




                                                              37
Show driver IRPs including disassembly using the driverirp
function in combination with the –v parameter. This shows the
patched code and jump to the _KUSER_SHARED_DATA area




                                                            38
Conclusion


  Volatility is a very powerful tool, which is able
  to detect even the most advanced rootkits if
  it’s being used properly.
  The analyst should have good windows
  knowledge to combine the different functions
  in a smart way and draw the right conclusions
  False positives could be caused by security
  software like HIPS, AV or personal firewalls,
  as they act in a very similar way malware
  does. The only way to be 100% sure if the
  code is malicious or not the investigator has
  to disassemble the dumped code resp. alerted
  functions
                                                39
Questions?




             40

More Related Content

What's hot

Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentTeymur Kheirkhabarov
 
Super Easy Memory Forensics
Super Easy Memory ForensicsSuper Easy Memory Forensics
Super Easy Memory ForensicsIIJ
 
Finding attacks with these 6 events
Finding attacks with these 6 eventsFinding attacks with these 6 events
Finding attacks with these 6 eventsMichael Gough
 
Threat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement MatriceThreat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement MatriceVishal Kumar
 
Ransomware Resistance
Ransomware ResistanceRansomware Resistance
Ransomware ResistanceFlorian Roth
 
Fantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemFantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemRoss Wolf
 
Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static AnalysisHossein Yavari
 
Windows Operating System Archaeology
Windows Operating System ArchaeologyWindows Operating System Archaeology
Windows Operating System Archaeologyenigma0x3
 
Building an IP Reputation Engine: Tracking the Miscreants
Building an IP Reputation Engine: Tracking the MiscreantsBuilding an IP Reputation Engine: Tracking the Miscreants
Building an IP Reputation Engine: Tracking the MiscreantsAlienVault
 
MITRE AttACK framework it is time you took notice_v1.0
MITRE AttACK framework it is time you took notice_v1.0MITRE AttACK framework it is time you took notice_v1.0
MITRE AttACK framework it is time you took notice_v1.0Michael Gough
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware AnalysisAndrew McNicol
 
Penetration testing
Penetration testingPenetration testing
Penetration testingAmmar WK
 
Cyber Threat hunting workshop
Cyber Threat hunting workshopCyber Threat hunting workshop
Cyber Threat hunting workshopArpan Raval
 
Threat hunting in cyber world
Threat hunting in cyber worldThreat hunting in cyber world
Threat hunting in cyber worldAkash Sarode
 
Threat Hunting
Threat HuntingThreat Hunting
Threat HuntingSplunk
 
No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016Matthew Dunwoody
 
You can detect PowerShell attacks
You can detect PowerShell attacksYou can detect PowerShell attacks
You can detect PowerShell attacksMichael Gough
 
Threat Hunting Playbook.pdf
Threat Hunting Playbook.pdfThreat Hunting Playbook.pdf
Threat Hunting Playbook.pdflaibaarsyila
 

What's hot (20)

Kheirkhabarov24052017_phdays7
Kheirkhabarov24052017_phdays7Kheirkhabarov24052017_phdays7
Kheirkhabarov24052017_phdays7
 
Hunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows EnvironmentHunting for Credentials Dumping in Windows Environment
Hunting for Credentials Dumping in Windows Environment
 
Super Easy Memory Forensics
Super Easy Memory ForensicsSuper Easy Memory Forensics
Super Easy Memory Forensics
 
Finding attacks with these 6 events
Finding attacks with these 6 eventsFinding attacks with these 6 events
Finding attacks with these 6 events
 
Threat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement MatriceThreat Hunting Procedures and Measurement Matrice
Threat Hunting Procedures and Measurement Matrice
 
Ransomware Resistance
Ransomware ResistanceRansomware Resistance
Ransomware Resistance
 
Fantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find ThemFantastic Red Team Attacks and How to Find Them
Fantastic Red Team Attacks and How to Find Them
 
Malware Static Analysis
Malware Static AnalysisMalware Static Analysis
Malware Static Analysis
 
Windows Operating System Archaeology
Windows Operating System ArchaeologyWindows Operating System Archaeology
Windows Operating System Archaeology
 
Building an IP Reputation Engine: Tracking the Miscreants
Building an IP Reputation Engine: Tracking the MiscreantsBuilding an IP Reputation Engine: Tracking the Miscreants
Building an IP Reputation Engine: Tracking the Miscreants
 
MITRE AttACK framework it is time you took notice_v1.0
MITRE AttACK framework it is time you took notice_v1.0MITRE AttACK framework it is time you took notice_v1.0
MITRE AttACK framework it is time you took notice_v1.0
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware Analysis
 
Basic malware analysis
Basic malware analysisBasic malware analysis
Basic malware analysis
 
Penetration testing
Penetration testingPenetration testing
Penetration testing
 
Cyber Threat hunting workshop
Cyber Threat hunting workshopCyber Threat hunting workshop
Cyber Threat hunting workshop
 
Threat hunting in cyber world
Threat hunting in cyber worldThreat hunting in cyber world
Threat hunting in cyber world
 
Threat Hunting
Threat HuntingThreat Hunting
Threat Hunting
 
No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016
 
You can detect PowerShell attacks
You can detect PowerShell attacksYou can detect PowerShell attacks
You can detect PowerShell attacks
 
Threat Hunting Playbook.pdf
Threat Hunting Playbook.pdfThreat Hunting Playbook.pdf
Threat Hunting Playbook.pdf
 

Viewers also liked

OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityAndrew Case
 
openioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensicsopenioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensicsTakahiro Haruyama
 
SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)
SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)
SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)Security Bootcamp
 
Draft current state of digital forensic and data science
Draft current state of digital forensic and data science Draft current state of digital forensic and data science
Draft current state of digital forensic and data science Damir Delija
 
BDO Digital Forensic
BDO Digital ForensicBDO Digital Forensic
BDO Digital ForensicBDO Indonesia
 
Windows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCaseWindows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCaseTakahiro Haruyama
 
Open Source Forensics
Open Source ForensicsOpen Source Forensics
Open Source ForensicsCTIN
 
Forensic Digital Photography and GPS with Google Earth
Forensic Digital Photography and GPS with Google EarthForensic Digital Photography and GPS with Google Earth
Forensic Digital Photography and GPS with Google EarthDean A. Beers, CLI
 
Workshop Digital Forensic - Cyber Security Community
Workshop Digital Forensic - Cyber Security CommunityWorkshop Digital Forensic - Cyber Security Community
Workshop Digital Forensic - Cyber Security CommunityAntonio Andre
 
Traditional knowledge
Traditional knowledgeTraditional knowledge
Traditional knowledgeErnesto Empig
 
Intellectual property rights(I.P.R.) and traditional knowledge protection of ...
Intellectual property rights(I.P.R.) and traditional knowledge protection of ...Intellectual property rights(I.P.R.) and traditional knowledge protection of ...
Intellectual property rights(I.P.R.) and traditional knowledge protection of ...Abhishek Singh
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkVolker Hirsch
 

Viewers also liked (17)

Memory Forensics
Memory ForensicsMemory Forensics
Memory Forensics
 
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with VolatlityOMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
OMFW 2012: Analyzing Linux Kernel Rootkits with Volatlity
 
THOR Apt Scanner
THOR Apt ScannerTHOR Apt Scanner
THOR Apt Scanner
 
openioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensicsopenioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensics
 
SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)
SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)
SBC 2012 - Malware Memory Forensics (Nguyễn Chấn Việt)
 
Draft current state of digital forensic and data science
Draft current state of digital forensic and data science Draft current state of digital forensic and data science
Draft current state of digital forensic and data science
 
BDO Digital Forensic
BDO Digital ForensicBDO Digital Forensic
BDO Digital Forensic
 
Windows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCaseWindows Memory Forensic Analysis using EnCase
Windows Memory Forensic Analysis using EnCase
 
Open Source Forensics
Open Source ForensicsOpen Source Forensics
Open Source Forensics
 
Digital Forensic Case Study
Digital Forensic Case StudyDigital Forensic Case Study
Digital Forensic Case Study
 
Forensic Digital Photography and GPS with Google Earth
Forensic Digital Photography and GPS with Google EarthForensic Digital Photography and GPS with Google Earth
Forensic Digital Photography and GPS with Google Earth
 
FDI In Nepal
FDI In NepalFDI In Nepal
FDI In Nepal
 
Workshop Digital Forensic - Cyber Security Community
Workshop Digital Forensic - Cyber Security CommunityWorkshop Digital Forensic - Cyber Security Community
Workshop Digital Forensic - Cyber Security Community
 
Traditional knowledge
Traditional knowledgeTraditional knowledge
Traditional knowledge
 
Intellectual property rights(I.P.R.) and traditional knowledge protection of ...
Intellectual property rights(I.P.R.) and traditional knowledge protection of ...Intellectual property rights(I.P.R.) and traditional knowledge protection of ...
Intellectual property rights(I.P.R.) and traditional knowledge protection of ...
 
10 traditional knowledge
10 traditional knowledge10 traditional knowledge
10 traditional knowledge
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
 

Similar to Hunting malware with volatility v2.0

Oleksyk applied-anti-forensics
Oleksyk   applied-anti-forensicsOleksyk   applied-anti-forensics
Oleksyk applied-anti-forensicsDefconRussia
 
Hunting rootkits with windbg
Hunting rootkits with windbgHunting rootkits with windbg
Hunting rootkits with windbgFrank Boldewin
 
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...Andrew Case
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformAll Things Open
 
Volatility Commands for Basic Malware Analysis- Descriptions and Examples
Volatility Commands for Basic Malware Analysis- Descriptions and ExamplesVolatility Commands for Basic Malware Analysis- Descriptions and Examples
Volatility Commands for Basic Malware Analysis- Descriptions and ExamplesStephen Hasford
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformAll Things Open
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - WonokaerunLinux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerunidsecconf
 
Trap Handling in Linux
Trap Handling in LinuxTrap Handling in Linux
Trap Handling in LinuxYongraeJo
 
Linux internal
Linux internalLinux internal
Linux internalmcganesh
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 
Security on a Container Platform
Security on a Container PlatformSecurity on a Container Platform
Security on a Container PlatformAll Things Open
 

Similar to Hunting malware with volatility v2.0 (20)

Oleksyk applied-anti-forensics
Oleksyk   applied-anti-forensicsOleksyk   applied-anti-forensics
Oleksyk applied-anti-forensics
 
Hunting rootkits with windbg
Hunting rootkits with windbgHunting rootkits with windbg
Hunting rootkits with windbg
 
Hta w22
Hta w22Hta w22
Hta w22
 
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
Memory Forensics: Defeating Disk Encryption, Skilled Attackers, and Advanced ...
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container Platform
 
Operating system
Operating systemOperating system
Operating system
 
Volatility Commands for Basic Malware Analysis- Descriptions and Examples
Volatility Commands for Basic Malware Analysis- Descriptions and ExamplesVolatility Commands for Basic Malware Analysis- Descriptions and Examples
Volatility Commands for Basic Malware Analysis- Descriptions and Examples
 
Windows Kernel-
Windows Kernel-Windows Kernel-
Windows Kernel-
 
Securing Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container PlatformSecuring Applications and Pipelines on a Container Platform
Securing Applications and Pipelines on a Container Platform
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - WonokaerunLinux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerun
 
LINUX Device Drivers
LINUX Device DriversLINUX Device Drivers
LINUX Device Drivers
 
Linux kernel architecture
Linux kernel architectureLinux kernel architecture
Linux kernel architecture
 
Trap Handling in Linux
Trap Handling in LinuxTrap Handling in Linux
Trap Handling in Linux
 
System Integrity
System IntegritySystem Integrity
System Integrity
 
Linux internal
Linux internalLinux internal
Linux internal
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Unix1
Unix1Unix1
Unix1
 
Security on a Container Platform
Security on a Container PlatformSecurity on a Container Platform
Security on a Container Platform
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Hunting malware with volatility v2.0

  • 1. Hunting malware with Volatility v2.0 Frank Boldewin CAST Forum December 2011 (English edition)
  • 2. What is Volatility? Forensics framework to acquire digital artifacts from memory dumps Completely written in Python Current stable version is 2.0.1 Easy to use plugin interface Supports the following x86 Windows versions Windows XP SP 2, 3 Windows 2003 Server SP 0, 1, 2 Windows Vista SP 0, 1, 2 Windows 2008 Server SP 1, 2 Windows 7 SP 0, 1 2
  • 3. How does Volatility work? Volatility versions <=1.3 only supported Windows XP and searched for hardcoded values, e.g. to detect the Kernel Processor Control Region (KPCR) Starting with version 2.0 advanced scanning techniques are being used to detect the KPCR If KPCR.baseaddr == *(baseaddr +10) Then Start_Sanity_checks() or _DBGKD_DEBUG_DATA_HEADER64 Scan For details on these scanning techniques read the following articles http://blog.schatzforensic.com.au/2010/07/finding-object-roots-in-vista-kpcr/ http://gleeda.blogspot.com/2010/12/identifying-memory-images.html 3
  • 4. How does Volatility work? After detecting the right Windows version and its KPCR, volatility scans for dozens of other structures inside a dump file. Additional plugins like malware.py hunt for malicious activities by using strong heuristics or comparing results from different structures Typical structures being parsed are: _EPROCESS und _KPROCESS _KTIMER _TCPT_OBJECT _ETHREAD und _KTHREAD _CMHIVE _LDR_DATA_TABLE_ENTRY _KMUTANT ….. 4
  • 5. Show active processes via _EPROCESS list parsing 5
  • 6. Show running modules/libraries to processes via Process Environment Block parsing 6
  • 7. Hunting for the C&C server with the connscan feature via _TCPT_OBJECT parsing 7
  • 8. Virtual Address Descriptor (VAD) The VAD is a kernel data structure that describes the allocated memory pages of a process, e.g. loaded modules, mapped files or private heap A very often used malware technique is to inject its malicious code into trusted/privileged processes, e.g. Services.exe, Svchost.exe, Winlogon.exe 8
  • 9. VAD parsing to find injected code with “malfind” Regular loaded libraries in the address space of a process are of type _MMVAD or _MMVAD_LONG Dynamically allocated memory pages created via VirtualAllocEx/WriteProcessMemory are of type _MMVAD_SHORT If these memory pages additionally are marked as PAGE_EXECUTE_READWRITE, this is a good indication for the malfind feature to write this page to a dump directory With the YARA library in combination further malware indicators could be detected 9
  • 10. Hunting for injected code inside trusted/privileged processes and scan for typical malware pattern with YARA 10
  • 11. PE-File fixing via impscan to have clean importnames inside IDA Pro 11
  • 12. View of named mutexes to identify typical malware pattern 12
  • 13. Hunting for code hooks to detect manipulated system functions 13
  • 14. Memory, disassembler and structures view via the interactive shell 14
  • 15. Registry Hives Table of standard hives and their supporting files Registry hive Supporting files HKEY_CURRENT_CONFIG System, System.alt, System.log, System.sav HKEY_CURRENT_USER Ntuser.dat, Ntuser.dat.log HKEY_LOCAL_MACHINESAM Sam, Sam.log, Sam.sav HKEY_LOCAL_MACHINESecurity Security, Security.log, Security.sav HKEY_LOCAL_MACHINESoftware Software, Software.log, Software.sav HKEY_LOCAL_MACHINESystem System, System.alt, System.log, System.sav HKEY_USERS.DEFAULT Default, Default.log, Default.sav 15
  • 16. Show registry hives of a system via _CMHIVE parsing, e.g. …configsystem points to registered services on a windows system 16
  • 17. Show registry key that looks suspicious or was hidden through API hooking on a live system 17
  • 18. Interrupt Descriptor Table (IDT) The Interrupt Descriptor Table (IDT) is a structure which is used when dispatching interrupts Interrupts can interrupt an execution of a program to to handle an event Interrupts could be a result of a hardware signal or software based using the INT instruction The IDT descriptor table can handle 256 entries The descriptor to the table can be written with the instruction LIDT and read with SIDT 18
  • 19. Show IDT to detect manipulated interrupts 19
  • 20. Show registered services (incl. hidden) and status via _SERVICE* records 20
  • 21. Comparing the results of function “modules” via PsLoadedModuleList and function “driverscan” via _DRIVER_OBJECT parsing. Driverscan shows the hidden driver 21
  • 22. SSDT and Shadow SSDT The SSDT is a data array in kernel memory, that stores pointers to the native API functions of Windows, e.g. NtCreateFile, NtEnumerateKey These functions are handled in NTOSKRNL Some older rootkits hooked some distinctive functions to hide its files or registry entries when queried from usermode Another data array is the Shadow SSDT, pointing to native graphic and windows related functions, handled in Win32k.sys 22
  • 23. Finding manipulated SSDT und Shadow SSDT entries 23
  • 24. Global Descriptor Table (GDT) and callgates The GDT is a table used in protected mode of a x86 CPU to manage memory, multitasking and different callgates A callgate is a mechanism in Intel x86 arch to change privilege level of the CPU Some rootkits install such callgates to execute code with the highest privilege (Ring 0) from usermode (Ring 3) without the need to have a driver, e.g. by calling DeviceIOControl Callgate usage works by executing “call far ptr <addr>” from usermode code 24
  • 25. Show Global Descriptor Table to detect installed callgates 25
  • 26. Kernel callback which is being called when a bugcheck occurs and possibly a crashdump is being created, e.g. to clean up malicious code pages 26
  • 27. Kernel callback which is being called when a system is about to shut down, e.g. to check if MBR is still properly infected 27
  • 28. Kernel callback which is being called whenever a new module (Kernel+Usermode) gets loaded, e.g. to inject usermode code into the target process 28
  • 29. Kernel callbacks to fake NTOSKRNL.EXE, which is being called whenever a new module (Kernel+Usermode) gets loaded and a new process is created 29
  • 30. Kernel callback to get notified whenever a filesystem registers, e.g. to attach to filesystems as filterdriver and control/intercept IRP packets 30
  • 31. Show device tree via _DEVICE_OBJECT parsing, e.g. to detect unknown file devices 31
  • 32. Hunting for orphan threads Drivers requiring delayed processing usually use a work item, using IoQueueWorkItem with a pointer to its callback routine When a system worker thread processes the queued item it gets removed and the callback gets invoked System worker threads run in the system process context (PID 4) Whenever work items have been processed or other system threads have been created this leaves traces on the callstack Modern rootkits often map themself into the non paged kernel pool, start this code as system thread and unload the original driver. These system threads without an existing driver entry can be detected with the Volatility “OrphanThread” function 32
  • 33. System Worker Threads parsing (SYSTEM process) to detect orphan threads 33
  • 34. Hunting for suspicious functions in kernel timers Kernel timer DPCs are being used to schedule an execution of a function to a particular time Some rootkits install timers, e.g. to start C&C communication after an elapsed time or to check if the system is currently being traced or debugged 34
  • 35. Show installed kernel timer routines and its owners via _KTIMER parsing 35
  • 36. Show driver IRPs to detect manipulated dispatcher functions (Example: DriverStartIo hook) 36
  • 37. Show driver IRPs to detect manipulated dispatcher functions But where’s the hook? 37
  • 38. Show driver IRPs including disassembly using the driverirp function in combination with the –v parameter. This shows the patched code and jump to the _KUSER_SHARED_DATA area 38
  • 39. Conclusion Volatility is a very powerful tool, which is able to detect even the most advanced rootkits if it’s being used properly. The analyst should have good windows knowledge to combine the different functions in a smart way and draw the right conclusions False positives could be caused by security software like HIPS, AV or personal firewalls, as they act in a very similar way malware does. The only way to be 100% sure if the code is malicious or not the investigator has to disassemble the dumped code resp. alerted functions 39