SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
Creating Secure VM
Comparison between Intel and AMD, and one more thing…



                                   Tsukasa Ooi <li@livegrid.org>
                             Livegrid Incorporated, Lead Analyst
Related Topics
• Virtualization
• Behavior based Detection
• Reverse Engineering
What is “Secure VM”?
• Virtual Machine having…
   –   Invisible Breakpoint
   –   Direct Memory Lookup/Modification
   –   System I/O Interception
   –   Instruction/Memory Tracing
• They are useful for security!
   – Direct Memory Lookup to detect rootkits
   – Hooking disk I/Os to find malwares
How to “secure” Virtual Machines
• There are two major ways
  (if CPU-assisted virtualization is used)
• Using Debug Registers (DR0~DR7)
   – DR7.GD bit : Makes guest DRx registers inaccessible
   – VM exit when DR access : Can hook DRx read/write
• Using Page Table Modification
   – PTE.R/W bit : Can hook page write
   – PTE.P bit : Can hook page access (read/write/exec)
   – PTE.NX bit : Can hook page execution
How to set Breakpoint (Debug Registers)
• Set VM exit when:
  – DRx access
  – #DB (Debug) exception
• Set guest DR7.GD bit
• Set guest breakpoint using guest DRx
  – Useful point : Kernel Functions, System Calls…
• If breakpoint is hit…
  – Do extra validation
How to set Breakpoint (Page Table)
• Set VM exit when:
  – #PF (Page Fault) exception
• Reset PTE.P bit or PTE.NX bit of page
  – Do not change guest page table, but shadow.
• If Page Fault is occurred
  – Check if breakpoint is hit (can be false-positive)
  – If breakpoint is hit, do extra validation
Comparison (Debug Registers / Page Table)
• Using Debug Registers is simple
   – Easy to implement
• Using Page Table can handle 5 or more breakpoint
   – Breakpoints of Debug Registers are limited to 4
   – If guest OS also use Debug Registers,
     need to emulate using Page Table Modification
• Using Debug Registers is faster
   – No false-positive, low overhead
• Using Page Table is flexible
   – Can intercept “nearly everything”
Considerations of CPU-assisted virt.
• Cannot intercept important instructions
  – Such as sysenter, sysexit
• Limited interception
  compared than Binary Translation
Comparison between AMD-V/Intel VT-x
• Only AMD-V can intercept IRET instruction
  – Guest OS can workaround host-set breakpoint
    by set EFLAGS.RF bit (Resume Flag: Suppress
    breakpoints for single instruction) and execute
    IRETD instruction
• AMD-V is better if you use Debug Registers
  – No difference if you use Page Table Modification
  – Enough for hooking system calls (not mostly
    called through IRET instruction)
Second Level Address Translation (SLAT)
• Newer features for virtualization
• Two page tables to translate addresses
  – Guest Logical Addr → Guest Physical Addr
  – Guest Physical Addr → Host Physical Addr
• Intel and AMD both have SLAT extension
  – Intel : Extended Page Tables (EPT)
  – AMD : Nested Paging / Rapid virtualization index (RVI)
• But they got a problem…
SLAT considerations
• Limited ways for interception
  – REAL (guest) Page Tables are visible
  – Managing two page tables are bad for security-use
  – In some situation, SLAT cannot be enabled
• Debug Registers can be still used
What about difference?
• Intel EPT can make page “execute-only”
  – If Supported by CPU
     • Currently, all CPUs supporting Intel EPT also
       supports Execute-Only page
  – Stealthy is not enough, but can make invisible chunk
  – Please consider that guest software also can execute
    invisible chunk with jump instructions.
• Mostly same but Intel EPT is better
THANK YOU?
One More Thing:

FULL VIRTUALIZATION OF
X86 ARCHITECTURE ON X86_64
x86 emulation on x86_64 architecture
• Using Binary Translation…
• They are possible and (nearly) practical!
Why “x86 on x86_64”?
• Architecture is very similar
   – No need to execute normal instruction by 3
     instructions (just 1 or 2)
• Have extra memory
   – x86 emulation on x86_64 requires 44GB of virtual
     memory range, but it is easy to allocate in 64-bit mode.
• Have extra registers!
   – R8~R15 registers can be used for extra emulation
     context including trace log pointer…
How to “emulate” x86? (1)
PUSH EBP

