detection of an hvm rootkit (aka bluepill-like) desnos ... · desnos anthony (esiea si&s)...

34
Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like)

Upload: duongtuyen

Post on 10-Sep-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 2: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Rootkit– Userland

– Kernelland

Page 3: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Userland– Replace binaries

– Patch on the fly

– Syscall proxy

– Remote Userland Execve

Page 4: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Kernel land– Hooks in text section

– Hooks in data (structures)

– No Hook !

Page 5: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● HVM (Hardware-based Virtual Machine) Rootkit– Use virtualization

● Rootkit ring -1● All power on the host

Page 6: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Virtualization– AMD

● SVM

– Intel● VMX

Page 7: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● SVM – Quickly switch from host to guest,

– Interception of instructions or guest's events,

– DMA access protection : EAP (External Access Protection),

– Tagged TLB between the hypervisor and the virtual machines.

Page 8: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● HVM Rootkit– "Switching the operating system in a virtual

machine"● All classic time sources may be intercepted

(RDTSC, I/O, ...)● All users' actions

Page 9: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● BluePill– The first and the only public HVM rootkit

– Released in 2006 (vista 64 bits, AMD) by Joanna Rutkowska

– Latest version 0.32 (AMD + Intel) (~ 10.000 lines)

Page 10: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Controversy– Security buzz

● Advertisements :– « End of the world » / « undetectable rootkit »

● « Tout va bien madame la marquise »● Detecting a hypervisor is the same way as an HVM

rootkit ?

Page 11: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Solutions :– Timing attack

– Pattern matching

– TLB

– DMA/Firewire

– Cpu Bugs

Page 12: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Analysis– No hook (no installation after a reboot)

– Loading of BluePill :● like a driver

– Vista : driver signing● F8 during the boot

● by a memory device● by a kernel bug

Page 13: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 14: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 15: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Analysis– Interceptions

● vmrun, vmload, vmsave● msr efer, vm hsave pa, tsc● clgi, stgi● SMM● Debug● cpuid, rdtsc, rdtscp

Page 16: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Protections– Against rdtsc

– Blue Chicken

Page 17: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● No viral payload ?!– Simple hypervisor

– « hvm rootkit » poc

● Why ?

Page 18: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Why ?– No hook on the system

– Filtering I/O● Time !

Page 19: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Detection techniques– Memory fingerprint

● Use the classic memory allocator● Rootkit can bypassed it

Page 20: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Detection techniques– Timing attack

● Impossible (rootkit is here !)

Page 21: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Detection techniques– Timing attack

● Impossible (rootkit is here !)● External sources ?

– NTP– Counter

Page 22: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Counter (original idea from Barbosa)– No information

– 2 threads in kernel land● Calling an intercepted instruction● Incrementing a variable

– Each thread on a cpu

– Drawbacks :● Processor with >= 2 cpu● Variable frequency

Page 23: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 24: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 25: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 26: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 27: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 28: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 29: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 30: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 31: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

Page 32: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Without BluePill :– Average : 30 incrementations/instruction

● With BluePill :– Average : 330 incrementations/instruction

● « hvm rootkit » poc– x 10 !!

● usefull rootkit !

Page 33: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Conclusion :– No rootkit is really undetectable

– The opposite is also true

Page 34: Detection of an HVM rootkit (aka BluePill-like) Desnos ... · Desnos Anthony (ESIEA SI&S) Filiol Éric (ESIEA (v+c)^o) Detection of an HVM rootkit (aka BluePill-like) Userland –

Desnos Anthony (ESIEA SI&S)

Filiol Éric (ESIEA (v+c)^o)

Detection of an HVM rootkit (aka BluePill-like)

● Conclusion– Stay away from the security buzz

– Protection ?● Desactivation of the virtualization in the bios● A key to activate the virtualization

– Impossible to access !● Hypervisor of protection