Применение виртуализации для динамического анализа
Very Mighty eXtension
for debugging
Artem Shishkin
Debugging essentials
Debugging prerequisites
― Ability to pause program execution
• Any asynchronous event is suitable (exception or interrupt)
― Ability to examine program CPU context (registers state)
― Ability to examine program memory
• Memory is shared (so as any hardware)
Debugging capabilities
― INT 3 (#BP)
• 0xCC opcode
• Involves memory modification
Original code
What you see in a debugger
What is really happening
Debugging capabilities
― INT 1 (#DB)
• Single stepping
—Through setting TF in eflags register
• Debug registers
—Through modifying DR0-DR7 registers
—Up to 4 linear address breakpoints (Reads, Writes, Executes)
• Involves register modification
Debugging capabilities
― INT 0x0E (#PF)
• Memory access trapping
• Trapping page access (Reads, Writes, Executes)
• Involves page table modification (Bits P, RW, XD)
Anti-…-anti-debugging
OS debugging integration
― Modifies OS structures
• PEB. BeingDebugged
• nt!KdDebuggerEnabled
― Modifies control-flow
• Event suppressing
― Exposes information about debugging session
• ProcessDebugPort info class
― Refer to “The Ultimate Anti-Debugging Reference”
by Peter Ferrie
Debugging impact
― Execution is paused, but time is not
• GetTickCount
• rdtsc, rdtscp
• Performance monitoring
• OS specific (KdpTimeSlipDpc)
VMX basics
Virtual Machine Extensions
― Different processor execution mode
― Mode switching between Host (VMM) and Guest (OS)
VMCS
– Virtual Machine Control Structure
• Guest state
• Host state
• Virtual machine settings
• Can be dynamically switched
EPT
― Second Level Address Translation (SLAT)
― Extended Page Table
• Guest physical address to host physical address
mappings
• Page-level access control for guest physical addresses
(reads, writes, executes)
GVA
Guest CR3
GPA
VMCS EPTP
HPA
VM Exits
― Events that cause guest mode switch to host mode
• Interrupts and exceptions
• EPT violations
• Certain instructions execution
• Special periodic timer ticks
• Instruction fetches under certain conditions
• System state related changes
and more…
Adapting VMX for
debugging
VMX and debugger similarities
― Guest is paused when Host executes
― Full CPU context access
― Full memory access
Debugging events
― VM Exits can be treated like debugging events
― A simple debugger needs nothing more
VM Exit Debugging event
Any VM Exit Debugger break-in
Any VM Resume Debugger continue
Monitor Trap Flag Single-step event
VM Exit Instruction Execution Breakpoint
EPT violation Page fault
Outstanding capabilities
Additional events
― Address space switching
• Used for switching between processes
― Special interrupts
• Gives an ability to trace processor bootstrap code
― System structures modification
• Used for debugging OS startup code
― Hardware access through IO ports and MMIO
• Used for debugging hardware
Guest isolation benefits
― Stealth debugging
• Breakpoints hiding through EPT modification
• Hardware filtering through EPT modification, IO ports
interception, VT-d, MSR access interception
― Time control
• Ability to conceal host execution time
― Blue-pilling
• Ability to convert your machine into virtual one on-the-fly at
any time (well, at any time that you are able to gain execution
control)
Full hardware access
― Full memory control
• Disregarding address space
• Disregarding privilege level
― Full context control
― Full MSR control
Virtual Machine
Introspection
Analyzing the execution environment
― Perform in-place memory forensics
• Extended with CPU state
― Full hardware access provides full information about
software
• Current module can be detected using module header
• Current kernel can be detected using CPU state
• Symbol information can be used to restore high-level OS
data structures
Known issues
Virtualized memory is physical memory
― OS memory manager relies on virtual memory
• Memory pages can be not mapped (on-demand paging)
• Memory pages can be trimmed
• Memory pages can be moved
• Memory manager can interpret non-present pages however it
wants
Virtual machine monitor robustness
― VMX Guest operation is different from ordinary operation
• VMM has to emulate a set of instructions
― Stealthness is not free of charge
• All detection vectors have to be inspected and tested with
care
• Some anti-detection tricks are highly difficult to implement
― Host mode operation is also not free of charge
• VMM has to be fast in order the Guest to operate smoothly
Implementation case
User interaction
― Debuggee is a remote machine
• Difficult to share the hardware between host and guest
― Communication is done via a set of transports
• Windows KD as an example
― Debugger is small and stupid
• Heavy analysis is performed by a debugging client
― Minimize data exchange
• Transport can be slow (like serial)
• Offload client features to the VMM if possible
Breakpoints
― Ordinary int 3
― Hide through EPT (allow execution only)
• Can be emulated on read or write
• Can be single-stepped on read or write
― Global
• Filter using CR3, VA and GPA
Debugging hints
― Maximize memory pages presence
• Disable swap
• DisablePagingExecutive (for Windows)
• Learn OS memory manager – absent pages can be mapped
elsewhere
― Suppress interrupts
• Modify IF bit in eflags
• Modify guest interruptibility state
Questions?
• https://twitter.com/honorary_bot
• https://github.com/honorarybot
• https://github.com/ptresearch
• https://www.ptsecurity.com/products/#multiscanner
Thank you!
Artem Shishkin
ashishkin@ptsecurity.com
Применение виртуализации для динамического анализа

More Related Content

PDF
Масштабируемый и эффективный фаззинг Google Chrome
ODP
Hacktivity2014: Virtual Machine Introspection to Detect and Protect
ODP
Scalability, Fidelity and Stealth in the DRAKVUF Dynamic Malware Analysis System
PDF
BSides Denver: Stealthy, hypervisor-based malware analysis
PDF
Cloud Security with LibVMI
PDF
CrySys guest-lecture: Virtual machine introspection on modern hardware
PDF
Virtual Machine Introspection with Xen
ODP
Pitfalls of virtual machine introspection on modern hardware
Масштабируемый и эффективный фаззинг Google Chrome
Hacktivity2014: Virtual Machine Introspection to Detect and Protect
Scalability, Fidelity and Stealth in the DRAKVUF Dynamic Malware Analysis System
BSides Denver: Stealthy, hypervisor-based malware analysis
Cloud Security with LibVMI
CrySys guest-lecture: Virtual machine introspection on modern hardware
Virtual Machine Introspection with Xen
Pitfalls of virtual machine introspection on modern hardware

What's hot (20)

PDF
31c3 Presentation - Virtual Machine Introspection
PDF
Hacktivity 2016: Stealthy, hypervisor based malware analysis
PDF
OffensiveCon2022: Case Studies of Fuzzing with Xen
PPTX
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
PDF
Pitfalls and limits of dynamic malware analysis
PDF
Troopers15 Lightning talk: VMI & DRAKVUF
PDF
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
ODP
Virtual Machine Introspection with Xen on ARM
PDF
Solnik secure enclaveprocessor-pacsec
PDF
Reverse Engineering the TomTom Runner pt. 2
PDF
We shall play a game....
PPTX
Reverse Engineering the TomTom Runner pt. 1
PDF
Shall we play a game?
PPTX
Shall we play a game?
PPTX
How to drive a malware analyst crazy
PDF
Kasza smashing the_jars
PDF
Automated Malware Analysis and Cyber Security Intelligence
PDF
Использование KASan для автономного гипервизора
PDF
Virtual Machine Introspection in a Hyberid Honeypot Architecture
PDF
VM Forking and Hypervisor-based Fuzzing with Xen
31c3 Presentation - Virtual Machine Introspection
Hacktivity 2016: Stealthy, hypervisor based malware analysis
OffensiveCon2022: Case Studies of Fuzzing with Xen
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
Pitfalls and limits of dynamic malware analysis
Troopers15 Lightning talk: VMI & DRAKVUF
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Virtual Machine Introspection with Xen on ARM
Solnik secure enclaveprocessor-pacsec
Reverse Engineering the TomTom Runner pt. 2
We shall play a game....
Reverse Engineering the TomTom Runner pt. 1
Shall we play a game?
Shall we play a game?
How to drive a malware analyst crazy
Kasza smashing the_jars
Automated Malware Analysis and Cyber Security Intelligence
Использование KASan для автономного гипервизора
Virtual Machine Introspection in a Hyberid Honeypot Architecture
VM Forking and Hypervisor-based Fuzzing with Xen
Ad

Viewers also liked (20)

PDF
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
PDF
Обратная разработка бинарных форматов с помощью Kaitai Struct
PPTX
Waf.js: как защищать веб-приложения с использованием JavaScript
PDF
Статический анализ кода в контексте SSDL
PPTX
Целевые атаки: прицелься первым
PDF
Flash умер. Да здравствует Flash!
PDF
Tapping into the core
PPTX
Страх и ненависть в телеком-операторах
PPTX
Мобильная связь небезопасна. Аргументы, подкрепленные фактами
PPTX
Доставка зловредов через облака
PPTX
Device Fingerprint — лекарство от мошенничества. Все дело в дозировке
PPTX
Ковбой Энди, Рик Декард и другие охотники за наградой
PDF
Боремся с читингом в онлайн-играх
PDF
DNS как линия защиты/DNS as a Defense Vector
PDF
Строим ханипот и выявляем DDoS-атаки
PDF
Перехват беспроводных гаджетов — от квадрокоптеров до мышек
PPTX
Практические рекомендации по использованию системы TestRail | Дмитрий Рыльцов...
PPTX
Certifi-Gate: атака в теории и на практике
PPTX
TeamPass - управление разграничением доступа к сервисным паролям в команде | ...
PDF
Возможно, время не на твоей стороне. Реализация атаки по времени в браузере
Если нашлась одна ошибка — есть и другие. Один способ выявить «наследуемые» у...
Обратная разработка бинарных форматов с помощью Kaitai Struct
Waf.js: как защищать веб-приложения с использованием JavaScript
Статический анализ кода в контексте SSDL
Целевые атаки: прицелься первым
Flash умер. Да здравствует Flash!
Tapping into the core
Страх и ненависть в телеком-операторах
Мобильная связь небезопасна. Аргументы, подкрепленные фактами
Доставка зловредов через облака
Device Fingerprint — лекарство от мошенничества. Все дело в дозировке
Ковбой Энди, Рик Декард и другие охотники за наградой
Боремся с читингом в онлайн-играх
DNS как линия защиты/DNS as a Defense Vector
Строим ханипот и выявляем DDoS-атаки
Перехват беспроводных гаджетов — от квадрокоптеров до мышек
Практические рекомендации по использованию системы TestRail | Дмитрий Рыльцов...
Certifi-Gate: атака в теории и на практике
TeamPass - управление разграничением доступа к сервисным паролям в команде | ...
Возможно, время не на твоей стороне. Реализация атаки по времени в браузере
Ad

Similar to Применение виртуализации для динамического анализа (20)

PPTX
003-vmm.pptx
PPT
Virtual Pc Seminar
PPTX
Virtualization of computing and servers
PDF
blah blah blah blah blah blah blah blah blah blah blah blah
PPTX
Operating system Virtualization_NEW.pptx
PPTX
Hardware support for efficient virtualization
PPTX
Bridging the Semantic Gap in Virtualized Environment
PDF
XPDS14 - Zero-Footprint Guest Memory Introspection from Xen - Mihai Dontu, Bi...
PPTX
Zero footprint guest memory introspection from xen
PDF
Gal Diskin - Virtually Impossible
PDF
2virtualizationtechnologyoverview 13540659831745-phpapp02-121127193019-phpapp01
PDF
sponsorAVAST-VB2014
PDF
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
ODP
Stealthy, Hypervisor-based Malware Analysis
PPTX
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
PPTX
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
PDF
Windows guest debugging presentation from KVM Forum 2012
PPTX
4. Memory virtualization and management
PDF
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
PPT
virtual machine.ppt
003-vmm.pptx
Virtual Pc Seminar
Virtualization of computing and servers
blah blah blah blah blah blah blah blah blah blah blah blah
Operating system Virtualization_NEW.pptx
Hardware support for efficient virtualization
Bridging the Semantic Gap in Virtualized Environment
XPDS14 - Zero-Footprint Guest Memory Introspection from Xen - Mihai Dontu, Bi...
Zero footprint guest memory introspection from xen
Gal Diskin - Virtually Impossible
2virtualizationtechnologyoverview 13540659831745-phpapp02-121127193019-phpapp01
sponsorAVAST-VB2014
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Stealthy, Hypervisor-based Malware Analysis
Detect Kernel-Mode Rootkits via Real Time Logging & Controlling Memory Access
PlovDev 2016: Application Performance in Virtualized Environments by Todor T...
Windows guest debugging presentation from KVM Forum 2012
4. Memory virtualization and management
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
virtual machine.ppt

More from Positive Hack Days (20)

PPTX
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
PPTX
Как мы собираем проекты в выделенном окружении в Windows Docker
PPTX
Типовая сборка и деплой продуктов в Positive Technologies
PPTX
Аналитика в проектах: TFS + Qlik
PPTX
Использование анализатора кода SonarQube
PPTX
Развитие сообщества Open DevOps Community
PPTX
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
PPTX
Автоматизация построения правил для Approof
PDF
Мастер-класс «Трущобы Application Security»
PDF
Формальные методы защиты приложений
PDF
Эвристические методы защиты приложений
PDF
Теоретические основы Application Security
PPTX
От экспериментального программирования к промышленному: путь длиной в 10 лет
PDF
Уязвимое Android-приложение: N проверенных способов наступить на грабли
PPTX
Требования по безопасности в архитектуре ПО
PDF
Формальная верификация кода на языке Си
PPTX
Механизмы предотвращения атак в ASP.NET Core
PDF
SOC для КИИ: израильский опыт
PDF
Honeywell Industrial Cyber Security Lab & Services Center
PDF
Credential stuffing и брутфорс-атаки
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Как мы собираем проекты в выделенном окружении в Windows Docker
Типовая сборка и деплой продуктов в Positive Technologies
Аналитика в проектах: TFS + Qlik
Использование анализатора кода SonarQube
Развитие сообщества Open DevOps Community
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Автоматизация построения правил для Approof
Мастер-класс «Трущобы Application Security»
Формальные методы защиты приложений
Эвристические методы защиты приложений
Теоретические основы Application Security
От экспериментального программирования к промышленному: путь длиной в 10 лет
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Требования по безопасности в архитектуре ПО
Формальная верификация кода на языке Си
Механизмы предотвращения атак в ASP.NET Core
SOC для КИИ: израильский опыт
Honeywell Industrial Cyber Security Lab & Services Center
Credential stuffing и брутфорс-атаки

Recently uploaded (20)

PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
PPTX
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
PDF
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
PDF
Data Virtualization in Action: Scaling APIs and Apps with FME
PDF
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
PDF
Advancing precision in air quality forecasting through machine learning integ...
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
Comparative analysis of machine learning models for fake news detection in so...
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PPTX
Module 1 Introduction to Web Programming .pptx
PPTX
Training Program for knowledge in solar cell and solar industry
PPTX
MuleSoft-Compete-Deck for midddleware integrations
PDF
MENA-ECEONOMIC-CONTEXT-VC MENA-ECEONOMIC
A symptom-driven medical diagnosis support model based on machine learning te...
Introduction to MCP and A2A Protocols: Enabling Agent Communication
AI-driven Assurance Across Your End-to-end Network With ThousandEyes
Accessing-Finance-in-Jordan-MENA 2024 2025.pdf
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Electrocardiogram sequences data analytics and classification using unsupervi...
Data Virtualization in Action: Scaling APIs and Apps with FME
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
Advancing precision in air quality forecasting through machine learning integ...
NewMind AI Weekly Chronicles – August ’25 Week IV
Comparative analysis of machine learning models for fake news detection in so...
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
Module 1 Introduction to Web Programming .pptx
Training Program for knowledge in solar cell and solar industry
MuleSoft-Compete-Deck for midddleware integrations
MENA-ECEONOMIC-CONTEXT-VC MENA-ECEONOMIC

Применение виртуализации для динамического анализа

  • 2. Very Mighty eXtension for debugging Artem Shishkin
  • 4. Debugging prerequisites ― Ability to pause program execution • Any asynchronous event is suitable (exception or interrupt) ― Ability to examine program CPU context (registers state) ― Ability to examine program memory • Memory is shared (so as any hardware)
  • 5. Debugging capabilities ― INT 3 (#BP) • 0xCC opcode • Involves memory modification Original code What you see in a debugger What is really happening
  • 6. Debugging capabilities ― INT 1 (#DB) • Single stepping —Through setting TF in eflags register • Debug registers —Through modifying DR0-DR7 registers —Up to 4 linear address breakpoints (Reads, Writes, Executes) • Involves register modification
  • 7. Debugging capabilities ― INT 0x0E (#PF) • Memory access trapping • Trapping page access (Reads, Writes, Executes) • Involves page table modification (Bits P, RW, XD)
  • 9. OS debugging integration ― Modifies OS structures • PEB. BeingDebugged • nt!KdDebuggerEnabled ― Modifies control-flow • Event suppressing ― Exposes information about debugging session • ProcessDebugPort info class ― Refer to “The Ultimate Anti-Debugging Reference” by Peter Ferrie
  • 10. Debugging impact ― Execution is paused, but time is not • GetTickCount • rdtsc, rdtscp • Performance monitoring • OS specific (KdpTimeSlipDpc)
  • 12. Virtual Machine Extensions ― Different processor execution mode ― Mode switching between Host (VMM) and Guest (OS)
  • 13. VMCS – Virtual Machine Control Structure • Guest state • Host state • Virtual machine settings • Can be dynamically switched
  • 14. EPT ― Second Level Address Translation (SLAT) ― Extended Page Table • Guest physical address to host physical address mappings • Page-level access control for guest physical addresses (reads, writes, executes) GVA Guest CR3 GPA VMCS EPTP HPA
  • 15. VM Exits ― Events that cause guest mode switch to host mode • Interrupts and exceptions • EPT violations • Certain instructions execution • Special periodic timer ticks • Instruction fetches under certain conditions • System state related changes and more…
  • 17. VMX and debugger similarities ― Guest is paused when Host executes ― Full CPU context access ― Full memory access
  • 18. Debugging events ― VM Exits can be treated like debugging events ― A simple debugger needs nothing more VM Exit Debugging event Any VM Exit Debugger break-in Any VM Resume Debugger continue Monitor Trap Flag Single-step event VM Exit Instruction Execution Breakpoint EPT violation Page fault
  • 20. Additional events ― Address space switching • Used for switching between processes ― Special interrupts • Gives an ability to trace processor bootstrap code ― System structures modification • Used for debugging OS startup code ― Hardware access through IO ports and MMIO • Used for debugging hardware
  • 21. Guest isolation benefits ― Stealth debugging • Breakpoints hiding through EPT modification • Hardware filtering through EPT modification, IO ports interception, VT-d, MSR access interception ― Time control • Ability to conceal host execution time ― Blue-pilling • Ability to convert your machine into virtual one on-the-fly at any time (well, at any time that you are able to gain execution control)
  • 22. Full hardware access ― Full memory control • Disregarding address space • Disregarding privilege level ― Full context control ― Full MSR control
  • 24. Analyzing the execution environment ― Perform in-place memory forensics • Extended with CPU state ― Full hardware access provides full information about software • Current module can be detected using module header • Current kernel can be detected using CPU state • Symbol information can be used to restore high-level OS data structures
  • 26. Virtualized memory is physical memory ― OS memory manager relies on virtual memory • Memory pages can be not mapped (on-demand paging) • Memory pages can be trimmed • Memory pages can be moved • Memory manager can interpret non-present pages however it wants
  • 27. Virtual machine monitor robustness ― VMX Guest operation is different from ordinary operation • VMM has to emulate a set of instructions ― Stealthness is not free of charge • All detection vectors have to be inspected and tested with care • Some anti-detection tricks are highly difficult to implement ― Host mode operation is also not free of charge • VMM has to be fast in order the Guest to operate smoothly
  • 29. User interaction ― Debuggee is a remote machine • Difficult to share the hardware between host and guest ― Communication is done via a set of transports • Windows KD as an example ― Debugger is small and stupid • Heavy analysis is performed by a debugging client ― Minimize data exchange • Transport can be slow (like serial) • Offload client features to the VMM if possible
  • 30. Breakpoints ― Ordinary int 3 ― Hide through EPT (allow execution only) • Can be emulated on read or write • Can be single-stepped on read or write ― Global • Filter using CR3, VA and GPA
  • 31. Debugging hints ― Maximize memory pages presence • Disable swap • DisablePagingExecutive (for Windows) • Learn OS memory manager – absent pages can be mapped elsewhere ― Suppress interrupts • Modify IF bit in eflags • Modify guest interruptibility state
  • 32. Questions? • https://twitter.com/honorary_bot • https://github.com/honorarybot • https://github.com/ptresearch • https://www.ptsecurity.com/products/#multiscanner