MOV   EBP, ESP
MOV   EAX, [EBP+8]
MOV   EDX, [EBP+12]
MOV   EAX, [EAX*4+EDX]

POP   EBP

RET
How to “emulate” x86? (1)
PUSH EBP                 MOV [RCX+RBP-4], EBX
                         LEA EBP, [EBP-4]
MOV   EBP, ESP           MOV EBX, EBP
MOV   EAX, [EBP+8]       MOV EAX, [RCX+RBX+8]
MOV   EDX, [EBP+12]      MOV EDX, [RCX+RBX+12]
MOV   EAX, [EAX*4+EDX]   LEA R14D, [EAX*4+EDX]
                         MOV EAX, [RCX+R14]
POP   EBP                MOV EBX, [RCX+RBP]
                         LEA EBP, [EBP+4]
RET                      (Return Intrinsics)
How to “emulate” x86? (2)
• Register Remapping
  – ESP → EBP/RBP (Stack in x86_64 is 8-bytes)
  – EBP → EBX/RBX (To reduce cost of stack reference)
• RCX : Base address of 32-bit virtual memory
  – All virtual memory range!
• R14/R14D : Temporary Register
• R15 : Widely Used by Emulation System
Using Binary Translation…
• Full instruction/memory tracing of x86!
  – Including execution path, memory read/write…
• Very high overhead but it is worth doing.
What For?
• Detecting some kind of interferences
   – Exploits
   – Hooks
   – (Table/Memory) Modification
• Reverse Engineering
   – Can Trace Everything!
      • Anti-reverse engineering techniques can be detected
   – Protocol Reversing (File, Network…)
   – Algorithm reversing and finding
      • Finding algorithms are useful for anti-DRM.
How to “emulate” x86 with tracing? (1)
PUSH   EBP                MOV           [RCX+RBP-4], EBX
                          LEA           EBP, [EBP-4]
MOV    EBP, ESP           MOV           EBX, EBP
MOV    EAX, [EBP+8]       MOV           EAX, [RCX+RBX+8]
                          MOV           [R13], EAX
                          LEA           R13, [R13+4]
MOV    EDX, [EBP+12]      MOV           EDX, [RCX+RBX+12]
                          MOV           [R13], EDX
                          LEA           R13, [R13+4]
MOV    EAX, [EAX*4+EDX]   LEA           R14D, [EAX*4+EDX]
                          MOV           EAX, [RCX+R14]
                          MOV           [R13], EAX
                          LEA           R13, [R13+4]
POP    EBP                MOV           EBX, [RCX+RBP]
                          MOV           [R13], EBX
                          LEA           R13, [R13+4]
                          LEA           EBP, [EBP+4]
RET                       (Return Intrinsics)
How to “emulate” x86 with tracing? (2)
• R13 : Trace Log Pointer
  – Result of Memory Read
  – Address of Branch
• 1~5 instructions for emulating normal instructions
  – If translation program is “optimized”,
    required number of instructions can be reduced.
Is it practical?
• Nearly.
   – Current Performance Index w/o Disk-write stalls:
             Pentium 4 1.5GHz
     ≧       Core i7 3.0GHz in emulation
     >       Pentium III 1.0GHz
• Not enough for full-system emulation but
  enough for user-mode-emulation!
• Faster than any tracing methods before
  (Like debuggers such as OllyDbg, IDA Pro…)
Limitations / Considerations
• x86 segmentation and addressing
  – x86_64 is constrained “flat memory model”
  – High overhead to emulate segment limit
• VERY FAST Disks are required
  – Fortunately, writing trace log is almost
    “sequential-write” so RAID using HDD is useful
• Consumes much of resources
  – Requires much of memory
When will be available?
• Currently, only experimental programs
  are working…
  – Not “practical” programs…
• I hope… Q2, 2010
Have any questions?

THANK YOU.

Mais conteúdo relacionado

Mais procurados

JRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing WorldJRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing WorldSATOSHI TAGOMORI
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101Dvir Volk
 
Fluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect MoreFluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect MoreSadayuki Furuhashi
 
Developing high-performance network servers in Lisp
Developing high-performance network servers in LispDeveloping high-performance network servers in Lisp
Developing high-performance network servers in LispVladimir Sedach
 
Apache HTTPd Server 2.2 Presentation
Apache HTTPd Server 2.2 PresentationApache HTTPd Server 2.2 Presentation
Apache HTTPd Server 2.2 Presentationultimatetux
 
