SlideShare a Scribd company logo
Seunghun Han, Jungwhan Kang
(hanseunghun || ultract)@nsr.re.kr
Myth and Truth about
Hypervisor-Based Kernel Protector:
The Reason Why You Need Shadow-Box
- Senior security researcher at NSR (National
Security Research Institute of South Korea)
- Speaker at HITBSecConf 2016
- Author of the book series titled “64-bit multi-
core OS principles and structure, Vol.1&2”
- a.k.a kkamagui, @kkamagui1
Who are we ?
- Researcher at NSR
- Participated final round of some CTFs
(Codegate, ISEC… held in South Korea)
- Interested in OSsecurity and reading write-up of CTFs
- Got married last year 
- a.k.a ultract, @ultractt
Goal of This Presentation
- We present lightweight hypervisor-based
kernel protector, “Shadow-box”
- Shadow-box defends kernel from security threats
efficiently, and we made it from scratch
- We share lessons learned from deploying
and operating Shadow-box in real world
systems
- We have been operating Shadow-box since
last year and share lessons learned!
Background
Design
Implementation
Lessons Learned
(and the Truth Previous Researches Did Not Tell You)
Demo. and Conclusion
(Black Hat Sound Bytes)
Linux Kernel Is Everywhere!
Security Threats of Linux Kernel
- The Linux kernel suffers from rootkits and
security vulnerabilities
- Rootkits: EnyeLKM, Adore-ng, Sebek, suckit,
kbeast, and so many descendants
- Vulnerabilities: CVE-2014-3153, CVE-2015-3636,
CVE-2016-4557, CVE-2017-6074, etc.
Devices which use Linux kernel
share security threats
Melee Combats at the Kernel-level
- Kernel-level (Ring 0) protections are not
enough
- Lots of rootkits and exploits work in the Ring 0 level
- Protections against them are often easily bypassed
and neutralized
- Kernel Object Hooking (KOH)
- Direct Kernel Object Manipulation (DKOM)
Protections need
an even lower level (Ring -1)
Well-known Rootkits
Other rootkits also have
similar patterns
Taking the Higher Ground
- Leveraging virtualization technology (VT)
- VT separates a machine into a host (secure world)
and a guest (normal world)
- The host in Ring -1 can freely access/control
the guest in Ring 0 (the converse doesn’t hold)
- VT-equipped HW: Intel VT-x, AMD AMD-v,
ARM TrustZone
UserUser
Trends of Introducing Ring -1
User
Kernel
Guest
(Normal World)
Host
(Secure World)
Host OS Guest OS
User
Kernel
Virtualization Technology
(T.Z., VT-x, AMD-v)
Monitor, control
Previous Researches…
TOO MANY…
OH, NO…
Researches Are Excellent, But They Look …
I heard and knew about them
But, I can not find in real world!
- Many researches have preconditions
- They usually change kernel code or hypervisor
- They also need well-known hashes of LKM,
well-known value of kernel data, secure VM
for analyzing target VM, etc.
- Many researches consume much resource
- The host and the guest run each OS
- They allocate resources independently!
- The host consumes many CPU cycles to introspect
the guest because of semantic gap
Restrictions on Previous Researches (1)
Restrictions on Previous Researches (2)
- In conclusion, previous researches are
considered for laboratory environment only
- They assume they can control environment!
- But, real world environment is totally different from
laboratory environment!
- You even don’t know the
actual environment before
the software is installed!
REAL WORLD!
WELCOME TO
Therefore,
PRACTICAL and LIGHTWEIGHT
mechanism is needed for
REAL WORLD ENVIRONMENT!
Design Goals of Kernel Protector
- Lightweight
- Focus on rootkit detection and protection
- Simple and extensible architecture
- Small memory footprint
- No secure VMs and no multiple OSes
- Practical
- Out-of-box approach
- No modification of kernel code and data
- Dynamic injection
- Load any time from boot to runtime
Background
Design
Implementation
Lessons Learned
(and the Truth Previous Researches Did Not Tell You)
Demo. and Conclusion
(Black Hat Sound Bytes)
Security Architecture in Shadow Play
Bulb
Actors
Audience
Security Architecture in Shadow Play
Ring -1 Monitoring Mechanism
Activities in OS
Security Monitor
We named this architecture
“Shadow-box”
(Light-Box)
(Shadow-Watcher)
User
Shared
Area
Light-Box
(Lightweight Hypervisor)
Architecture of Shadow-Box
User
(Read/Write
Permission)
Shared Kernel
(Read-only
Permission)
Guest (Ring 0~3)Host (Ring -1)
Shared Kernel Only Shared Kernel and User
Shared Kernel
(Read/Write
Permission)
Shadow-
Watcher
(Monitor)
Monitor, control
- Light-box, lightweight hypervisor,
- Isolates worlds by using memory protection
technique in VT
- Shares the kernel area between the host (Ring -1)
and the guest (Ring 0 ~ 3)
- Does not run each OS in two worlds
- Uses smaller resources than existing mechanisms
and has narrow semantic gap
- Can be loaded any time (loadable kernel module)
Architecture of Light-Box
- Shadow-watcher
- Monitors the guest by using Light-box
- Checks if applications of the guest modify kernel
objects or not by event-driven way
- Code, system table, IDT table, etc.
- Checks the integrity of the guest by introspecting
kernel object by periodic way
- Process list, loadable kernel module (LKM) list,
function pointers of file system and socket
Architecture of Shadow-Watcher
What can Shadow-Box do?
- Shadow-box protects Linux kernel from
- Static kernel object attacks
- Static kernel object = immutable in runtime
- Code modification and system table modification attacks
- Dynamic kernel object attacks
- Dynamic kernel object = mutable in runtime
- Process hiding and module hiding
- Function pointer modification attacks
Background
Design
Implementation
Lessons Learned
(and the Truth Previous Researches Did Not Tell You)
Demo. and Conclusion
(Black Hat Sound Bytes)
Boot Process using Shadow-Box
Starting UEFI
with Secure Boot
Starting
Bootloader
Starting
Linux Kernel
Preparing
Virtualization
Separating and
Starting the Guest
Monitoring
the Guest
Starting
Linux Applications
Guest
(Normal World)
: Linux : Shadow-Box
- Enabling VMX
(Virtual Machine
Extension)
- Setting VMCS
(Virtual Machine
Control Structure)
- Identifying kernel
information
- Separating
memory area
- Launching VMCS
Host
(Secure World)
Loading
Shadow-Box
Static Kernel Object Protection (1)
User
Area
Static
Kernel
Objects
Shadow-
Box
Objects
Host Physical
Address
Level.3
Level 4
Level 3
Level 2
Level 1
Paging Structure of EPT
Level.2
Level.1
Physical
Physical
Physical
VT-x Extended
Page Table (EPT)
CPU
Guest Physical Address
Read, Write,
Execute
Read,
Execute
No
Permission
Static Kernel Object Protection (2)
Read, Execute
Read, Execute
Read, Execute
Read, Execute
No Permission
Read, Execute
Guest
Page Table (GPT)
Extended
Page Table (EPT)
Page 1
Page 2
Page 3
Guest Logical
Address (GLA)
Guest Physical
Address (GPA)
Host Physical
Address (HPA)
Page 1
Page 2
Page 3
Page 1
Page 2
Page 3
Guest (Normal World)
Address Translation (Ring 0)
Host (Secure World)
Address Translation (Ring -1)
Static Kernel Object Protection (3)
Read, Execute
Read, Execute
Read, Execute
No Permission
Guest
Page Table (GPT)
Extended
Page Table (EPT)
Page 1
Page 2
Guest Logical
Address (GLA)
Guest Physical
Address (GPA)
Host Physical
Address (HPA)
Page 1
Page 1
Page 2
Page 3
EPT protects the host from
attack propagation of the guest
Guest (Normal World)
Address Translation (Ring 0)
Host (Secure World)
Address Translation (Ring -1)
Read, Execute Read, Execute
Page 3
Page 2
Page 3
Write, Execute Read, Execute
Page 3
Page 2
Page 3
Static Kernel Object Protection (4)
User
Area
Static
Kernel
Objects
Shadow-
Box
Objects
DMA
VT-d DMA Remapping
Reporting (DMAR) Table
Physical Address
DMA Address
Read, Write
No
Permission
No
Permission
Level.3
Level 4
Level 3
Level 2
Level 1
Paging Structure of
Second Level Page Table
Level.2
Level.1
Physical
Physical
Physical
context
Root
Table
Level.4
Context
Table
Dynamic Kernel Object Protection (1)
A B F...
Next
Prev
Next Next
Prev Prev
Task and Module List
in Guest
⑤ Comparing data
Task and Module
Create Function
do_fork() or
load_module()
{
create_object();
modify_list();
}
Task and Module
Delete Function
release_task() or
delete_module()
{
delete_object();
modify_list();
}
② Inserting
H/W breakpoint
③ Monitoring
Task and Module List
in Shadow-box① Creating initial data
A B F...
Next
Prev
Next Next
Prev Prev
④ Shadowing
list data
VFS and Socket Objects
of Guest
FP
Pointer
Host
Logical Address
Module
Code
Malicious
Code
Open
Function Pointer
Structure
Read
Write
Close
Kernel
Code
...
Invalid
Invalid
Valid
Valid
Malicious
Code
(Loaded after
Shadow-box)
User
Area
Kernel
Area
Dynamic Kernel Object Protection (2)
: Code area loaded before Shadow-box
Privileged Register Protection
- GDTR, LDTR and IDTR change interactions
between kernel and user level
- IA32_SYSENTER_CS, IA32_SYSENTER_ESP,
IA32_STAR, IA32-LSTAR and IA32_FMASK
MSR also change them
- These privileged registers are rarely changed
after boot!
- So, Shadow-box
- Locks the privileged registers
- Locks and Monitors GDT, LDT, and IDT table
Rootkit Detection
- All rootkits are detected
Name Detected? Detected Point
EnyeLKM √
code change,
module hide
Adore-ng 0.56 √
function pointer change,
module hide
Sebek 2.0 √
system table change,
module hide
Suckit 2.0 √ system table change
kbeast √
system table change,
module hide
Performance Measurements of Prototype
- Application benchmarks show 1% ~ 10%
performance overhead
- 5.3% at kernel compile in single-core processor
- 6.2% at kernel compile in multi-core processor
Results of Application Benchmark. Lower is better.
(Intel i7-4790 4core 8thread 3.6GHz, 32GB RAM, 512GB SSD)
Single-core processor Multi-core processor
Background
Design
Implementation
Lessons Learned
(and the Truth Previous Researches Did Not Tell You)
Demo. and Conclusion
(Black Hat Sound Bytes)
Ready to launch!
We deployed
Shadow-box in REAL WORLD!
and …
We met
BEASTS of REAL WORLD!
(false positive, slow-down, system hang, etc.)
WHAT HAPPENED…
OH, NO…
Previous researches did not
tell us something important!
AGAIN!
NICE TO MEET YOU
Lessons Learned - 1
- Code is not immutable!
- Linux kernel has a CONFIG_JUMP_LABEL option!
- If this option is set, Linux kernel patches itself on
runtime!
- Unfortunately, this option is set by default!
- Solution
- Option 1: Add exceptional cases for mutable code
pages
- Option 2: If you can build kernel,
Turn Off CONFIG_JUMP_LABEL option NOW!
Lessons Learned - 2
- Cache type in EPT is very important!
- Linux system has some memory mapped I/O area
- BIOS area, APIC area, PCI area, etc.
- Misconfiguration makes various problems such as
system hang, slow down, video mode change error,
etc.
- Solution
- Set uncacheable type by default
- Set write-back type to “System RAM” area only!
Lessons Learned - 2
Write-back
Cache Type
Uncacheable
Cache Type
by Default
Lessons Learned - 3
- Multi-core environment is more complicated
than you think!
- Each core modifies process list and module list
concurrently
- When H/W breakpoint exception occurred,
other cores could be changing the lists already!
- So, we need a mechanism for synchronizing lists
- Solution
- Lock tasklist_lock and module_mutex of the guest
while Shadow-box is checking the lists!
Now,
We have been operating
Shadow-box in REAL WORLD
SUCCESSFULLY !
Background
Design
Implementation
Lessons Learned
(and the Truth Previous Researches Did Not Tell You)
Demo. and Conclusion
(Black Hat Sound Bytes)
DEMO
Future Work
X86
VT-x, VT-d
(Virtualization Technology)
Shadow-Box
Linux
TrustZone
(Virtualization Technology)
Shadow-Box
Linux
Multi-platform Support!
Conclusion and Black Hat Sound Bytes
- Kernel-level (Ring 0) threats should be
protected in a more privileged level (Ring -1)
- We create Ring -1 level by using VT from scratch
- Shadow-box is lightweight and practical
- Shadow-box uses less resource than existing
mechanisms and protects kernel from rootkits
- Real world is Serengeti!
- Real world is different from laboratory environment
- You should have a strong mentality for defeating
beasts of real world! or use Shadow-box instead!
THANK YOU
THE CHOICE IS YOURS !
Contact: hanseunghun@nsr.re.kr, @kkamagui1
ultract@nsr.re.kr, @ultractt
Project : github.com/kkamagui/shadow-box-for-x86

