de ipmi - cybercamp.es

Post on 09-Jan-2022

9 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

La

de IPMIInsoportable levedad

Bienvenido

delAL MUNDO

Hardware INFINITO

IMMUNITY Argentina

Nico Waisman

VP de LATAM Immunity, Inc

InvestigadorCon un cierto amor por la

HEAP

Quien Soy?

@nicowaisman

IPMI

IntelligenceI

P

M

I

Platform

Managment

Interface

I P

M I

Independencia del Sistema OperativoManejo RemotoMonitoreo:

TemperaturaVoltajeVentiladores

I P

M I

Full Network StackKVMConsola SerialPower Managment

(O un Backdoor)

Mientras tu

este enchufadoSERVER

TU IPMI ESTA CORRIENDO

El Placerde

AuditarIPMI

Necesitamos explotarlo remotamente

27

PRE AUTENTICACION

NEC v850HP ILO 2

ThreadX

ARMHP ILO 4

GHS INTEGRITY

SUPER HIMM/IDRAC

LINUX

ARM

SUPERMICRO

LINUX

Cada ciclo de CPU que desperdicias no fuzzeando, dios mata un gatito

32

FUZZEAR

Se encuentran Perlas

33

LEER DOCUMENTACION

Y TODO LO QUE APRENDAS, AL FUZZER!

34

AUDITA

Attack Surface

SMASH

UDP/161,162

SNMP

TCP/22

HTTPS IPMI OTROS

TCP/80,443 UDP/623 Standalone WSMAN

KVM

VNC

SMASH

Línea de Comando estandarizada por DTMFCorre sobre SSHLa mayoría de los potenciales ataques, son post autenticación

SMASH

SMASH

HABILITA UNA CONSOLA REMOTA! :DTEXTCONS

SMASH

https://blog.rapid7.com/2013/07/02/a-penetration-testers-guide-to-ipmi/

SNMP

Protocolo para organización y recolección de informaciónProtocolo Stateless“Autentica” con una community string

SNMP

HP ILO2

HP ILO4

DELL IDRAC

LENOVO IMMv2

3/4 IPMI

como suUTILIZABAN “PUBLIC”

Community string

SNMP

$ snmpwalk -v1 -c public 192.168.1.21

SNMP

$ snmpwalk -v1 -c public -m "./immalert.mib" 192.168.1.129

SNMP

HTTPS

Uno de los target más interesantesPreferido por sysadmin y firewalls, abierto por default

Mayoria utiliza appwebSin embargo, algunos decidieron implementar su propio server

HTTPS

Fabien Perigaud from synacktiv

HTTPS

sscanf(heap_buf, “%*s %s”, httpbuffer);

Triggeable con HTTP Header...

Connection: AAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

