how to hack a turned-off computer, or running … to hack a turned-off computer, or running unsigned...

73
How to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy

Upload: trankien

Post on 10-Mar-2018

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

0

How to Hack a Turned-Off

Computer, or Running

Unsigned Code in

Intel Management Engine

Mark Ermolov

Maxim Goryachy

Page 2: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

1

We Are Going To…

• Reveal an Intel ME vulnerability (CVE-2017-5705,6,7) allowing arbitrary code execution

• Emphasize the dangers of such bugs in digitally signed firmware

• Show how we bypassed built-in exploitation mitigations

• Disclose architecture flaws in Intel ME

Page 3: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

2

Who is Mark Ermolov

System programmer interested in securityaspects of hardware, firmware, and low-level systemsoftware. Currently researching inner workings ofIntel platforms (PCH, IOSF, iGPU).

@_markel__mermolov{at}ptsecurity.com

Page 4: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

3

Who is Maxim Goryachy

System and embedded developer and securityresearcher. Interested in cryptography, virtualizationtechnologies, reverse engineering, and hardware.

@h0t_maxmgoryachy{at}ptsecurity.com

Page 5: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

4

Our Research Team

Maxim Goryachy

Mark Ermolov

Dmitry Sklyarov

Tapping into the Core Intel DCI Secret

Intel ME: Flash File System Explained

Intel ME: The Way of the

Static Analysis

Page 6: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

5

Agenda

• Intel Management Engine 11 overview• Known public vulnerabilities• Potential attack vectors• Vulnerability• Bypassing mitigation• Possible exploitation vectors• Demo

Page 7: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

6

Intel Management Engine 11Overview

Page 8: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

7

Intel ME 11

• Excluding publications such as Dr. Ruan’s book [PSTR14], ME is a partially documented Intel technology with proprietary firmware

• Root of trust for multiple security features such as PAVP, PTT and Boot Guard

• Has full access to many Intel hardware devices

• Has hardware capabilities for interception of some user activity

• An integral component for all stages of the platform operating cycle

Page 9: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

8

Intel ME 11 Design

• Independent 32-bit processor core (x86)• Running own modified MINIX• Has a built-in Java machine [IMS14] • Interacts with CPU/iGPU/USB/DDR/PCI/...• Works when main CPU is powered down (M3 mode)• Starter code is burned in non-reprogrammable on-

die memory

Page 10: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

9

Intel ME 11 – Related Technologies

• Intel Active Management Technology

• Intel Protected Audio Video Path

• Intel Platform Trust Technology

• Intel Software Guard Extensions [PSTR14]

• Intel Boot Guard

• ...

Page 11: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

10

Intel ME 11 – Related Technologies

ME 11

PAVP

AMT

BootGuard

SGX

PTTfTPM

Page 12: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

11

Known Public Vulnerabilities

Page 13: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

12

Known Public Vulnerabilities

2005

AMT 1.0

2009 2010 2015 2017

AMT 6.0 AMT 11.0

Ring-3 rootkit (Q35) [IRR09]

Security evaluation of Intel’s Active Management Technology [SMT10]

Silent Bob is Silent (CVE-2017-5689) [ASM17]

Page 14: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

13

Known Public Vulnerabilities

• Alexander Tereshkin and Rafal Wojtczuk of Invisible Things Lab: Introducing Ring-3 Rootkits (code execution)

• Vassilios Ververis of the Royal Institute of Technology: Security Evaluation of Intel’s Active Management Technology(AMT authentication bypass)

• Dmitriy Evdokimov, Alexander Ermolov, and Maksim Malyutin of Embedi: Silent Bob is Silent (AMT authentication bypass)

Page 15: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

14

Over the past 12 years, only one vulnerability allowing execution of

arbitrary code on ME has been found!

Page 16: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

15

Now we have two of them!

Page 17: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

16

Potential attack vectors(ways to impact)

Page 18: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

17

How we can impact Intel ME

• Local communication interface (HECI)

• Network (vPro only)

• IPMI/MCTP

• Host memory (UMA)

• Firmware SPI layout

• Internal file system

Page 19: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

18

HECI

• Main interface for communication between host and ME

• Represented as PCI device • Transports dozens of ME service protocols • Undocumented; some protocol formats can be found in