More Related Content

What's hot

Live Memory Forensics on Android devices
Live Memory Forensics on Android devicesLive Memory Forensics on Android devices
Live Memory Forensics on Android devices
Nikos Gkogkos
 
Halvar Flake: Why Johnny can’t tell if he is compromised
Halvar Flake: Why Johnny can’t tell if he is compromisedHalvar Flake: Why Johnny can’t tell if he is compromised
Halvar Flake: Why Johnny can’t tell if he is compromised
Area41
 
Hardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to RootHardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to Root
Yashin Mehaboobe
 
The hangover: A "modern" (?) high performance approach to build an offensive ...
The hangover: A "modern" (?) high performance approach to build an offensive ...The hangover: A "modern" (?) high performance approach to build an offensive ...
The hangover: A "modern" (?) high performance approach to build an offensive ...
Nelson Brito
 
Hardware hacking 101
Hardware hacking 101Hardware hacking 101
Hardware hacking 101
Tiago Henriques
 
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Igor Korkin
 
Don't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesDon't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesMichael Scovetta
 
[PH-Neutral 0x7db] Exploit Next Generation®
[PH-Neutral 0x7db] Exploit Next Generation®[PH-Neutral 0x7db] Exploit Next Generation®
[PH-Neutral 0x7db] Exploit Next Generation®
Nelson Brito
 