HTTPSint main ( void ) { char name [128] , pwd [24]; char * temp ; // ... initialize ... temp = cgiGetVariable (" name "); strcpy ( name , temp ); temp = cgiGetVariable (" pwd "); strcpy ( pwd , temp ); // ... validate user ... }

SuperMicro/login.cgi

https://jhalderm.com/pub/papers/ipmi-woot13.pdf

HTTPS

(Solo en HP ILO)

URL/cgi-bin/discover(Solo en iDRAC)

URL/xmldata?item=all

HTTPS

Nos abre también la superficie de ataque para otros protocolos:

WS-MAN

Redfish

RIBCL

HTTPS

REDFish es una API RESTful creada por DTMF y soportado por muchos IPMI

Utiliza JSON para comunicarse

Los endpoints se encuentran en /redfish/v1/

HTTPS

HTTPS

RIBCL permite escribir scripts de XML para configurar el server, monitorear el estado, etcUtiliza el endpoint /RIBCL que se accede sin autenticarEl XML mismo se encarga de la autenticacion

HTTPS

Administradores no suelen crear sus propios XML, utilizan…

CPQLOCFG Se conecta con el endpoint

HPONCFG Crea un XML local

HTTPS

<RIBCL VERSION="2.0">

<LOGIN USER_LOGIN="ADMIN" PASSWORD="ADMIN">

<SERVER_INFO MODE="write">

<SET_HOST_POWER HOST_POWER="No"/>

</SERVER_INFO>

</LOGIN>

</RIBCL>

Apaga el equipo

HTTPS

Utilizan algún tipo de analizador léxico sólido Invertimos unos ciclos de radamsa pero desistimos por un mejor target

HTTPS

radamsa validcases/* -o testcases/case%n -n 10000

radamsa es siempre el primer paso

De ejemplo válidos a casos de fuzzeo en 2 minutos

Incluye una variedad de permutadores para fuzzear

HTTPS

<RIBCL VERSION="2.0"><LOGIN><RIBCL VERSION="2.0"><RIBCL VERSION="2.0">

<LOGIN USER_LOGIN="admin" PASSWORD="ADMIN">

<RIB_INFO MODE="write">

</RIB_INFO>

</LOGIN>

</RIBCL></LOGIN>

</RIBCL></LOGIN>

WSMAN

Web Service ManagementMicrosoft provee soporte nativo (Win-RM)Sintaxis similar a XML, pero con pequeñas variantes (basado en SOAP)Bastante utilizado por su soporte en powershell

WSMAN

No está atado a una capa de transporte Generalmente sobre HTTP/HTTPS bajo el endpoint /wsman

Pero puede correr standalone en tcp/5985

WSMAN

Al correr sobre protocolo con estado, es más confiable que SNMP/IPMI

Autentica: Basic Auth, Digest-Auth, Kerberos

Por razones

algunos IPMIINEXPLICABLES

Permiten acceder aL parsersin autenticar

WSMAN

SuperMicro usa la version 2.1.0Vulnerable a mas de un OverflowPrepárense para un viaje a los 90

WSMAN

WSMAN

WSMAN

Pero otros IPMI utilizan versiones más nuevas...

WSMAN

Los IPMI tienen un protocolo que se llama IPMI UDP/623Serie de interfaces que permiten hacer todo lo que la interfaz provee

IPMI

Incluyendo una Consola Serial por UDP...

2013 la revista ITWorld lo llamó el protocolo más peligroso del mundo

IPMI

Puramente sobre UDP, utiliza un SessionID y Secuence Number para mantener un mínimo estado

En una red interna (o no tanto)

71

IDENTIFICANDO IPMI

IPMI

Get Channel Authentication Capabilities Get Channel Authentication

Capabilities

IPMI v2.0 / RCMP+

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

00 00 00 00 00 00 00 00 00

Request: <<Get Channel Authentication Capabilities>>

IPMI

06 00 FF 07

Request: <<Get Channel Authentication Capabilities>>

Version

IPMI

06 00 FF 07

Request: <<Get Channel Authentication Capabilities>>

Tipo: RCMP/ASF

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

Request: <<Get Channel Authentication Capabilities>>

Autenticacion

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

Request: <<Get Channel Authentication Capabilities>>

Nro Secuencia{

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

Request: <<Get Channel Authentication Capabilities>>

SESION

{

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

Request: <<Get Channel Authentication Capabilities>>

Length

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

20 18 c8 81 00 38 8E 04 B5

Request: <<Get Channel Authentication Capabilities>>

COMANDO

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 09

20 18 c8 81 00 38 8E 04 B5

Request: <<Get Channel Authentication Capabilities>>

PRIVILEGIOS REQUERIDOS

IPMI

06 00 FF 07

00 00 00 00 00 00 00 00 00 10

81 1C 63 20 00 38 00 02 80

Response: <<Get Channel Authentication Capabilities>>

00 00 10

14 02 00 00

CompatibilidadMD5, MD2, PlainTXT, NoAuth, Null User, Version IPMI

Indica la versión de IPMI (v2.0/v1.5), soporte OEMTipos de autenticación:

Sin Autenticación

IPMI

MD2MD5IPMI v2.0

USUARIO NULL

ipmitool -I lanplus -C0 -H IP-U root -P calvin SDR

IPMI

Sin Autenticación

* Parte del gran trabajo de Dan Farmer!

IPMI

Open Session RequestOpen Session Response

IPMI v2.0 / RCMP+

Local Session IDRemote Session ID

IPMI

Open Session RequestOpen Session Response

IPMI v2.0 / RCMP+

RAKP MSG #1RAKP MSG #2

UserNameLOCAL RANDOM VALUE GUID

SERVER RANDOM VALUEHASHED PASSWORD

IPMI

Open Session RequestOpen Session Response

IPMI v2.0 / RCMP+

RAKP MSG #1

RAKP MSG #3

RAKP MSG #2

RAKP MSG #4Authentication CODE

IPMI

Open Session RequestOpen Session Response

IPMI v2.0 / RCMP+

RAKP MSG #1RAKP MSG #2

UserNameLOCAL RANDOM VALUE GUID

SERVER RANDOM VALUEHASHED PASSWORD

Hash con RKAP-HMAC-SHA1Con el SALT

IPMI

HMAC( LocalSession ID, RemoteSession ID, Local Random Bytes, Remote Random Bytes, Remote GUID, Username)

* Parte del gran trabajo de Dan Farmer!

IPMI

$ python dump_RAKP.py 10.10.0.3Found: 10.10.0.3 admin:$rakp$54414378432c5a416a7368a6b17c8288471355413cd1659b792400002f570000b85f0000f63a000036353430383155534533333845584236140561646d696e$6668a4a555989a3831e901ab85087a885b9bb91fFound: 10.10.0.3 ADMIN:$rakp$544143787366cf39332ceb225659e645390b66a8776af6751658000082470000f60400000820000036353430383155534533333845584236140541444d494e$74487c1803039a45c20e085284a10bda38c75b79

Se puede crackear con john o hashcat

IPMI

https://medium.com/@iraklis/running-hashcat-v4-0-0-in-amazons-aws-new-p3-16xlarge-instance-e8fab4541e9b

$24.48 por hora en un AWS

DELL iDrac cometieron un error al no hacer los SessionID randomUtilizaba un formato con la mitad de los caracteres fijo 0x0200XXYY

IPMI

* https://labs.mwrinfosecurity.com/blog/cve-2014-8272/

Como resultado, se podían predecir e inyectar comandos

KVM

Escucha en el puerto TCP/17990Utilizado por Java Applet dentro de laInterfaz webTODO

In the WILD!

O COMO MOVERSE CON IMPUNIDAD POR LAS DMZ103

MOVIMIENTO TRANSVERSAL

#1 Hackeando al sysadmin

#2 Hackeando un IPMI

#3 desde internet hackeando server

I P

M I

Una vez hackeado el IPMI, podemos acceder al server?

Si! De muchas formas!Consola Serial

Montar un DVD remotamente

KVM (Vnc, protocolo propio, etc)

#2 Hackeando un IPMI

I P

M I

Una vez hackeado el server... podemos acceder al IPMI?

Si! De muchas formas!Driver del sistema operativo permite crear usuarios

Driver permite flashear firmware

I P

M I

root@xdev:~# ./CP018561.scexe

FLASH_iLO3 v1.09 for Linux (Jan 23 2013)(C) Copyright 2002-2013 Hewlett-Packard Development Company, L.P.Firmware image: ilo3_155.binCurrent iLO 3 firmware version 1.26; Serial number ILOUSE116ND7G

Component XML file: CP018561.xmlCP018561.xml reports firmware version 1.55This operation will update the firmware on theiLO 3 in this server with version 1.55.Continue (y/N)?yCurrent firmware is 1.26 (Aug 26 2011 )Firmware image is 0x801664(8394340) bytesCommitting to flash part...******** DO NOT INTERRUPT! ********Flashing completed.Attempting to reset device. Succeeded.***** iLO 3 reboot in progress (may take up to 60 seconds.)***** Please ignore console messages, if any.iLO 3 reboot completed.root@xdev:~#

#3 desde internet hackeando server

Queda

porMuchisimo

ANALIZAR

I P

M I

Varios protocolos pendientes y propietarios

Desarrollar exploits de bugs encontrados Remoto

Alternativas para movimiento transversal

Herramientas para manejo masivo de server

Escalada de privilegio

O COMO MOVERSE CON IMPUNIDAD POR LAS DMZ117

CUIDADO!!

Preguntas?@nicowaisman

Nunca es uno, sino un equipoGracias

MatiasOren, rod, ivan, juan

@nicowaisman

top related