coreboot• MEBx and BIOS use HECI to set up ME• Used by Intel tools for updating and manufacture-line

configuring

Page 20: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

19

Network (vPro only)

• ME implements various industry-standard protocols (IP, HTTP, WPA2, KERBEROS)

• Has built-in full-fledged web and VNC servers

• Complete platform control is exposed in XML-based WSMAN protocol

• Most functionality is in one large module (AMT)

Page 21: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

20

UMA

Currently UMA is encrypted by AES with integrity checking via unknown cyclic redundancy code

Page 22: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

21

Firmware SPI Layout

• Has complex structure

• We found bugs in parsing procedures of signed data (not exploitable if you don’t have Intel’s private key)

• Firmware code is generally not vulnerable to “evil SPI flash” attack

evil

Page 23: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

22

Internal Flash File System (MFS)

Have you attendedIntel ME: Flash File System Explained

by Dmitry Sklyarov? ;)

Page 24: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

23

Potential attack vectors(which modules?)

Page 25: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

24

Access Control Model

• Process is a subject of access control

• A process has statically defined access rights ➢ User and groups identity for file system access

➢ List of allowed hardware resources

➢ List of allowed kernel syscalls

Page 26: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

25

Architecture Problems

➢ A process with permission to create new processes can spawn one more privileged than itself

➢ Access to some internal devices completely breaks the security model

Page 27: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

26

Modules With High Privileges

• “ROM”

• RBE

• KERNEL

• BUP

• LOADMGR

• PM

Page 28: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

27

BUP is very tempting

Page 29: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

28

BUP Overview

• First user-mode process• Exists on all platforms• Has access to security-sensitive hardware (e.g.,

DMA controller)• Can create new processes• Performs early platform initialization• Can bypass MFS protection (via SPI controller)• Builds basic configuration for all other processes

Page 30: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

29

BUP: More Reasons

• One of the largest modules

• Duplicates a lot of other modules’ functionality

• Processes large amount of configuration data

• Interacts with the host via HECI

Page 31: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

30

Trace Hub Initialization

void __cdecl bup_init_trace_hub(){

int err; // eaxsigned int npk_reg_idx; // ebxunsigned int bytes_read; // [esp+0h] [ebp-350h]unsigned int file_size; // [esp+4h] [ebp-34Ch]int si_features[5]; // [esp+8h] [ebp-348h]int ct_data[202]; // [esp+1Ch] [ebp-334h] 808 bytesint cookie; // [esp+344h] [ebp-Ch]

cookie = gRmlbCookie;memset(si_features, 0, 0x14u);bytes_read = 0;file_size = 0;if ( !(getDW_sel(0xBF, 0xE0u) & 0x1000000)

&& !bup_get_si_features(si_features)&& !bup_dfs_get_file_size("/home/bup/ct", &file_size) )

{if ( file_size ){

LOBYTE(err) = bup_dfs_read_file("/home/bup/ct", 0, ct_data, file_size, &bytes_read);npk_reg_idx = 0;if ( !err ){while ( npk_reg_idx < HIWORD(ct_data[1]) ){

if ( HIBYTE(ct_data[2 * npk_reg_idx + 2]) == 1 )putDW_sel(0xB7, ct_data[2 * npk_reg_idx + 2] & 0xFFFFF, ct_data[2 * npk_reg_idx + 3]);

if ( HIBYTE(ct_data[2 * npk_reg_idx + 2]) == 2 )putDW_sel(0xBF, ct_data[2 * npk_reg_idx + 2] & 0xFFFFF, ct_data[2 * npk_reg_idx + 3]);

++npk_reg_idx;}bup_switch_tracer(0xB7, 0xBFu);

}}

}if ( gRmlbCookie != cookie )

sys_fault();}

Page 32: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

31

The Vulnerability

