Inteligencia Artificial y Machine Learning en la investigación de campañas APT

Post on 12-May-2015

236 views 0 download

Tags:

description

Vicente Díaz. Malware Senior Analyst. Kaspersky Lab Curso de Verano "Innovación Disruptiva en tecnologías de seguridad". Campus Vicálvaro de la URJC. Summer Course "Disruptive innovation in security technologies". URJC's Vicálvaro Campus.

Transcript of Inteligencia Artificial y Machine Learning en la investigación de campañas APT

IA en investigación de campañas APT

Vicente Díaz, Principal Security Analyst, Kaspersky Lab

[Introducción]

¿Qué es una campaña APT?

!   APT: Advanced Persistent Thread

The Careto / MASK apt

4

!   The Mask is an advanced threat actor that has been involved in cyber-espionage operations since at least 2007

!   What makes The Mask special is the complexity of the toolset used by the attackers. This includes an extremely sophisticated piece of malware, a rootkit, a bootkit, Mac OS X and Linux versions and possibly versions for Android and iPad/iPhone (iOS)

!   The name "Mask" comes from the Spanish slang word "Careto" ("Mask" or "Ugly Face") that the authors included in some of the malware modules.

The Careto / MASK apt

5

!   The Mask is an advanced threat actor that has been involved in cyber-espionage operations since at least 2007

!   What makes The Mask special is the complexity of the toolset used by the attackers. This includes an extremely sophisticated piece of malware, a rootkit, a bootkit, Mac OS X and Linux versions and possibly versions for Android and iPad/iPhone (iOS)

!   The name "Mask" comes from the Spanish slang word "Careto" ("Mask" or "Ugly Face") that the authors included in some of the malware modules.

The Careto / MASK apt

6

!   Based on an identification algorithm we developed, we counted over 380 unique victims between over 1000+ IPs

The main targets of Careto fall into the following categories:

•  Government institutions

•  Diplomatic offices and embassies

•  Energy, oil and gas companies

•  Research institutions

•  Private equity firms

•  Activists

The Careto / MASK apt

7

!   Based on an identification algorithm we developed, we counted over 380 unique victims between over 1000+ IPs

The main targets of Careto fall into the following categories:

•  Government institutions

•  Diplomatic offices and embassies

•  Energy, oil and gas companies

•  Research institutions

•  Private equity firms

•  Activists

¿Qué es la IA?