Linux Kernel Exploitation
Linux Kernel ExploitationLinux Kernel Exploitation
Linux Kernel Exploitation
Scio Security
 
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
DefconRussia
 
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor SkochinskyインテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
CODE BLUE
 
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
Igor Korkin
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
Vasily Ryzhonkov
 
VM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with XenVM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with Xen
Tamas K Lengyel
 
VM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzingVM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzing
Tamas K Lengyel
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CanSecWest
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
Emertxe Information Technologies Pvt Ltd
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
Marcus Tarquinio
 
Code Injection in Windows
Code Injection in WindowsCode Injection in Windows
Code Injection in Windows
n|u - The Open Security Community
 
A Hypervisor IPS based on Hardware Assisted Virtualization Technology
A Hypervisor IPS based on Hardware Assisted Virtualization TechnologyA Hypervisor IPS based on Hardware Assisted Virtualization Technology
A Hypervisor IPS based on Hardware Assisted Virtualization TechnologyFFRI, Inc.
 

What's hot (20)

Live Memory Forensics on Android devices
Live Memory Forensics on Android devicesLive Memory Forensics on Android devices
Live Memory Forensics on Android devices
 
Halvar Flake: Why Johnny can’t tell if he is compromised
Halvar Flake: Why Johnny can’t tell if he is compromisedHalvar Flake: Why Johnny can’t tell if he is compromised
Halvar Flake: Why Johnny can’t tell if he is compromised
 
Hardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to RootHardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to Root
 
The hangover: A "modern" (?) high performance approach to build an offensive ...
The hangover: A "modern" (?) high performance approach to build an offensive ...The hangover: A "modern" (?) high performance approach to build an offensive ...
The hangover: A "modern" (?) high performance approach to build an offensive ...
 
Hardware hacking 101
Hardware hacking 101Hardware hacking 101
Hardware hacking 101
 
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
Your Linux Passwords Are in Danger: MimiDove Meets the Challenge (lightning t...
 
Don't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade MachinesDon't Give Credit: Hacking Arcade Machines
Don't Give Credit: Hacking Arcade Machines
 
[PH-Neutral 0x7db] Exploit Next Generation®
[PH-Neutral 0x7db] Exploit Next Generation®[PH-Neutral 0x7db] Exploit Next Generation®
[PH-Neutral 0x7db] Exploit Next Generation®
 
Linux Kernel Exploitation
Linux Kernel ExploitationLinux Kernel Exploitation
Linux Kernel Exploitation
 
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
 
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor SkochinskyインテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
インテルMEの秘密 - チップセットに隠されたコードと、それが一体何をするかを見出す方法 - by イゴール・スコチンスキー - Igor Skochinsky
 
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
 
IoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT DevkitIoT Getting Started with Intel® IoT Devkit
IoT Getting Started with Intel® IoT Devkit
 
VM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with XenVM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with Xen
 
VM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzingVM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzing
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
 
Code Injection in Windows
Code Injection in WindowsCode Injection in Windows
Code Injection in Windows
 
A Hypervisor IPS based on Hardware Assisted Virtualization Technology
A Hypervisor IPS based on Hardware Assisted Virtualization TechnologyA Hypervisor IPS based on Hardware Assisted Virtualization Technology
A Hypervisor IPS based on Hardware Assisted Virtualization Technology
 

Similar to BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector

HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent SandboxHITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
Seunghun han
 
Lightweight Virtualization in Linux
Lightweight Virtualization in LinuxLightweight Virtualization in Linux
Lightweight Virtualization in Linux
Sadegh Dorri N.
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?
Jérôme Petazzoni
 
LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?
Jérôme Petazzoni
 
Fosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using Virtualization
The Linux Foundation
 
Secure container: Kata container and gVisor
Secure container: Kata container and gVisorSecure container: Kata container and gVisor
Secure container: Kata container and gVisor
Ching-Hsuan Yen
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and security
Jérôme Petazzoni
 
Sierraware ARM hypervisor
Sierraware ARM hypervisor Sierraware ARM hypervisor
Sierraware ARM hypervisor
Sierraware
 
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - WonokaerunLinux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerunidsecconf
 
Containers and workload security an overview
Containers and workload security an overview Containers and workload security an overview
Containers and workload security an overview
Krishna-Kumar
 
building_private_cloud_with_oss_for_scientific_environments-libre
building_private_cloud_with_oss_for_scientific_environments-librebuilding_private_cloud_with_oss_for_scientific_environments-libre
building_private_cloud_with_oss_for_scientific_environments-libreVijayabalan Open to Explore
 
Introduction to NetBSD kernel
Introduction to NetBSD kernelIntroduction to NetBSD kernel
Introduction to NetBSD kernelMahendra M
 
Enabling Worm and Malware Investigation Using Virtualization
Enabling Worm and Malware Investigation Using VirtualizationEnabling Worm and Malware Investigation Using Virtualization
Enabling Worm and Malware Investigation Using Virtualization
amiable_indian
 
Secure Containers with EPT Isolation
Secure Containers with EPT IsolationSecure Containers with EPT Isolation
Secure Containers with EPT Isolation
LinuxCon ContainerCon CloudOpen China
 
[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical
Moabi.com
 
Evolution of the Windows Kernel Architecture, by Dave Probert
Evolution of the Windows Kernel Architecture, by Dave ProbertEvolution of the Windows Kernel Architecture, by Dave Probert
Evolution of the Windows Kernel Architecture, by Dave Probert
yang
 
Operating system
Operating systemOperating system
Operating system
Kinza Razzaq
 
Pluggable Realworld Interfaces
Pluggable Realworld InterfacesPluggable Realworld Interfaces
Pluggable Realworld InterfacesTill Riedel
 

Similar to BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector (20)

HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent SandboxHITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
 
Lightweight Virtualization in Linux
Lightweight Virtualization in LinuxLightweight Virtualization in Linux
Lightweight Virtualization in Linux
 
Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?Docker, Linux Containers, and Security: Does It Add Up?
Docker, Linux Containers, and Security: Does It Add Up?
 
LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?
 
Fosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using Virtualization
 
Secure container: Kata container and gVisor
Secure container: Kata container and gVisorSecure container: Kata container and gVisor
Secure container: Kata container and gVisor
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and security
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Sierraware ARM hypervisor
Sierraware ARM hypervisor Sierraware ARM hypervisor
Sierraware ARM hypervisor
 
Linux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - WonokaerunLinux kernel-rootkit-dev - Wonokaerun
Linux kernel-rootkit-dev - Wonokaerun
 
Containers and workload security an overview
Containers and workload security an overview Containers and workload security an overview
Containers and workload security an overview
 
building_private_cloud_with_oss_for_scientific_environments-libre
building_private_cloud_with_oss_for_scientific_environments-librebuilding_private_cloud_with_oss_for_scientific_environments-libre
building_private_cloud_with_oss_for_scientific_environments-libre
 
Introduction to NetBSD kernel
Introduction to NetBSD kernelIntroduction to NetBSD kernel
Introduction to NetBSD kernel
 
Enabling Worm and Malware Investigation Using Virtualization
Enabling Worm and Malware Investigation Using VirtualizationEnabling Worm and Malware Investigation Using Virtualization
Enabling Worm and Malware Investigation Using Virtualization
 
Secure Containers with EPT Isolation
Secure Containers with EPT IsolationSecure Containers with EPT Isolation
Secure Containers with EPT Isolation
 
[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical
 
Evolution of the Windows Kernel Architecture, by Dave Probert
Evolution of the Windows Kernel Architecture, by Dave ProbertEvolution of the Windows Kernel Architecture, by Dave Probert
Evolution of the Windows Kernel Architecture, by Dave Probert
 
Oct2009
Oct2009Oct2009
Oct2009
 
Operating system
Operating systemOperating system
Operating system
 
Pluggable Realworld Interfaces
Pluggable Realworld InterfacesPluggable Realworld Interfaces
Pluggable Realworld Interfaces
 

Recently uploaded

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 

Recently uploaded (20)

Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 

BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector

  • 1. Seunghun Han, Jungwhan Kang (hanseunghun || ultract)@nsr.re.kr Myth and Truth about Hypervisor-Based Kernel Protector: The Reason Why You Need Shadow-Box
  • 2. - Senior security researcher at NSR (National Security Research Institute of South Korea) - Speaker at HITBSecConf 2016 - Author of the book series titled “64-bit multi- core OS principles and structure, Vol.1&2” - a.k.a kkamagui, @kkamagui1 Who are we ? - Researcher at NSR - Participated final round of some CTFs (Codegate, ISEC… held in South Korea) - Interested in OSsecurity and reading write-up of CTFs - Got married last year  - a.k.a ultract, @ultractt
  • 3. Goal of This Presentation - We present lightweight hypervisor-based kernel protector, “Shadow-box” - Shadow-box defends kernel from security threats efficiently, and we made it from scratch - We share lessons learned from deploying and operating Shadow-box in real world systems - We have been operating Shadow-box since last year and share lessons learned!
  • 4. Background Design Implementation Lessons Learned (and the Truth Previous Researches Did Not Tell You) Demo. and Conclusion (Black Hat Sound Bytes)
  • 5. Linux Kernel Is Everywhere!
  • 6. Security Threats of Linux Kernel - The Linux kernel suffers from rootkits and security vulnerabilities - Rootkits: EnyeLKM, Adore-ng, Sebek, suckit, kbeast, and so many descendants - Vulnerabilities: CVE-2014-3153, CVE-2015-3636, CVE-2016-4557, CVE-2017-6074, etc. Devices which use Linux kernel share security threats
  • 7. Melee Combats at the Kernel-level - Kernel-level (Ring 0) protections are not enough - Lots of rootkits and exploits work in the Ring 0 level - Protections against them are often easily bypassed and neutralized - Kernel Object Hooking (KOH) - Direct Kernel Object Manipulation (DKOM) Protections need an even lower level (Ring -1)
  • 8. Well-known Rootkits Other rootkits also have similar patterns
  • 9. Taking the Higher Ground - Leveraging virtualization technology (VT) - VT separates a machine into a host (secure world) and a guest (normal world) - The host in Ring -1 can freely access/control the guest in Ring 0 (the converse doesn’t hold) - VT-equipped HW: Intel VT-x, AMD AMD-v, ARM TrustZone
  • 10. UserUser Trends of Introducing Ring -1 User Kernel Guest (Normal World) Host (Secure World) Host OS Guest OS User Kernel Virtualization Technology (T.Z., VT-x, AMD-v) Monitor, control
  • 12. Researches Are Excellent, But They Look … I heard and knew about them But, I can not find in real world!
  • 13. - Many researches have preconditions - They usually change kernel code or hypervisor - They also need well-known hashes of LKM, well-known value of kernel data, secure VM for analyzing target VM, etc. - Many researches consume much resource - The host and the guest run each OS - They allocate resources independently! - The host consumes many CPU cycles to introspect the guest because of semantic gap Restrictions on Previous Researches (1)
  • 14. Restrictions on Previous Researches (2) - In conclusion, previous researches are considered for laboratory environment only - They assume they can control environment! - But, real world environment is totally different from laboratory environment! - You even don’t know the actual environment before the software is installed! REAL WORLD! WELCOME TO
  • 15. Therefore, PRACTICAL and LIGHTWEIGHT mechanism is needed for REAL WORLD ENVIRONMENT!
  • 16. Design Goals of Kernel Protector - Lightweight - Focus on rootkit detection and protection - Simple and extensible architecture - Small memory footprint - No secure VMs and no multiple OSes - Practical - Out-of-box approach - No modification of kernel code and data - Dynamic injection - Load any time from boot to runtime
  • 17. Background Design Implementation Lessons Learned (and the Truth Previous Researches Did Not Tell You) Demo. and Conclusion (Black Hat Sound Bytes)
  • 18. Security Architecture in Shadow Play Bulb Actors Audience
  • 19. Security Architecture in Shadow Play Ring -1 Monitoring Mechanism Activities in OS Security Monitor We named this architecture “Shadow-box” (Light-Box) (Shadow-Watcher)
  • 20. User Shared Area Light-Box (Lightweight Hypervisor) Architecture of Shadow-Box User (Read/Write Permission) Shared Kernel (Read-only Permission) Guest (Ring 0~3)Host (Ring -1) Shared Kernel Only Shared Kernel and User Shared Kernel (Read/Write Permission) Shadow- Watcher (Monitor) Monitor, control
  • 21. - Light-box, lightweight hypervisor, - Isolates worlds by using memory protection technique in VT - Shares the kernel area between the host (Ring -1) and the guest (Ring 0 ~ 3) - Does not run each OS in two worlds - Uses smaller resources than existing mechanisms and has narrow semantic gap - Can be loaded any time (loadable kernel module) Architecture of Light-Box
  • 22. - Shadow-watcher - Monitors the guest by using Light-box - Checks if applications of the guest modify kernel objects or not by event-driven way - Code, system table, IDT table, etc. - Checks the integrity of the guest by introspecting kernel object by periodic way - Process list, loadable kernel module (LKM) list, function pointers of file system and socket Architecture of Shadow-Watcher
  • 23. What can Shadow-Box do? - Shadow-box protects Linux kernel from - Static kernel object attacks - Static kernel object = immutable in runtime - Code modification and system table modification attacks - Dynamic kernel object attacks - Dynamic kernel object = mutable in runtime - Process hiding and module hiding - Function pointer modification attacks
  • 24. Background Design Implementation Lessons Learned (and the Truth Previous Researches Did Not Tell You) Demo. and Conclusion (Black Hat Sound Bytes)
  • 25. Boot Process using Shadow-Box Starting UEFI with Secure Boot Starting Bootloader Starting Linux Kernel Preparing Virtualization Separating and Starting the Guest Monitoring the Guest Starting Linux Applications Guest (Normal World) : Linux : Shadow-Box - Enabling VMX (Virtual Machine Extension) - Setting VMCS (Virtual Machine Control Structure) - Identifying kernel information - Separating memory area - Launching VMCS Host (Secure World) Loading Shadow-Box
  • 26. Static Kernel Object Protection (1) User Area Static Kernel Objects Shadow- Box Objects Host Physical Address Level.3 Level 4 Level 3 Level 2 Level 1 Paging Structure of EPT Level.2 Level.1 Physical Physical Physical VT-x Extended Page Table (EPT) CPU Guest Physical Address Read, Write, Execute Read, Execute No Permission
  • 27. Static Kernel Object Protection (2) Read, Execute Read, Execute Read, Execute Read, Execute No Permission Read, Execute Guest Page Table (GPT) Extended Page Table (EPT) Page 1 Page 2 Page 3 Guest Logical Address (GLA) Guest Physical Address (GPA) Host Physical Address (HPA) Page 1 Page 2 Page 3 Page 1 Page 2 Page 3 Guest (Normal World) Address Translation (Ring 0) Host (Secure World) Address Translation (Ring -1)
  • 28. Static Kernel Object Protection (3) Read, Execute Read, Execute Read, Execute No Permission Guest Page Table (GPT) Extended Page Table (EPT) Page 1 Page 2 Guest Logical Address (GLA) Guest Physical Address (GPA) Host Physical Address (HPA) Page 1 Page 1 Page 2 Page 3 EPT protects the host from attack propagation of the guest Guest (Normal World) Address Translation (Ring 0) Host (Secure World) Address Translation (Ring -1) Read, Execute Read, Execute Page 3 Page 2 Page 3 Write, Execute Read, Execute Page 3 Page 2 Page 3
  • 29. Static Kernel Object Protection (4) User Area Static Kernel Objects Shadow- Box Objects DMA VT-d DMA Remapping Reporting (DMAR) Table Physical Address DMA Address Read, Write No Permission No Permission Level.3 Level 4 Level 3 Level 2 Level 1 Paging Structure of Second Level Page Table Level.2 Level.1 Physical Physical Physical context Root Table Level.4 Context Table
  • 30. Dynamic Kernel Object Protection (1) A B F... Next Prev Next Next Prev Prev Task and Module List in Guest ⑤ Comparing data Task and Module Create Function do_fork() or load_module() { create_object(); modify_list(); } Task and Module Delete Function release_task() or delete_module() { delete_object(); modify_list(); } ② Inserting H/W breakpoint ③ Monitoring Task and Module List in Shadow-box① Creating initial data A B F... Next Prev Next Next Prev Prev ④ Shadowing list data
  • 31. VFS and Socket Objects of Guest FP Pointer Host Logical Address Module Code Malicious Code Open Function Pointer Structure Read Write Close Kernel Code ... Invalid Invalid Valid Valid Malicious Code (Loaded after Shadow-box) User Area Kernel Area Dynamic Kernel Object Protection (2) : Code area loaded before Shadow-box
  • 32. Privileged Register Protection - GDTR, LDTR and IDTR change interactions between kernel and user level - IA32_SYSENTER_CS, IA32_SYSENTER_ESP, IA32_STAR, IA32-LSTAR and IA32_FMASK MSR also change them - These privileged registers are rarely changed after boot! - So, Shadow-box - Locks the privileged registers - Locks and Monitors GDT, LDT, and IDT table
  • 33. Rootkit Detection - All rootkits are detected Name Detected? Detected Point EnyeLKM √ code change, module hide Adore-ng 0.56 √ function pointer change, module hide Sebek 2.0 √ system table change, module hide Suckit 2.0 √ system table change kbeast √ system table change, module hide
  • 34. Performance Measurements of Prototype - Application benchmarks show 1% ~ 10% performance overhead - 5.3% at kernel compile in single-core processor - 6.2% at kernel compile in multi-core processor Results of Application Benchmark. Lower is better. (Intel i7-4790 4core 8thread 3.6GHz, 32GB RAM, 512GB SSD) Single-core processor Multi-core processor
  • 35. Background Design Implementation Lessons Learned (and the Truth Previous Researches Did Not Tell You) Demo. and Conclusion (Black Hat Sound Bytes)
  • 36. Ready to launch! We deployed Shadow-box in REAL WORLD! and …
  • 37. We met BEASTS of REAL WORLD! (false positive, slow-down, system hang, etc.) WHAT HAPPENED… OH, NO… Previous researches did not tell us something important! AGAIN! NICE TO MEET YOU
  • 38. Lessons Learned - 1 - Code is not immutable! - Linux kernel has a CONFIG_JUMP_LABEL option! - If this option is set, Linux kernel patches itself on runtime! - Unfortunately, this option is set by default! - Solution - Option 1: Add exceptional cases for mutable code pages - Option 2: If you can build kernel, Turn Off CONFIG_JUMP_LABEL option NOW!
  • 39. Lessons Learned - 2 - Cache type in EPT is very important! - Linux system has some memory mapped I/O area - BIOS area, APIC area, PCI area, etc. - Misconfiguration makes various problems such as system hang, slow down, video mode change error, etc. - Solution - Set uncacheable type by default - Set write-back type to “System RAM” area only!
  • 40. Lessons Learned - 2 Write-back Cache Type Uncacheable Cache Type by Default
  • 41. Lessons Learned - 3 - Multi-core environment is more complicated than you think! - Each core modifies process list and module list concurrently - When H/W breakpoint exception occurred, other cores could be changing the lists already! - So, we need a mechanism for synchronizing lists - Solution - Lock tasklist_lock and module_mutex of the guest while Shadow-box is checking the lists!
  • 42. Now, We have been operating Shadow-box in REAL WORLD SUCCESSFULLY !
  • 43. Background Design Implementation Lessons Learned (and the Truth Previous Researches Did Not Tell You) Demo. and Conclusion (Black Hat Sound Bytes)
  • 44. DEMO
  • 45. Future Work X86 VT-x, VT-d (Virtualization Technology) Shadow-Box Linux TrustZone (Virtualization Technology) Shadow-Box Linux Multi-platform Support!
  • 46. Conclusion and Black Hat Sound Bytes - Kernel-level (Ring 0) threats should be protected in a more privileged level (Ring -1) - We create Ring -1 level by using VT from scratch - Shadow-box is lightweight and practical - Shadow-box uses less resource than existing mechanisms and protects kernel from rootkits - Real world is Serengeti! - Real world is different from laboratory environment - You should have a strong mentality for defeating beasts of real world! or use Shadow-box instead!
  • 47. THANK YOU THE CHOICE IS YOURS ! Contact: hanseunghun@nsr.re.kr, @kkamagui1 ultract@nsr.re.kr, @ultractt Project : github.com/kkamagui/shadow-box-for-x86