Download - Todod Sobre Uefi
-
7/25/2019 Todod Sobre Uefi
1/35
La defensa del patrimonio tecnolgico
frente a los ciberataques
1 y 11 de diciembre de 2 14
www.ccn-cert.cni.es 2014 Centro Criptolgico Nacional
C/Argentona 20, 28023 MADRID
UEFI: Un arma de doble filo
-
7/25/2019 Todod Sobre Uefi
2/35
VIII JORNADAS STIC CCN-CERT
BIOS UEFI
-
7/25/2019 Todod Sobre Uefi
3/35
VIII JORNADAS STIC CCN-CERT
1.1 BIOS / UEFI. Dnde estamos?
Mucho parque informtico an con sistemas de arranque basados en
BIOS.
UEFI actualmente evoluciona gracias a la aportacin de un grupo de
empresas OEMs, IBVs, ISVs, IHVs.
A pesar de la irrupcin de UEFI, para las plataformas x86 siemprehabr elementos de cdigo BIOS presentes. (CSM).
En ambos mundos, siempre habr unas cuantas lneas en
ensamblador, para inicializar el HW al menos.
Reducido nmero de fabricantes de BIOS (IBV)
Ventaja para el atacante
-
7/25/2019 Todod Sobre Uefi
4/35
VIII JORNADAS STIC CCN-CERT
UEFI Linea de tiempos
-
7/25/2019 Todod Sobre Uefi
5/35
VIII JORNADAS STIC CCN-CERT
UEFI. Qu es?
UEFI - Es una especificacin de una interfaz para interactuar con el
firmware de una plataforma a la hora de arrancar un sistema.
PI (Platform Initialization) define el cmo se hace esta inicializacin.
UEFI es una especificacin independiente de la plataforma
PI Aglutina la parte dependiente de la arquitectura especfica
Participan en el Unified EFI Forum ms de 240 empresas
AMD, AMI, Apple, Dell, HP, IBM, Insyde, Intel, Lenovo, Microsoft, and
Phoenix Technologies (PROMOTORES).
Permite una estrategia de generacin de cdigo compartida entre
OEMs, IBVs, IHVs Crecimiento en volumen de cdigo enorme
HP Elitebook 2540p (201?): 42 PEIMs, 164 DXE drivers
HP Elitebook 850 G1 (2014): 117 PEIMs, 392 DXE drivers
-
7/25/2019 Todod Sobre Uefi
6/35
VIII JORNADAS STIC CCN-CERT
UEFI Fases diferenciadas en el arranque
-
7/25/2019 Todod Sobre Uefi
7/35
VIII JORNADAS STIC CCN-CERT
UEFI en un flash (1)
UEFI es una especificacin independiente de la arquitectura
Existe tanto para plataformas de 32 y 64 bits
Actualmente soporta: ITANIUM, x86, x64, ARM (32/64), EBC.
PI (Platform Initialization) aglutina la parte dependiente de la
arquitectura
Modelo formal de extensibilidad de la arquitectura
Uso de Firmware Volumes (FVs), Firmware File Systems (FFSs)
GUIDs,
Formato PE en los ejecutables,
Anlisis de dependencias de mdulos. Parte del cdigo tpicamente reside en FW, parte en soporte externo.
EFI system Partition (ESP). Mnimo 200 Mb y formateada como FAT32
Variables BCD se almacenan tpicamente en la ESP
Requiere disco duro particionado como GPT
-
7/25/2019 Todod Sobre Uefi
8/35
VIII JORNADAS STIC CCN-CERT
UEFI en un flash (2)
UEFI corre en long-mode en x64 Entorno ptimo para utilizar tcnicas modernas de programacin y
herramientas
BIOS por el contrario es un entorno de 16-bits en modo real
Complementa el Advanced Configuration and Power Interface (ACPI).
Diferentes alternativas de cdigo segn el tipo de arranqueMayorsuperficie de ataque
Run-time Services limitados en UEFI de cara al S.O.
Bsicamente Set/Get Variables que permiten por ejemplo alterar el
proceso de arranque.
Soporta protocolos IPv4 e IPv6 para la localizacin de mdulos dearranque por red
Tambin se puede arrancar por red (PXE).
-
7/25/2019 Todod Sobre Uefi
9/35
VIII JORNADAS STIC CCN-CERT
Proceso de arranque en BIOS
-
7/25/2019 Todod Sobre Uefi
10/35
-
7/25/2019 Todod Sobre Uefi
11/35
VIII JORNADAS STIC CCN-CERT
SECURE BOOT -
Desde la especificacin UEFI 2.3.1 se aadi como caracterstica de
seguridad para proteger los sistemas UEFI de Bootkits
Valida la integridad del cargador de arranque del Sistema Operativo
antes de transferir el control.
No requiere de TPM (Trusted Platform Module) Cuando est habilitado se debe inhabilitar el CSM (legacy boot)
Se apoya en una jerarqua de claves con una responsabilidad
compartida.
En plataformas Microsoft, funciona para Windows 8.x y 2012 Server.
-
7/25/2019 Todod Sobre Uefi
12/35
VIII JORNADAS STIC CCN-CERT
SECURE BOOT - Claves
PK Relacin de
confianza entre el dueo
de la plataforma y el FW
KEKs Entre el FW y
el/los OSs
DB firmas o hashes de
mdulos permitidos
DBx firmas o hashes de
mdulos no permitidos
Se verifican cuando elBootLoader carga la
imagen
-
7/25/2019 Todod Sobre Uefi
13/35
VIII JORNADAS STIC CCN-CERT
Listado de Claves en Men BIOS
-
7/25/2019 Todod Sobre Uefi
14/35
VIII JORNADAS STIC CCN-CERT
Powershell Verificacin del estado de las claves
Get/Set-SecureBootUEFI Get-SecureBootPolicy
Confirm/Format-SecureBootUEFI
-
7/25/2019 Todod Sobre Uefi
15/35
VIII JORNADAS STIC CCN-CERT
Proceso de verificacin de firmas en SecureBoot
Realizada por el Boot Manager Una vez insertado el hash o firma, se da por bueno.
Fuente: www.oschina.net intel developers forum 2012)
.
-
7/25/2019 Todod Sobre Uefi
16/35
VIII JORNADAS STIC CCN-CERT
NVRAM. Ubicacin y contenidos.
Fuente: www.intel.com
-
7/25/2019 Todod Sobre Uefi
17/35
VIII JORNADAS STIC CCN-CERT
Fptw64 - Volcado a disco de la FLASH
Depende de la configuracin de variables NVRAM
-
7/25/2019 Todod Sobre Uefi
18/35
VIII JORNADAS STIC CCN-CERT
Grabado de la NVRAM va HW
Esta opcin siempre es viable.
Fuente: www.minnowboard.org
.
-
7/25/2019 Todod Sobre Uefi
19/35
VIII JORNADAS STIC CCN-CERT
UEFITOOL Contenidos de volumen BIOS en UEFI
Volumen PEI PEIMs.
-
7/25/2019 Todod Sobre Uefi
20/35
VIII JORNADAS STIC CCN-CERT
UEFITOOL Contenidos de volumen BIOS en UEFI
Volumen DXE Drivers.
-
7/25/2019 Todod Sobre Uefi
21/35
VIII JORNADAS STIC CCN-CERT
UEFITOOL Contenidos de volumen BIOS en UEFI
Capacidad de edicin y sustitucin de mdulos.
-
7/25/2019 Todod Sobre Uefi
22/35
VIII JORNADAS STIC CCN-CERT
UEFI Puntos de vista de atacante y defensor
1999 20TH CENTURY FOX FILM CORP.
Cuanto cdigo tanordenadito. Adems
se puede programar
en C.
Formato PEBIEN.
A mi disposicin el
disco donde reside
el S.O. Existe mdulo
DXE NTFS
Si puedo aadir mi
driver DXE . estoy
en mejor situacin
que cuando
modificaba elMBR/VBR NO?
La estandarizacines buena. Mil ojos
velan por una
especificacin
segura.
Tengo conocimiento
y control del SW
instalado en mi FW Puedo saber si ha
habido
modificaciones.
Aunque el
mantenimiento y
gestin no es an
muy amigable, lo
veo factible.
-
7/25/2019 Todod Sobre Uefi
23/35
VIII JORNADAS STIC CCN-CERT
Una vez realizada la agresin, el camino es largo
Fuente: www.virusbtn.com
.
Proceso de infeccin del Bootkit DreamBoot
-
7/25/2019 Todod Sobre Uefi
24/35
VIII JORNADAS STIC CCN-CERT
sexy ?
-
7/25/2019 Todod Sobre Uefi
25/35
VIII JORNADAS STIC CCN-CERT
COPERNICUS Herramienta de verificacin de
integridad y gestin de configuracin
-
7/25/2019 Todod Sobre Uefi
26/35
VIII JORNADAS STIC CCN-CERT
CHIPSEC Platform Security Assessment Framework
Iniciativa de INTEL para verificar la seguridad del FW
https://github.com/chipsec
Como tarea programada en WINDOWS, o arranque desde USB
https://github.com/chipsechttps://github.com/chipsec -
7/25/2019 Todod Sobre Uefi
27/35
VIII JORNADAS STIC CCN-CERT
CONCLUSIONES I
La seguridad tradicional todava no ha puesto el foco en UEFI Un montn de cdigo se ejecuta antes de que el S.O. tome el control
Este cdigo tiene capacidad casi ilimitada sobre la plataforma hasta que secede el control al S.O. Despus casi NULA.
La Integridad de los mdulos en UEFI es a da de hoy un punto clave.
Control de las claves PK, KEK,
Control e inventario de los mdulos instalados.
Si puedes grabar la NVRAM va HW o SW
Si adems estn las claves PK, KEK, -> GAME OVER.
Solo con el abuso de las propias caractersticas de la plataformapuede ser suficiente.
Las carencias detectadas estn en la implementacin, no en laespecificacin
La complejidad de las plataformas y mdulos adicionales
Los diferentes mdulos que se arrancan en funcin del tipo de arranque(hibernacin, suspensin, FastBoot ..) hacen mayor la superficie de ataque
-
7/25/2019 Todod Sobre Uefi
28/35
VIII JORNADAS STIC CCN-CERT
CONCLUSIONES II
Ya existen POCs de exploits sobre cdigo UEFI en el proceso deupdate.
La utilizacin de herramientas como COPERNICUS debe ayudar a
gestionar la seguridad UEFI de un parque informtico.
La utilizacin del TPM para el almacenamiento de las claves ayudar a
mejorar notablemente la implementacin de SecureBoot. En el futuro inmediato es de esperar ver aplicaciones y drivers EFI
implementando servicios de seguridad.
Ya existen ataques viables. Su complejidad apunta a su utilizacin en
objetivos escogidos. Ojo a insiders.
-
7/25/2019 Todod Sobre Uefi
29/35
VIII JORNADAS STIC CCN-CERT
UEFI UN ARMA DE DOBLE FILO
-
7/25/2019 Todod Sobre Uefi
30/35
VIII JORNADAS STIC CCN-CERT
DEMO explicada
-
7/25/2019 Todod Sobre Uefi
31/35
VIII JORNADAS STIC CCN-CERT
Referencias (1)
UEFI SPECS
www.uefi.org
BEYOND BIOS: Developing with the Unified Extensible Firmware
Interface
Vincent Zimmer et al
SAFERBYTES IT SECURITY
http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-
windows-8-bootkit/
CANSECWEST 2014
Platform Firmware Security Assessment wCHIPSEC-csw14-final.pdfMICROSOFT TECHNET
http://technet.microsoft.com/en-us/library/hh824898.aspx
http://www.uefi.org/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://technet.microsoft.com/en-us/library/hh824898.aspxhttp://technet.microsoft.com/en-us/library/hh824898.aspxhttp://technet.microsoft.com/en-us/library/hh824898.aspxhttp://technet.microsoft.com/en-us/library/hh824898.aspxhttp://technet.microsoft.com/en-us/library/hh824898.aspxhttp://technet.microsoft.com/en-us/library/hh824898.aspxhttp://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://news.saferbytes.it/analisi/2012/09/uefi-technology-say-hello-to-the-windows-8-bootkit/http://www.uefi.org/ -
7/25/2019 Todod Sobre Uefi
32/35
VIII JORNADAS STIC CCN-CERT
Referencias (2)
[1] Attacking Intel BIOS Alexander Tereshkin & Rafal Wojtczuk Jul. 2009
http://invisiblethingslab.com/resources/bh09usa/Attacking%20Intel%20BIOS.pdf
[2] TPM PC Client Specification - Feb. 2013
http://www.trustedcomputinggroup.org/developers/pc_client/specifications/
[3] Evil Maid Just Got Angrier: Why Full-Disk Encryption With TPM is Insecure on Many
Systems Yuriy Bulygin Mar. 2013
http://cansecwest.com/slides/2013/Evil%20Maid%20Just%20Got%20Angrier.pdf
[4] A Tale of One Software Bypass of Windows 8 Secure Boot Yuriy Bulygin Jul. 2013
http://blackhat.com/us-13/briefings.html#Bulygin
[5] Attacking Intel Trusted Execution Technology - Rafal Wojtczuk and Joanna Rutkowska
http://invisiblethingslab.com/resources/bh09dc/Attacking%20Intel%20TXT%20-%20paper.pdf
[6] Another Way to Circumvent Intel Trusted Execution Technology - Rafal Wojtczuk,
Joanna Rutkowska, and Alexander Tereshkin Dec. 2009 http://invisiblethingslab.com/resources/misc09/Another%20TXT%20Attack.pdf
[7] Exploring new lands on Intel CPUs (SINIT code execution hijacking) - Rafal Wojtczuk and Joanna Rutkowska
Dec. 2011
http://www.invisiblethingslab.com/resources/2011/Attacking_Intel_TXT_via_SINIT_hijacking.pdf
-
7/25/2019 Todod Sobre Uefi
33/35
VIII JORNADAS STIC CCN-CERT
Referencias (3)
[8] Implementing and Detecting an ACPI BIOS Rootkit Heasman, Feb. 2006 http://www.blackhat.com/presentations/bh-europe-06/bh-eu-06-Heasman.pdf
[9] Implementing and Detecting a PCI Rookit Heasman, Feb. 2007
http://www.blackhat.com/presentations/bh-dc-07/Heasman/Paper/bh-dc-07-Heasman-
WP.pdf
[10] Using CPU System Management Mode to Circumvent Operating System Security
Functions - Duflot et al., Mar. 2006
http://www.ssi.gouv.fr/archive/fr/sciences/fichiers/lti/cansecwest2006-duflotpaper.pdf
[11] Getting into the SMRAM:SMM Reloaded Duflot et. Al, Mar. 2009
http://cansecwest.com/csw09/csw09-duflot.pdf
[12] Attacking SMM Memory via Intel CPU Cache Poisoning Wojtczuk &
Rutkowska, Mar. 2009 http://invisiblethingslab.com/resources/misc09/smm_cache_fun.pdf
[13] Defeating Signed BIOS Enforcement Kallenberg et al., Sept. 2013
http://www.syscan.org/index.php/download/get/6e597f6067493dd581eed737146f3afb
/SyScan2014_CoreyKallenberg_SetupforFailureDefeatingSecureBoot.zip
-
7/25/2019 Todod Sobre Uefi
34/35
VIII JORNADAS STIC CCN-CERT
Referencias (4)
[14] Mebromi: The first BIOS rootkit in the wild Giuliani, Sept. 2011 http://www.webroot.com/blog/2011/09/13/mebromi-the-first-bios-rootkitin-the-wild/
[15] Persistent BIOS Infection Sacco & Ortega, Mar. 2009
http://cansecwest.com/csw09/csw09-sacco-ortega.pdf
[16] Deactivate the Rootkit Ortega & Sacco, Jul. 2009
http://www.blackhat.com/presentations/bh-usa-09/ORTEGA/BHUSA09-Ortega-
DeactivateRootkit-PAPER.pdf
-
7/25/2019 Todod Sobre Uefi
35/35
Sguenos en Linked in
E-Mails
[email protected]@cni.es
Websites
www.ccn.cni.es
www.ccn-cert.cni.es
www.oc.ccn.cni.es