!   AI, a modern approach (http://aima.cs.berkeley.edu/)

!   http://www.slideshare.net/vicenteDiaz_KL/birds-bots-and-machines-fraud-in-twitter-and-machine-learning

¿Qué es la IA?

!   AI, a modern approach (http://aima.cs.berkeley.edu/)

!   http://www.slideshare.net/vicenteDiaz_KL/birds-bots-and-machines-fraud-in-twitter-and-machine-learning

¿IA en APTs?

!   ¿Qué temas de IA son los interesantes para investigar una campaña APT?

!   Data mining

!   Clustering

!   Machine learning

! Sistemas expertos

[Investigar una campaña]

Inicio

! Pista, dominio, técnica, víctima, etc

!   En esta etapa identificamos y recolectamos el máximo de elementos

!   Los binarios son la fuente de información principal en esta etapa

Binarios

! Cómo buscar qué binarios están relacionados (de una colección)

! Funciones de distancia

!   Clustering y Aprendizaje automático

¿Funciones de distancia?

! Podemos buscar un patrón directamente en el código:

!   Strings o secuencias de bytes

! Yara (http://plusvic.github.io/yara/)

! Metadatos (ej. Hot Brazilian)

Ejemplo de Yara

! rule AndroidPoliceRansomFinder2

!   {

!   strings:

!   $firma = { 30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00 30 81 89 02 81 81 00 8B A5 F7 D0 76 08 A6 DE 2F 22 1F }

!   condition:

!   $firma

!   }

Ejemplo de Yara

! rule AndroidPoliceRansomFinder2

!   {

!   strings:

!   $firma = { 30 81 9F 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00 03 81 8D 00 30 81 89 02 81 81 00 8B A5 F7 D0 76 08 A6 DE 2F 22 1F }

!   condition:

!   $firma

!   }

Búsqueda de patrones vs función de distancia

Búsqueda de patrones vs función de distancia

Comparando binarios

#include<stdio.h>

main(){ printf("Hello World"); }

>gcc helloworld.c -o 1

>gcc –O2 helloworld.c –o 2

>md5sum 1 8b64ea08254c85e69d65ee7294431e0a

>md5sum 2 c1e3154be1d1a20973d08cd28cff5fea

Comparando binarios – mínimo nivel de abstracción

!   Un binario es una secuencia de bytes

!   N-grams

! Histogramas distribución de bytes - adivina tipo de fichero aunque sólo sea con una muestra parcial con 90% de precisión

[Zhang, Like, and Gregory B. White. “An approach to detect executable content for anomaly based network intrusion detection”]

SSdeep

!   “ssdeep is a program for computing context triggered piecewise hashes (CTPH). Also called fuzzy hashes, CTPH can match inputs that have homologies. Such inputs have sequences of identical bytes in the same order, although bytes in between these sequences may be different in both content and length.”

[http://dfrws.org/2006/proceedings/12-Kornblum.pdf]

Parsear binarios – niveles superiores de abstracción

! Métodos de parseo limitados: seguir el control flow de un binario no es sencillo.

!   Los mejores desensambladores utilizan hipótesis que pueden hacer fracasar el resultado rotundamente: hay muchos problemas, distintas representaciones en bytes para la misma representación en ASM, etc.

! Una aproximación es comparar los grafos resultantes del control flow de los binarios (bindiff) [http://static.googleusercontent.com/external_content/untrusted_dlcp/www.zynamics.com/en//downloads/bindiffsstic05-1.pdf]

Parsear binarios – niveles superiores de abstracción

! Métodos de parseo limitados: seguir el control flow de un binario no es sencillo.

!   Los mejores desensambladores utilizan hipótesis que pueden hacer fracasar el resultado rotundamente: hay muchos problemas, distintas representaciones en bytes para la misma representación en ASM, etc.

! Una aproximación es comparar los grafos resultantes del control flow de los binarios (bindiff) [http://static.googleusercontent.com/external_content/untrusted_dlcp/www.zynamics.com/en//downloads/bindiffsstic05-1.pdf]

!   File Name: Hot XXX.ex_

!   File Size: 4981296 byte

!   Compile Time: 2008-08-16 22:26:10

!   DLL: False

!   Sections: 5

!   Packer: Nullsoft PiMP Stub -> SFX

!   FILE: KERNEL32.dll

!   FILE: USER32.dll

!   FILE: GDI32.dll

!   FILE: SHELL32.dll

!   FILE: ADVAPI32.dll

!   FILE: COMCTL32.dll

!   FILE: ole32.dll

!   FILE: VERSION.dll

!   File Name: Hot XXX.ex_

!   File Size: 4981296 byte

!   Compile Time: 2008-08-16 22:26:10

!   DLL: False

!   Sections: 5

!   Packer: Nullsoft PiMP Stub -> SFX

!   FILE: KERNEL32.dll

!   FILE: USER32.dll

!   FILE: GDI32.dll

!   FILE: SHELL32.dll

!   FILE: ADVAPI32.dll

!   FILE: COMCTL32.dll

!   FILE: ole32.dll

!   FILE: VERSION.dll

ImpHash

!   “ An imphash is a powerful way to identify related malware because the value itself should be relatively unique. This is because the compiler’s linker generates and builds the Import Address Table (IAT) based on the specific order of functions within the source file.”

[https://www.mandiant.com/blog/tracking-malware-import-hashing/]

Análisis dinámico

! Conexiones de red

! Acceso/creación de ficheros

! Acceso/creación de entradas de registro

! Contenido de memoria

!   …

!   No siempre es posible: anti-debug, anti VM, etc

! Pero cuando lo es, suele ser el factor decisorio

¿Cómo hacer una buena función de distancia?

! Problemas habituales: ! Necesidad de conocimiento experto!

!   Feature selection !   Curse of dimensionality

! Overfitting

!   ¿Hasta qué punto tiene que ser un sistema “genérico”?

!   Clustering vs Machine Learning

[http://www.hexacorn.com/blog/2013/03/04/clustering-and-batch-analysis/]

Limitaciones del “mundo real”

! Uso de RATs genéricos, por ejemplo

!   TTPs (Techniques, Tactics and Procedures)

!   Profiling de grupos

Limitaciones del “mundo real”

! Uso de RATs genéricos, por ejemplo

!   TTPs (Techniques, Tactics and Procedures)

!   Profiling de grupos

Ejemplo: APT1 de Mandiant

!   [http://intelreport.mandiant.com/Mandiant_APT1_Report.pdf]

¿Qué más tenemos?

! Comunicación (la más interesante la no estándard)

! Dominios (y datos de registro)

! Servidores (Command and Control)

! Otros recursos web utilizados en la campaña

Whois – normalmente información falsa

!   https://whois.domaintools.com/

! whoisology.com

! También es posible obtener la base de datos de whois para algunos TLD

0

5

10

15

20

25

30

Datos de sinkhole

Big data

! Datos normalizados vs no normalizados

! Infraestructura necesaria

!   Elastic search

Cruzar datos

! Hacen falta herramientas: desde cómo representar los datos (XMIND, CMAP), hasta algo más avanzado/colaborativo: Maltego, CIF, MISP

Cruzar datos

! Hacen falta herramientas: desde cómo representar los datos (XMIND, CMAP), hasta algo más avanzado/colaborativo: Maltego, CIF, MISP

Cruzar datos

! Hacen falta herramientas: desde cómo representar los datos (XMIND, CMAP), hasta algo más avanzado/colaborativo: Maltego, CIF, MISP

Cruzar datos

! Hacen falta herramientas: desde cómo representar los datos (XMIND, CMAP), hasta algo más avanzado/colaborativo: Maltego, CIF, MISP

Frameworks avanzados

!   A Brief Introduction to Graphical Models and Bayesian Networks

[http://www.cs.ubc.ca/~murphyk/Bayes/bnintro.html]

[Conclusiones]

[Gracias]

Vicente Díaz, Principal Security Analyst, Kaspersky Lab @trompi