void __cdecl bup_init_trace_hub(){...int ct_data[202]; // [esp+1Ch] [ebp-334h] 808 bytesint cookie; // [esp+344h] [ebp-Ch]

cookie = gRmlbCookie;...if ( !(getDW_sel(0xBF, 0xE0u) & 0x1000000)&& !bup_get_si_features(si_features)&& !bup_dfs_get_file_size("/home/bup/ct", &file_size) )

{if ( file_size ){LOBYTE(err) = bup_dfs_read_file("/home/bup/ct", 0, ct_data, file_size, &bytes_read);

... if ( gRmlbCookie != cookie )sys_fault();

}

Page 33: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

32

808-byte Mystery

void __cdecl bup_init_trace_hub(){...int ct_data[202]; // [esp+1Ch] [ebp-334h] 808 bytes

...}

Page 34: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

33

Trace Hub Configuration Binary

name mode opt cb uid gid offset mode opt path

.. 13C0 0000 0000 0003 0000 00003388 /home/

ct 01E0 0009 0000 0003 015F 0000338B ---rwxr----- ?--F /home/bup/ct

df_cpu_info 01FF 0009 0004 0003 00CE 0000338B ---rwxrwxrwx ?--F /home/bup/df_cpu_info

Not signed From fitc.cfg

Page 35: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

34

Stack Guard

void __cdecl bup_init_trace_hub(){...int ct_data[202]; // [esp+1Ch] [ebp-334h] 808 bytesint cookie; // [esp+344h] [ebp-Ch]

cookie = gRmlbCookie;...if ( !(getDW_sel(0xBF, 0xE0u) & 0x1000000)&& !bup_get_si_features(si_features)&& !bup_dfs_get_file_size("/home/bup/ct", &file_size) )

{if ( file_size ){LOBYTE(err) = bup_dfs_read_file("/home/bup/ct", 0, ct_data, file_size, &bytes_read);

... if ( gRmlbCookie != cookie )sys_fault();

}

Page 36: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

35

Stack Guard Implementation

• Each process has unique value for stack cookie

• Value is obtained from hardware random number generator

• Stored in nonvolatile process memory

• If stack’s copy of cookie is changed, process terminates

Page 37: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

36

Bypass mitigations

Page 38: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

37

How to Bypass Stack Guard?

➢ Break random number generator

➢ Intercept code flow before cookie checking

Page 39: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

38

Break Random Number Generator

If Random Number Generator is broken, RBE doesn’t start at all

signed int InitRandDev(){signed int i; // edx@1signed int result; // eax@4

dev_rnd_seed = 0xDC80;dev_rnd_conf = 0x44050;RandDevPriming(0x190u);i = 1001;while ( !(dev_rand_sts & 1) ){if ( !--i )return DEVERROR;

}result = DEVERROR;if ( (dev_rand_sts & 0xF) == 15 )result = NOERROR;

return result;}

Page 40: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

39

How to Bypass Stack Guard?

➢ Break random number generator

➢ Intercept code flow before cookie checking

Page 41: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

40

Code Flow (For C Programmers)

void __cdecl bup_init_trace_hub(){...

LOBYTE(err) = bup_dfs_read_file("/home/bup/ct", 0, ct_data, file_size, &bytes_read);... }

char __cdecl bup_dfs_read_file(char *file_name, int offset, char *buffer, unsigned int read_size, unsigned int *out_bytes_read){...

*out_bytes_read = read_size;LOBYTE(res) = bup_read_mfs_file(7, fitc_file_desc.data_offset + offset, out_bytes_read, sm_mem_id, 0);

...}

int __cdecl bup_read_mfs_file(BUP_MFS_DESC *mfs_desc, int file_number, unsigned int offset, unsigned int *size, int sm_block_idx, __int16 proc_thread_id){...

while ( 1 ) {if ( cur_offset >= read_size ) break;

...err = bup_mfs_read_data_chunks(mfs_desc, buffer, mfs_desc->data_chunks_offset + ((read_start_chunk_id - mfs_desc->total_files) << 6), block_chunks_count);

...err = sys_write_shared_mem(proc_thread_id, sm_block_idx, cur_offset, &buffer[chunk_offset], copy_size, copy_size);

...}

}...}

signed int __cdecl sys_write_shared_mem(__int16 owner_proc_thread_id, int block_idx, int offset, char *src_data, unsigned int src_size, unsigned int write_size){...

sm_block_desc = sys_get_shared_mem_block(block_idx); ...

memcpy_s((sm_block_desc->start_addr + offset), sm_block_size - offset, src_data, write_size);...}

Page 42: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

41

Code Flow (For People)

bup_init_trace_hub

bup_read_mfs_file

sys_write_shared_mem

bup_dfs_read_file

Page 43: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

42

Inside sys_write_shared_mem

signed int __cdecl sys_write_shared_mem(...){...

sm_block_desc = sys_get_shared_mem_block(block_idx);...

memcpy_s((sm_block_desc->start_addr_linked_block_idx + offset), sm_block_size - offset, src_data, write_size);... }

int __cdecl sys_get_ctx_struct_addr(SYS_LIB_CTX_STRUCT_ID struct_id){...

sys_ctx_start_ptr = sys_get_tls_data_ptr(SYSLIB_GLB_SYS_CTX);switch ( struct_id ) {

case SYS_CTX_SHARED_MEM:addr = *sys_ctx_start_ptr + 0x68;break;

...}

return addr;}

sys_get_tls_data_ptr proc neartls_idx = dword ptr 8

push ebpmov ebp, espmov eax, large gs:0mov ecx, [ebp+tls_idx]pop ebplea edx, ds:0[ecx*4]sub eax, edxretn

sys_get_tls_data_ptr endp

[...]

???

Page 44: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

43

target_thread_io_handle

size

mmio_selector

start_address

isUsed

target_thread_io_handle

size

mmio_selector

start_address

isUsed

What is gs:[0]?

...

0

+0x68SYS_CTX_SHARED_MEM_CTRL

...

+0x28KERN_SHARED_MEM_DESC

...self pointer

0

-4

-8

-0xC

-0x10

last error

thread ID

syslib ctx pointer

0

target_thread_io_handle+0x10

+0xC

+8

+4

0

size

mmio_selector

start_address

isUsedgs:[0]

Thread Local Storage

Page 45: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

44

Serious Architecture Problem

Thread Local Storage resides at thread stack bottom

Page 46: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

45

Stack Layout

buffer

cookie

ret address

callers’ frames

default heap

self pointer

last error

thread ID

syslib ctx ptr

unused

Thread Local Storage

0xffffffff

0x00000000

Stack grows

gs:[0]

Overflow progress

Page 47: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

46

A New Hope

• Function bup_read_mfs_file gets address of destination buffer from syslib_context

• Reads file data and writes to destination by chunks iteratively

• We can get arbitrary write primitive replacing syslib_context pointer

• We can rewrite memcpy’s return address

Page 48: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

47

Arbitrary Write Scheme

buffer

syslib ctx ptr

new syslib ctx

new smem desc

syslib ctx

smem desc

ret addr

dst

src

count

memcpy frame

(called by sys_shared_mem_write)

controlled

destination

of

next

chunk

copy

Page 49: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

48

Non-Executable Stack

Page 50: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

49

Non-Executable Stack

Problem:Stack segment doesn’t intersect with code segment

Solved:We found ROP gadgets for own process creation

Page 51: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

50

Non-Executable Stack Bypass

• Create own code module and integrate it into firmware

• Using ROP, load the module into memory

• Using ROP, create new process with highest privileges

Page 52: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

51

Vulnerability Overview

Page 53: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

52

CVE-2017-5705,6,7

• CVSSv3: AV:L/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H (8.2 High)

• Attacker with local access to the system can load and execute arbitrary code

• Affected Intel® Management Engine (ME), Intel® Server Platform Services (SPS), and Intel® Trusted Execution Engine (TXE)

Page 54: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

53

Affected Products

• 6th, 7th & 8th Generation Intel® Core™ Processor Family• Intel® Xeon® Processor E3-1200 v5 & v6 Product Family• Intel® Xeon® Processor Scalable Family• Intel® Xeon® Processor W Family• Intel® Atom® C3000 Processor Family• Apollo Lake Intel® Atom Processor E3900 series• Apollo Lake Intel® Pentium™• Celeron™ N and J series Processors

Page 55: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

54

Possible Exploitation Vectors

Page 56: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

55

Possible Exploitation Vectors

Restriction: Attacker needs write access to MFS partition of

ME SPI region

Page 57: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

56

Ways to Rewrite ME SPI Region

• Mistakes in SPI flash region settings in SPI flash descriptor

• Via HMR-FPO HECI message✓ Manufacture mode✓ Attack on UEFI setup variable✓ DMA attack

• Security Descriptor Override jumper• SPI programmer• ...

Page 58: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

57

Is Remote Exploitation Possible?

• Yes, if:

✓ AMT is enabled on the target and attacker knows password*

✓ BIOS has “Flash Rewrite Enable” option✓ BIOS password is blank or known

*Attacker can use AMT authentication bypass vulnerability

(CVE-2017-5689)

Page 59: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

58

BAD NEWS

Page 60: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

59

Bad News – HAP

HAP is no cure-all(for CVE-2017-5705,6,7)

*Mark Ermolov, Maxim Goryachy Disabling Intel ME 11 via undocumented mode [DMU17]

Page 61: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

60

Bad News – Firmware Downgrade

Intel Firmware Update against CVE-2017-5705,6,7 doesn’t help because ROM allows ME downgrading

Page 62: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

61

Bad News – TLS

ME 11.8.50.3399TLS is still in at the same place

Page 63: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

62

Demo time

Page 64: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

63

Demo 1

AMT on non-vPro platform

Page 65: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

64

Demo 2

JTAG for Intel ME

Page 66: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

65

Demo 3

Hello from Intel ME

Page 67: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

66

Intel ME 11 – Related Technologies

• Intel Active Management Technology

• Intel Protected Audio Video Path

• Intel Platform Trust Technology (fTPM)

• Intel Software Guard Extensions

• Intel Boot Guard

Page 68: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

67

100% Protection?

Waiting for Intel Management Engine 13!(maybe Intel will remove it from PCH... ;)

Page 69: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

68

Our Achievements

• Switched-on AMT on non-vPro systems

• Activated JTAG for Intel ME via the vulnerability

• Dumped starter code (aka ROM)

• Recovered complete Huffman code for ME 11

• Extracted Integrity and Confidentiality Platform Keys [FFS17]

• Bypassed Intel Boot Guard

Page 70: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

69

Kudos!

• Positive Technologies for allowing us to spend part of our working time on it!

• Dmitry Sklyarov • Plato Mavropoulos• People who have helped us but don’t want

their names to be published ;)

Page 71: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

70

Disclosure timeline

✓ 27/06/2017 - Bug reported to Intel PSIRT

✓ 28/06/2017 - Intel started initial investigation

✓ 05/07/2017 - Intel requested proof-of-concept

✓ 06/07/2017 - Additional information sent to Intel PSIRT

✓ 17/07/2017 - Intel acknowledged the vulnerability

✓ 28/07/2017 - Bounty payment received

✓ 20/11/2017 - Intel published SA-00086 security advisory

Page 72: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

71

References

[IMS14] Igor Skochinsky, Intel ME Secrets. Hidden code in your chipset and how to discover what exactly it does. Hex-Rays. RECON 2014.

[STW17] Dmitry Sklyarov, ME: The Way of the Static Analysis. Troopers 2017.[FFS17] Dmitry Sklyarov, Intel ME: flash file system explained, Black Hat Europe, 2017.[IRR09] Alexander Tereshkin, Rafal Wojtczuk, Introducing Ring-3 Rootkits. Black Hat USA, 2009

Las Vegas, NV.[SMT10] Vassilios Ververis, Security Evaluation of Intel’s Active Management Technology, Sweden 2010

TRITA-ICT-EX-2010:37.[PSTR14] Xiaoyu Ruan, Platform Embedded Security Technology Revealed: Safeguarding the Future of

Computing with Intel Embedded Security and Management Engine, 2014, Apress, ISBN 978-1-4302-6572-6.

[ASM17] Dmitriy Evdokimov, Alexander Ermolov, Maksim Malyutin, Intel AMT Stealth Breakthrough, Black Hat USA, 2017 Las Vegas, NV.

[DMU17] Mark Ermolov, Maxim Goryachy, Disabling Intel ME 11 via undocumented mode, https://www.ptsecurity.com/upload/corporate/ww-en/analytics/Intel-ME-disable-eng.pdf, 2017.

Page 73: How to Hack a Turned-Off Computer, or Running … to Hack a Turned-Off Computer, or Running Unsigned Code in Intel Management Engine Mark Ermolov Maxim Goryachy 1 We Are Going To…

72

Thank you!

Questions?

Mark ErmolovMaxim Goryachy