Install Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. KuteInstall Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. KuteTushar B Kute
 
Install Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. KuteInstall Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. KuteTushar B Kute
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsSATOSHI TAGOMORI
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerVladimir Sedach
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellN Masahiro
 
Fluentd v0.14 Overview
Fluentd v0.14 OverviewFluentd v0.14 Overview
Fluentd v0.14 OverviewN Masahiro
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellN Masahiro
 
Perforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 

Mais procurados (20)

The basics of fluentd
The basics of fluentdThe basics of fluentd
The basics of fluentd
 
JRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing WorldJRuby with Java Code in Data Processing World
JRuby with Java Code in Data Processing World
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
 
Fluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect MoreFluentd - Set Up Once, Collect More
Fluentd - Set Up Once, Collect More
 
Fluentd introduction at ipros
Fluentd introduction at iprosFluentd introduction at ipros
Fluentd introduction at ipros
 
Developing high-performance network servers in Lisp
Developing high-performance network servers in LispDeveloping high-performance network servers in Lisp
Developing high-performance network servers in Lisp
 
Apache HTTPd Server 2.2 Presentation
Apache HTTPd Server 2.2 PresentationApache HTTPd Server 2.2 Presentation
Apache HTTPd Server 2.2 Presentation
 
Erlang on OSv
Erlang on OSvErlang on OSv
Erlang on OSv
 
Install Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. KuteInstall Wordpress in Ubuntu Linux by Tushar B. Kute
Install Wordpress in Ubuntu Linux by Tushar B. Kute
 
Install Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. KuteInstall Drupal in Ubuntu by Tushar B. Kute
Install Drupal in Ubuntu by Tushar B. Kute
 
CPAN Training
CPAN TrainingCPAN Training
CPAN Training
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
 
The Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compilerThe Parenscript Common Lisp to JavaScript compiler
The Parenscript Common Lisp to JavaScript compiler
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshell
 
Fluentd 101
Fluentd 101Fluentd 101
Fluentd 101
 
Fluentd v0.14 Overview
Fluentd v0.14 OverviewFluentd v0.14 Overview
Fluentd v0.14 Overview
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
Fluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshellFluentd v1.0 in a nutshell
Fluentd v1.0 in a nutshell
 
Perforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and Reliability
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 

Semelhante a Creating Secure VM (Comarison between Intel and AMD, and one more thing...) - AVTokyo 2009

ESIL - Universal IL (Intermediate Language) for Radare2
ESIL - Universal IL (Intermediate Language) for Radare2ESIL - Universal IL (Intermediate Language) for Radare2
ESIL - Universal IL (Intermediate Language) for Radare2Anton Kochkov
 
Modern CPUs and Caches - A Starting Point for Programmers
Modern CPUs and Caches - A Starting Point for ProgrammersModern CPUs and Caches - A Starting Point for Programmers
Modern CPUs and Caches - A Starting Point for ProgrammersYaser Zhian
 
Hadoop Architecture_Cluster_Cap_Plan
Hadoop Architecture_Cluster_Cap_PlanHadoop Architecture_Cluster_Cap_Plan
Hadoop Architecture_Cluster_Cap_PlanNarayana B
 
Pipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructorPipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructorMoshe Zioni
 
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructureDevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructureAngelo Failla
 
Why databases cry at night
Why databases cry at nightWhy databases cry at night
Why databases cry at nightMichael Yarichuk
 
Introduction to debugging linux applications
Introduction to debugging linux applicationsIntroduction to debugging linux applications
Introduction to debugging linux applicationscommiebstrd
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacksJapneet Singh
 
