Download - Virtually Pwned: Hacking VMware [ITA - SMAU10]

Transcript
Page 1: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Virtually PwnedHacking VMware

Claudio Criscione@paradoxengine – [email protected]

Page 2: Virtually Pwned: Hacking VMware [ITA - SMAU10]

/me

Claudio Criscione

Page 3: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Il contesto

Page 4: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Violare la virtualizzazione significa...

…hacking “al di sotto”

…accedere direttamente ai sistemi

…aggirare controlli di permessi o network-level

…colpire più “bersagli” contemporaneamente

Il tutto, probabilmente su sistemi non aggiornati e su un ristretto numero di soluzioni

Parliamo del 96% delle Fortune 1000 ** http://www.vmware.com/company/customers/

Page 5: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Quindi?

E' un problema interessante

Esistono veramente degli attacchi

Quali sono e come ci si difende

?

!

?

Page 6: Virtually Pwned: Hacking VMware [ITA - SMAU10]

L'elefante nel salotto

Page 7: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Fuga dalla Virtual Machine

• Si, si può fare

• Si, realizzarla nei fatti spesso è difficile

• Si, succederà ancora

• No, non è direttamente inclusa nel perimetro di un audit. Presuppone violazione!

• Ci occuperemo della INFRASTRUTTURA

Page 8: Virtually Pwned: Hacking VMware [ITA - SMAU10]

StrumentiDel Mestiere

Page 9: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Nemmeno uno...

Page 10: Virtually Pwned: Hacking VMware [ITA - SMAU10]

VASTO

Virtualization ASsessment TOolkit

E' un “exploit pack” per Metasploit specializzato nella sicurezza della Virtualizzazione e del Cloud.

La beta 0.4 è in corso di pubblicazione. La 0.3 è già su vasto.nibblesec.org

Tnx to Luca Carettoni, Paolo Canaletti, drk1wi per l'aiuto.

Page 11: Virtually Pwned: Hacking VMware [ITA - SMAU10]

VMware.zip

Prodotti Desktop: Workstation, Player. Non direttamente interessanti, per questo talk

Prodotti Server: ESX, ESXi (ora Hypervisor), VMware Server

Nodi di management: Virtual Center (vCenter)

Client: software Windows & iPad

Page 12: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Il Piano

Page 13: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Adoro i piani ben riusciti

Con gli occhi del nemico...

1 – Ricognizione

2 – Attacco

3 – Difesa

Page 14: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Ricognizione

Page 15: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Locale – questa è una VM?Facile – Verifichiamo il MAC, i processi

Non così facile – accesso all'hardware (CPU, RAM)

Remoto – trova la virtualizzazione...Identifichiamo i servizi di rete

Utile per scoprire virtualizzazione “nascosta”

Come e dove

Page 16: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_version

Usa una API SOAP ad-hoc, disponibile nella maggior parte dei prodotti VMware

Utilizza le principale funzionalità degli scanner Metasploit, quindi funziona su range di IP, si interfaccia con i database e così via...

[…]

<RetrieveServiceContent xmlns=\"urn:internalvim25\"> <_this type=\"ServiceInstance\">

ServiceInstance</_this>

</RetrieveServiceContent>

[…]

Page 17: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Un attacco a strati

Page 18: Virtually Pwned: Hacking VMware [ITA - SMAU10]
Page 19: Virtually Pwned: Hacking VMware [ITA - SMAU10]
Page 20: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Attacco al client

Take the admin, take the world

Page 21: Virtually Pwned: Hacking VMware [ITA - SMAU10]

VI Client Auto Update

Page 22: Virtually Pwned: Hacking VMware [ITA - SMAU10]

clients.xml

<ConfigRoot>

<clientConnection id="0000">

<authdPort>902</authdPort>

<version>3</version>

<patchVersion>3.0.0</patchVersion>

<apiVersion>3.1.0</apiVersion>

<downloadUrl>https://*/client/VMware-viclient.exe</downloadUrl>

</clientConnection>

</ConfigRoot>

Page 23: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_vilurker

Questo modulo consente di ottenere user-assisted code execution a partire da una situazione di Man In The Middle.

Praticamente nessuno usa certificati trusted.

Niente code signing.

Page 24: Virtually Pwned: Hacking VMware [ITA - SMAU10]
Page 25: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Al bersaglio

Page 26: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_guest_stealer

CVE-2009-3733

Questo path traversal è stato scoperto e reso pubblico da Flick e Morehouse alla fine dello scorso anno. L'exploit è stato integrato in VASTO.

Può essere usato per recuperare qualsiasi file come root, ivi incluse macchine virtuali. Funziona su ESX, ESXi, Server non aggiornati.

Page 27: Virtually Pwned: Hacking VMware [ITA - SMAU10]
Page 28: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_updatemanager_traversal

JETTY-1004

VMware Update Manager utilizza Jetty 6.1.16

Normalmente installato sul sistema vCenter

Jetty 6.1.16 è vulnerabile ad un path traversal

Ecco la magia:

/vci/downloads/health.xml/%3F/../../../../../../../../../$FILE

Page 29: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Ok, possiamo leggere qualsiasi file come System.

E allora?

Seguitemi...

Page 30: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Mr Vpxd-profiler-*, suppongo

File di “debug” prodotto da vCenter.

Indovina cosa c'è dentro...

/SessionStats/SessionPool/Session/Id='06B90BCB-A0A4-4B9C-B680-FB72656A1DCB'/Username=‘FakeDomain\FakeUser'/SoapSession/Id='AD45B176-63F3-4421-BBF0-FE1603E543F4'/Count/total 1

Page 31: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Dove mettiamo questo SOAP ID?

Page 32: Virtually Pwned: Hacking VMware [ITA - SMAU10]

La soluzione

Page 33: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_session_rider

Usare la sessione non è semplicissimo: timeout, chiamate sequenziali e dipendenti.

Il modulo agisce da proxy simulando la sessione di un altro utente.

Consente di effettuare un finto login per ingannare il vSphere client.

Session_rider + traversal = vmware_autopwn

Page 34: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Bonus!

Accesso in sola lettura al server vCenter = controllo del sistema!

Page 35: Virtually Pwned: Hacking VMware [ITA - SMAU10]
Page 36: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Una solida interfaccia

Web & Complessa

XSS vari

URL Forwarding

BONUS: La keyword di shutdown non è stata modificata: shutdown di Tomcat (locale)

Page 37: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_webaccess_portscan

CVE-2010-0686

“URL Forwarding” in realtà significa POST arbitrari su sistemi remoti.

Possiamo usare l'interfaccia web di VMware come “proxy” verso altri sistemi web, o per effettuare portscan!

Page 38: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Attacco al backend

vCenter si collega ai server ESX via SSL [SOAP]

Normalmente, i certificati non sono “trusted”

Vediamolo in un bellissimo* grafico

SSL [Cert1] vCenter

SSL [CertA]

SSL [CertB]

*Diagram powered by ORACLE's Open OfficeSarà sicuramente più bello con LibreOffice

ESXb

ESXa

Page 39: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Backend blues

MITM vCenter – ESX = Connessione interrotta

Alla riconnessione, il vCenter verificherà, fallendo, il certificato.

SSL MITM L'amministratore ha un warning “standard”

L'amministratore accessa bye bye password

Page 40: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Se nulla ha funzionato...

Page 41: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_login

Puoi sempre fare bruteforce!

Il modulo vmware_login lavora sullo standard metasploit.

Local Administrator, root: no lockout (by default)

Bruteforce efficace.

Page 42: Virtually Pwned: Hacking VMware [ITA - SMAU10]
Page 43: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Che altro?

Numerosi vettori per escalation of privileges.

Saranno inclusi in VASTO in futuro

Spesso a bassissimo livello: I/O Ports, PCI ports...

Che altro?

Page 44: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Nuove frontiere dell'attacco

Paravirtualization e software di supporto

Page 45: Virtually Pwned: Hacking VMware [ITA - SMAU10]

vmware_sfcb_exec

CVE-2010-2667

Una vulnerabilità nella Virtual Appliance Management Infrastructure che consente di eseguire codice come root.

Richiede autenticazione, OPPURE può essere eseguita localmente.

Page 46: Virtually Pwned: Hacking VMware [ITA - SMAU10]

L'attacco

<?xml version="1.0" encoding="UTF-8"?><CIM CIMVERSION="2.0" DTDVERSION="2.0“><MESSAGE ID="13" PROTOCOLVERSION="1.0“><SIMPLEREQ><METHODCALL NAME="SetServerName“><LOCALCLASSPATH> <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"/><NAMESPACE NAME="cimv2"/> </LOCALNAMESPACEPATH> <CLASSNAME NAME="VAMI_NetworkSetting"/> </LOCALCLASSPATH>

<PARAMVALUE NAME="HostName" PARAMTYPE="string“><VALUE>121;$(echo${IFS}ls${IFS}-l)>/tmp/echo</VALUE>

</PARAMVALUE></METHODCALL></SIMPLEREQ></MESSAGE></CIM>

Page 47: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Can we attack virtualization?

Page 48: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Riassumendo

Possiamo attaccare il client via sniff della password o controllare il sistema dell'admin.

Possiamo aggredire l'hypervisor ed i suoi componenti core (via path traversal)

Possiamo prendere il controllo delle sessioni degli altri utenti.

Possiamo aggredire l'interfaccia web.

Possiamo sfruttare vulnerabilità nei servizi di supporto.

C'è decisamente un problema!

Page 49: Virtually Pwned: Hacking VMware [ITA - SMAU10]

Domande

Page 50: Virtually Pwned: Hacking VMware [ITA - SMAU10]

E ora?

Riconsiderate la strategia di virtualizzazione sicura

Keep on hacking!

Claudio Criscione

Twitter - @paradoxengine

Email - [email protected]

Blog & Download - vasto.nibblesec.org

Work & Virtualization PenTest – securenetwork.it