(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memoryNico Ludwig
 
OSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner FischerOSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner FischerNETWAYS
 
OSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerOSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerNETWAYS
 
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner FischerOSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner FischerNETWAYS
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesOSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesNETWAYS
 
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화OpenStack Korea Community
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Colin Charles
 
Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick reviewCe.Se.N.A. Security
 
Micro control idsecconf2010
Micro control idsecconf2010Micro control idsecconf2010
Micro control idsecconf2010idsecconf
 
CNIT 126 4: A Crash Course in x86 Disassembly
CNIT 126 4: A Crash Course in x86 DisassemblyCNIT 126 4: A Crash Course in x86 Disassembly
CNIT 126 4: A Crash Course in x86 DisassemblySam Bowne
 

Semelhante a Creating Secure VM (Comarison between Intel and AMD, and one more thing...) - AVTokyo 2009 (20)

ESIL - Universal IL (Intermediate Language) for Radare2
ESIL - Universal IL (Intermediate Language) for Radare2ESIL - Universal IL (Intermediate Language) for Radare2
ESIL - Universal IL (Intermediate Language) for Radare2
 
Modern CPUs and Caches - A Starting Point for Programmers
Modern CPUs and Caches - A Starting Point for ProgrammersModern CPUs and Caches - A Starting Point for Programmers
Modern CPUs and Caches - A Starting Point for Programmers
 
Hadoop Architecture_Cluster_Cap_Plan
Hadoop Architecture_Cluster_Cap_PlanHadoop Architecture_Cluster_Cap_Plan
Hadoop Architecture_Cluster_Cap_Plan
 
Pipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructorPipiot - the double-architecture shellcode constructor
Pipiot - the double-architecture shellcode constructor
 
Coal (1)
Coal (1)Coal (1)
Coal (1)
 
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructureDevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
DevopsItalia2015 - DHCP at Facebook - Evolution of an infrastructure
 
Why databases cry at night
Why databases cry at nightWhy databases cry at night
Why databases cry at night
 
Introduction to debugging linux applications
Introduction to debugging linux applicationsIntroduction to debugging linux applications
Introduction to debugging linux applications
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacks
 
(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory(8) cpp stack automatic_memory_and_static_memory
(8) cpp stack automatic_memory_and_static_memory
 
OSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner FischerOSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner Fischer
 
OSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerOSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data center
 
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner FischerOSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesOSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin Charles
 
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
[OpenStack Days Korea 2016] Track1 - All flash CEPH 구성 및 최적화
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016
 
Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick review
 
Howmysqlworks
HowmysqlworksHowmysqlworks
Howmysqlworks
 
Micro control idsecconf2010
Micro control idsecconf2010Micro control idsecconf2010
Micro control idsecconf2010
 
CNIT 126 4: A Crash Course in x86 Disassembly
CNIT 126 4: A Crash Course in x86 DisassemblyCNIT 126 4: A Crash Course in x86 Disassembly
CNIT 126 4: A Crash Course in x86 Disassembly
 

Mais de Tsukasa Oi

Farewell, Stagefright bugs!
Farewell, Stagefright bugs!Farewell, Stagefright bugs!
Farewell, Stagefright bugs!Tsukasa Oi
 
さらば、Stagefright 脆弱性
さらば、Stagefright 脆弱性さらば、Stagefright 脆弱性
さらば、Stagefright 脆弱性Tsukasa Oi
 
Windows をより安全にする SafeSEH on MinGW
Windows をより安全にする SafeSEH on MinGWWindows をより安全にする SafeSEH on MinGW
Windows をより安全にする SafeSEH on MinGWTsukasa Oi
 
A New Tracer for Reverse Engineering - PacSec 2010
A New Tracer for Reverse Engineering - PacSec 2010A New Tracer for Reverse Engineering - PacSec 2010
A New Tracer for Reverse Engineering - PacSec 2010Tsukasa Oi
 
リバースエンジニアリングのための新しいトレース手法 - PacSec 2010
リバースエンジニアリングのための新しいトレース手法 - PacSec 2010リバースエンジニアリングのための新しいトレース手法 - PacSec 2010
リバースエンジニアリングのための新しいトレース手法 - PacSec 2010Tsukasa Oi
 
ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009
ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009
ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009Tsukasa Oi
 
Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009
Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009
Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009Tsukasa Oi
 
Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009
Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009
Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009Tsukasa Oi
 
システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009
システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009
システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009Tsukasa Oi
 
セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009
セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009
セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009Tsukasa Oi
 

Mais de Tsukasa Oi (10)

Farewell, Stagefright bugs!
Farewell, Stagefright bugs!Farewell, Stagefright bugs!
Farewell, Stagefright bugs!
 
さらば、Stagefright 脆弱性
さらば、Stagefright 脆弱性さらば、Stagefright 脆弱性
さらば、Stagefright 脆弱性
 
Windows をより安全にする SafeSEH on MinGW
Windows をより安全にする SafeSEH on MinGWWindows をより安全にする SafeSEH on MinGW
Windows をより安全にする SafeSEH on MinGW
 
A New Tracer for Reverse Engineering - PacSec 2010
A New Tracer for Reverse Engineering - PacSec 2010A New Tracer for Reverse Engineering - PacSec 2010
A New Tracer for Reverse Engineering - PacSec 2010
 
リバースエンジニアリングのための新しいトレース手法 - PacSec 2010
リバースエンジニアリングのための新しいトレース手法 - PacSec 2010リバースエンジニアリングのための新しいトレース手法 - PacSec 2010
リバースエンジニアリングのための新しいトレース手法 - PacSec 2010
 
ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009
ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009
ステルスルートキット : 悪いヤツはどうライブメモリフォレンジックをすり抜ける? - PacSec 2009
 
Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009
Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009
Stealthy Rootkit : How bad guy fools live memory forensics? - PacSec 2009
 
Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009
Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009
Lack of System Registers and two simple anti-forensic attacks - AVTokyo 2009
 
システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009
システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009
システムレジスタの不足と2つのシンプルなアンチフォレンジック攻撃 - AVTokyo 2009
 
セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009
セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009
セキュアVMの構築 (IntelとAMDの比較、あともうひとつ...) - AVTokyo 2009
 

Último

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Último (20)

Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

Creating Secure VM (Comarison between Intel and AMD, and one more thing...) - AVTokyo 2009

  • 1. Creating Secure VM Comparison between Intel and AMD, and one more thing… Tsukasa Ooi <li@livegrid.org> Livegrid Incorporated, Lead Analyst
  • 2. Related Topics • Virtualization • Behavior based Detection • Reverse Engineering
  • 3. What is “Secure VM”? • Virtual Machine having… – Invisible Breakpoint – Direct Memory Lookup/Modification – System I/O Interception – Instruction/Memory Tracing • They are useful for security! – Direct Memory Lookup to detect rootkits – Hooking disk I/Os to find malwares
  • 4. How to “secure” Virtual Machines • There are two major ways (if CPU-assisted virtualization is used) • Using Debug Registers (DR0~DR7) – DR7.GD bit : Makes guest DRx registers inaccessible – VM exit when DR access : Can hook DRx read/write • Using Page Table Modification – PTE.R/W bit : Can hook page write – PTE.P bit : Can hook page access (read/write/exec) – PTE.NX bit : Can hook page execution
  • 5. How to set Breakpoint (Debug Registers) • Set VM exit when: – DRx access – #DB (Debug) exception • Set guest DR7.GD bit • Set guest breakpoint using guest DRx – Useful point : Kernel Functions, System Calls… • If breakpoint is hit… – Do extra validation
  • 6. How to set Breakpoint (Page Table) • Set VM exit when: – #PF (Page Fault) exception • Reset PTE.P bit or PTE.NX bit of page – Do not change guest page table, but shadow. • If Page Fault is occurred – Check if breakpoint is hit (can be false-positive) – If breakpoint is hit, do extra validation
  • 7. Comparison (Debug Registers / Page Table) • Using Debug Registers is simple – Easy to implement • Using Page Table can handle 5 or more breakpoint – Breakpoints of Debug Registers are limited to 4 – If guest OS also use Debug Registers, need to emulate using Page Table Modification • Using Debug Registers is faster – No false-positive, low overhead • Using Page Table is flexible – Can intercept “nearly everything”
  • 8. Considerations of CPU-assisted virt. • Cannot intercept important instructions – Such as sysenter, sysexit • Limited interception compared than Binary Translation
  • 9. Comparison between AMD-V/Intel VT-x • Only AMD-V can intercept IRET instruction – Guest OS can workaround host-set breakpoint by set EFLAGS.RF bit (Resume Flag: Suppress breakpoints for single instruction) and execute IRETD instruction • AMD-V is better if you use Debug Registers – No difference if you use Page Table Modification – Enough for hooking system calls (not mostly called through IRET instruction)
  • 10. Second Level Address Translation (SLAT) • Newer features for virtualization • Two page tables to translate addresses – Guest Logical Addr → Guest Physical Addr – Guest Physical Addr → Host Physical Addr • Intel and AMD both have SLAT extension – Intel : Extended Page Tables (EPT) – AMD : Nested Paging / Rapid virtualization index (RVI) • But they got a problem…
  • 11. SLAT considerations • Limited ways for interception – REAL (guest) Page Tables are visible – Managing two page tables are bad for security-use – In some situation, SLAT cannot be enabled • Debug Registers can be still used
  • 12. What about difference? • Intel EPT can make page “execute-only” – If Supported by CPU • Currently, all CPUs supporting Intel EPT also supports Execute-Only page – Stealthy is not enough, but can make invisible chunk – Please consider that guest software also can execute invisible chunk with jump instructions. • Mostly same but Intel EPT is better
  • 14. One More Thing: FULL VIRTUALIZATION OF X86 ARCHITECTURE ON X86_64
  • 15. x86 emulation on x86_64 architecture • Using Binary Translation… • They are possible and (nearly) practical!
  • 16. Why “x86 on x86_64”? • Architecture is very similar – No need to execute normal instruction by 3 instructions (just 1 or 2) • Have extra memory – x86 emulation on x86_64 requires 44GB of virtual memory range, but it is easy to allocate in 64-bit mode. • Have extra registers! – R8~R15 registers can be used for extra emulation context including trace log pointer…
  • 17. How to “emulate” x86? (1) PUSH EBP MOV EBP, ESP MOV EAX, [EBP+8] MOV EDX, [EBP+12] MOV EAX, [EAX*4+EDX] POP EBP RET
  • 18. How to “emulate” x86? (1) PUSH EBP MOV [RCX+RBP-4], EBX LEA EBP, [EBP-4] MOV EBP, ESP MOV EBX, EBP MOV EAX, [EBP+8] MOV EAX, [RCX+RBX+8] MOV EDX, [EBP+12] MOV EDX, [RCX+RBX+12] MOV EAX, [EAX*4+EDX] LEA R14D, [EAX*4+EDX] MOV EAX, [RCX+R14] POP EBP MOV EBX, [RCX+RBP] LEA EBP, [EBP+4] RET (Return Intrinsics)
  • 19. How to “emulate” x86? (2) • Register Remapping – ESP → EBP/RBP (Stack in x86_64 is 8-bytes) – EBP → EBX/RBX (To reduce cost of stack reference) • RCX : Base address of 32-bit virtual memory – All virtual memory range! • R14/R14D : Temporary Register • R15 : Widely Used by Emulation System
  • 20. Using Binary Translation… • Full instruction/memory tracing of x86! – Including execution path, memory read/write… • Very high overhead but it is worth doing.
  • 21. What For? • Detecting some kind of interferences – Exploits – Hooks – (Table/Memory) Modification • Reverse Engineering – Can Trace Everything! • Anti-reverse engineering techniques can be detected – Protocol Reversing (File, Network…) – Algorithm reversing and finding • Finding algorithms are useful for anti-DRM.
  • 22. How to “emulate” x86 with tracing? (1) PUSH EBP MOV [RCX+RBP-4], EBX LEA EBP, [EBP-4] MOV EBP, ESP MOV EBX, EBP MOV EAX, [EBP+8] MOV EAX, [RCX+RBX+8] MOV [R13], EAX LEA R13, [R13+4] MOV EDX, [EBP+12] MOV EDX, [RCX+RBX+12] MOV [R13], EDX LEA R13, [R13+4] MOV EAX, [EAX*4+EDX] LEA R14D, [EAX*4+EDX] MOV EAX, [RCX+R14] MOV [R13], EAX LEA R13, [R13+4] POP EBP MOV EBX, [RCX+RBP] MOV [R13], EBX LEA R13, [R13+4] LEA EBP, [EBP+4] RET (Return Intrinsics)
  • 23. How to “emulate” x86 with tracing? (2) • R13 : Trace Log Pointer – Result of Memory Read – Address of Branch • 1~5 instructions for emulating normal instructions – If translation program is “optimized”, required number of instructions can be reduced.
  • 24. Is it practical? • Nearly. – Current Performance Index w/o Disk-write stalls: Pentium 4 1.5GHz ≧ Core i7 3.0GHz in emulation > Pentium III 1.0GHz • Not enough for full-system emulation but enough for user-mode-emulation! • Faster than any tracing methods before (Like debuggers such as OllyDbg, IDA Pro…)
  • 25. Limitations / Considerations • x86 segmentation and addressing – x86_64 is constrained “flat memory model” – High overhead to emulate segment limit • VERY FAST Disks are required – Fortunately, writing trace log is almost “sequential-write” so RAID using HDD is useful • Consumes much of resources – Requires much of memory
  • 26. When will be available? • Currently, only experimental programs are working… – Not “practical” programs… • I hope… Q2, 2010