Forensics Blog

Casos Forenses

Análisis y comentarios de casos reales.

Malware

Reversing, QuickScan, Análisis dinámico y estático.

Cybercrimen Digital

Actividades delictivas realizadas con la ayuda de herramientas informáticas.

Análisis forense dispositivos móviles

Se involucran la identificación, preservación, obtención, documentación y análisis de información de dispositivos móviles.

iT Forensics, Hacking, Crimen digital

Enfoque en artículos y documentación relacionada a cibercrimen.

Posts recientes

Mostrando entradas con la etiqueta Herramientas. Mostrar todas las entradas
Mostrando entradas con la etiqueta Herramientas. Mostrar todas las entradas

9 feb 2015

Distintas herramientas para extracción y análisis de memoria en Linux

Como todos sabéis, en un análisis forense es tremendamente útil la obtención del volcado de memoria volátil y su posterior análisis, sobretodo porque muchos artefactos de malware usan funciones que no dejan datos en disco. 

Quizás la mayoría de herramientas de adquisición y análisis de memoria estaban orientadas a sistemas en Windows porque durante años ha sido el gran objetivo de los "códigos maliciosos". No obstante con el gran auge de Android y otros sistemas Linux/Unix, esta tendencia está cambiando y se hace necesario saber utilizar y tener a mano algunas de las siguientes herramientas:

1. Volatility Framework: quizás una de las más famosas colecciones de herramientas para la extración y el análisis de la memoria volatil (RAM). Sin embargo el soporte para Linux es todavía experimental: ver la página LinuxMemoryForensics en el Volatility wiki. (Licencia GNU GPL) 

2. Idetect (Linux): una vieja implementación para el análisis de la memoria en Linux.

3. LiME (Linux Memory Extractor): presentado en la ShmooCon 2012, es un módulo cargable para el kernel (LKM) y permite la adquisión de memoria incluso en Android.

4. Draugr: interesante herramienta que puede buscar símbolos del kernel (patrones en un fichero XML o con EXPORT_SYMBOL), procesos (información y secciones) (por la lista de enlaces del kernel o por fuerza bruta) y desensamblar/volcar la memoria.

5. Volatilitux: framework en Python equivalente a Volatility en Linux. Soporta arquitecturas ARM, x86 y x86 con PAE activado.

6. Memfetch: sencilla utilidad para volcar la memoria de procesos en ejecución o cuando se descubre una condición de fallo (SIGSEGV).

7. Crash de Red Hat: es una herramienta independiente para investigar tanto los sistemas en funcionamiento como los volcados de memoria del kernel hechos con lo paquetes de Red Hat netdump, diskdump o kdump. También se puede utilizar para el análisis forense de memoria.

8. Memgrep: sencilla utilidad para buscar/reemplazar/volcar memoria de procesos en ejecución y ficheros core.

9. Memdump: se puede utilizar para volcar la memoria del sistema al stream de salida, saltando los huecos de los mapas de la memoria. Por defecto vuelca el contenido de la memoria física (/dev/mem). Se distribuye bajo la Licencia Pública de IBM. 

10. Foriana: esta herramienta es útil para la extracción de información de procesos y listas de módulos desde una imagen de la RAM con la ayuda de las relaciones lógicas entre las estructuras del sistema operativo.

11. Forensic Analysis Toolkit (FATKit): un nuevo framework multiplataforma y modular diseñado para facilitar la extracción, análisis, agregación y visualización de datos forenses en varios niveles de abstracción y complejidad de datos.

12. The Linux Memory Forensic Acquisition (Second Look): esta herramienta es una solución comercial con un driver de crashing modificado y scripts para volcado.

13. http://valgrind.org/

14. http://www.porcupine.org/forensics/tct.html

Fuente: 
Hackplayers

6 feb 2015

OSXCollector: Forensic Collection and Automated Analysis for OS X

Introducing OSXCollector

We use Macs a lot at Yelp, which means that we see our fair share of Mac-specific security alerts. Host based detectors will tell us about known malware infestations or weird new startup items. Network based detectors see potential C2 callouts or DNS requests to resolve suspicious domains. Sometimes our awesome employees just let us know, “I think I have like Stuxnet or conficker or something on my laptop.”
When alerts fire, our incident response team’s first goal is to “stop the bleeding” – to contain and then eradicate the threat. Next, we move to “root cause the alert” – figuring out exactly what happened and how we’ll prevent it in the future. One of our primary tools for root causing OS X alerts is OSXCollector.
OSXCollector is an open source forensic evidence collection and analysis toolkit for OS X. It was developed in-house at Yelp to automate the digital forensics and incident response (DFIR) our crack team of responders had been doing manually.

Performing Forensics Collection

The first step in DFIR is gathering information about what’s going on – forensic artifact collection if you like fancy terms. OSXCollector gathers information from plists, sqlite databases and the local filesystem then packages them in an easy to read and easier to parse JSON file.
osxcollector.py is a single Python file that runs without any dependencies on a standard OS X machine. This makes it really easy to run collection on any machine – no fussing with brew, pip, config files, or environment variables. Just copy the single file onto the machine and run it. sudo osxcollector.py is all it takes.
123
$ sudo osxcollector.py
Wrote 35394 lines.
Output in osxcollect-2014_12_21-08_49_39.tar.gz
view rawsample hosted with ❤ by GitHub

Details of Collection

The collector outputs a .tar.gz containing all the collected artifacts. The archive contains a JSON file with the majority of information. Additionally, a set of useful logs from the target system logs are included.
The collector gathers many different types of data including:
  • install history and file hashes for kernel extensions and installed applications
  • details on startup items including LaunchAgents, LaunchDaemons, ScriptingAdditions, and other login items
  • OS quarantine, the information OS X uses to show ‘Are you sure you wanna run this?’ when a user is trying to open a file downloaded from the internet
  • file hashes and source URL for downloaded files
  • a snapshot of browser history, cookies, extensions, and cached data for Chrome, Firefox, and Safari
  • user account details
  • email attachment hashes
The docs page on GitHub contains a more in depth description of collected data.

Performing Basic Forensic Analysis

Forensic analysis is a bit of an art and a bit of a science. Every analyst will see a bit of a different story when reading the output from OSXCollector – that’s part of what makes analysis fun.
Generally, collection is performed on a target machine because something is hinky: anti-virus found a file it doesn’t like, deep packet inspect observed a callout, endpoint monitoring noticed a new startup item, etc. The details of this initial alert – a file path, a timestamp, a hash, a domain, an IP, etc. – is enough to get going.
OSXCollector output is very easy to sort, filter, and search for manual forensic analysis. By mixing a bit of command-line-fu with some powerful tools like like grep and jq a lot of questions can be answered. Here’s just a few examples:
Get everything that happened around 11:35
1
$ cat INCIDENT32.json | grep '2014-01-01 11:3[2-8]'
view rawfind_by_time.sh hosted with ❤ by GitHub
Just the URLs from that time period
1
$ cat INCIDENT32.json | grep '2014-01-01 11:3[2-8]' | jq 'select(has("url"))|.url'
view rawfind_by_time_url.sh hosted with ❤ by GitHub
Just details on a single user
1
$ cat INCIDENT32.json | jq 'select(.osxcollector_username=="ivanlei")|.'
view rawfind_user.sh hosted with ❤ by GitHub

Performing Automated Analysis with OutputFilters

Output filters process and transform the output of OSXCollector. The goal of filters is to make it easy to analyze OSXCollector output. Each filter has a single purpose. They do one thing and they do it right.
For example, the FindDomainsFilter does just what it sounds like: it finds domain names within a JSON entry. The domains are added as a new key to the JSON entry. For example, given the input:
12345
{
"visit_time": "2014-10-16 09:44:57",
"title": "Pizza New York, NY",
"url": "http://www.yelp.com/search?find_desc=pizza&find_loc=NYC"
}
view rawfilter_input.json hosted with ❤ by GitHub
the FindDomainsFilter would add an osxcollector_domains key to the output:
123456
{
"visit_time": "2014-10-16 09:44:57",
"title": "Pizza New York, NY",
"url": "http://www.yelp.com/search?find_desc=pizza&find_loc=NYC",
"osxcollector_domains": ["yelp.com","www.yelp.com"]
}
view rawfilter_output.json hosted with ❤ by GitHub
This enhanced JSON entry can now be fed into additional OutputFilters that perform actions like matching domains against a blacklist or querying a passive DNS service for domain reputation information.

Basic Filters

FindDomainsFilter

Finds domain names in OSXCollector output and adds an osxcollector_domains key to JSON entries.

FindBlacklistedFilter

Compares data against user defined blacklists and adds an osxcollector_blacklist key to matching JSON entries.
Analysts should create blacklists for domains, file hashes, file names, and any known hinky stuff.

RelatedFilesFilter

Breaks an initial set of file paths into individual file and directory names and then greps for these terms. The RelatedFilesFilter is smart and ignores usernames and common terms like bin orLibrary.
This filter is great for figuring out how evil_invoice.pdf landed up on a machine. It’ll find browser history, quarantines, email messages, etc. related to a file.

ChromeHistoryFilter and FirefoxHistoryFilter

Builds a really nice browser history sorted in descending time order. The output is comparable to looking at the history tab in the browser but contains more info such as whether the URL was visited because of a direct user click or visited in a hidden iframe.

Threat API Filters

OSXCollector output typically has thousands of potential indicators of compromise like domains, urls, and file hashes. Most are benign; some indicate a serious threat. Sorting the wheat from the chaff is quite a challenge. Threat APIs like OpenDNS, VirusTotal, and ShadowServer use a mix confirmed intelligence information with heuristics to augment and classify indicators and help find the needle in the haystack.

OpenDNS RelatedDomainsFilter

Looks up an initial set of domains and IP with the OpenDNS Umbrella API and finds related domains. Threats often involve relatively unknown domains or IPs. However, the 2nd generation related domains, often relate back to known malicious sources.

OpenDNS & VirusTotal LookupDomainsFilter

Looks up domain reputation and threat information in VirusTotal and OpenDNS.
The filters uses a heuristic to determine what is suspicious. These can create false positives but usually a download from a domain marked as suspicious is a good lead.

ShadowServer & VirusTotal LookupHashesFilter

Looks up hashes with the VirusTotal and ShadowServer APIs. VirusTotal acts as a blacklist of known malicious hashes while ShadowServer acts as a whitelist of known good file hashes.

AnalyzeFilter – The One Filter to Rule Them All

AnalyzeFilter is Yelp’s one filter to rule them all. It chains all the previous filters into one monster analysis. The results, enhanced with blacklist info, threat APIs, related files and domains, and even pretty browser history is written to a new output file.
Then Very Readable Output Bot takes over and prints out an easy-to-digest, human-readable, nearly-English summary of what it found. It’s basically equivalent to running:
123456789101112131415161718
$ cat SlickApocalypse.json | \
python -m osxcollector.output_filters.find_domains | \
python -m osxcollector.output_filters.shadowserver.lookup_hashes | \
python -m osxcollector.output_filters.virustotal.lookup_hashes | \
python -m osxcollector.output_filters.find_blacklisted | \
python -m osxcollector.output_filters.related_files | \
python -m osxcollector.output_filters.opendns.related_domains | \
python -m osxcollector.output_filters.opendns.lookup_domains | \
python -m osxcollector.output_filters.virustotal.lookup_domains | \
python -m osxcollector.output_filters.chrome_history | \
python -m osxcollector.output_filters.firefox_history | \
tee analyze_SlickApocalypse.json | \
jq 'select(false == has("osxcollector_shadowserver")) |
select(has("osxcollector_vthash") or
has("osxcollector_vtdomain") or
has("osxcollector_opendns") or
has("osxcollector_blacklist") or
has("osxcollector_related"))'
view rawthe_one_filter.sh hosted with ❤ by GitHub
and then letting a wise-cracking analyst explain the results to you. The Very Readable Output Boteven suggests new values to add to your blacklists.
This thing is the real deal and our analysts don’t even look at OSXCollector output until after they’ve run the AnalyzeFilter.

Give It a Try

The code for OSXCollector is available on GitHub – https://github.com/Yelp/osxcollector. If you’d like to talk more about OS X disk forensics feel free to reach out to me on Twitter at @c0wl.


Fuente: http://engineeringblog.yelp.com/

3 jul 2014

OWASP iOSForensic Tool

Herramienta para análisis forense iOS

 WASP iOSForensic es una herramienta realizada en Python para análisis forense de dispositivos iOS. 
Esta herramienta permite la extracción de archivos de registros, bases de datos SQLite3 y archivos plist en formato xml entre otros:








  • Archivos de aplicaciones.
  • Conversión de .Plist en XML.
  • Extracción de bases de datos.
  • Conversión de cookies binarios.
  • Logs de aplicación.
  • Una lista de todos los paquetes.
  • Paquetes múltiples Extracción.

24 jun 2014

OS X - Análisis Forense con SpotLight Inspector


La gente de SeguridadApple, ha publicado el siguiente artículo, el cual copio a fin de tener a mano el recuerdo el uso de la herramienta "SpotLight Inspector".

Dentro de la larga lista de herramientas que componen el Arsenal de Black Hat USA 2014 hay varias de ellas para tecnologías Apple. Una en concreto es SpotLight Inspector, una solución para hacer análisis forense y extraer datos de gran utilidad de la base de datos que utiliza la herramientaSpotLight en OS X. Dicha utilidad es una mega-base de datos que indexa todo el contenido del sistema operativo, incluyendo aplicaciones, contactos, documentos y/o correos electrónicos. 

Las opciones de indexación de dicha base de datos se configuran en las preferencias del sistema, y hay una pestaña de Privacidad para indicarle al sistema qué no se quiere tener indexado, pero por defecto se indexa absolutamente todo.

Figura 1: Opciones de indexación de SpotLight en las Preferencias de OS X

La herramienta SpotLight Inspector, que puede ser descargada para OS X proporcionando únicamente un nombre y un correo electrónico, se encarga de analizar dicha base de datos y extraer toda la información que de cada elemento la aplicación SpotLight almacena. Una vez que se arranca, como toda herramienta centrada en el análisis forense, genera un caso nuevo en el que se añaden todas las evidencias posibles.

Figura 2: SpotLight Inspector para OS X

Para conseguir la base de datos de SpotLight hay que tener una copia del volumen e irse a la ruta siguiente a conseguirla. Como se puede ver, solo tiene acceso el usuario root de lectura y escritura, por lo que si quieres probar en tu sistema debes acceder con privilegios y copiar ese fichero.

Figura 3: Ruta de la base de datos de SpotLight en OS X

Una vez que lo tengas se lo pasas a la herramienta, que tardará unos minutos en procesarlo entero para poner los datos de la base de datos en un formato que te sea cómo de procesar.

Figura 4: Añadiendo la base de datos a SpotLight Inspector para su análisis

El resultado es una estructura en la que puedes ver todos los metadatos de todos los elementos que tiene indexado el sistema SpotLight de cada uno de los objetos. Por ejemplo, de los correos electrónicos o las páginas web visitadas hay información casi completa, por lo que si el usuario ha borrado el correo, pero tenemos copias de las bases de datos de SpotLight se podrá seguir contando con esa información.

Figura 5: Metadatos de correos electrónicos extraídos de la base de datos de SpotLight

La herramienta está disponible también para sistemas Windows y Linux tanto para 32 como 64 bits, así que si eres un analista forense ya puedes adjuntar esta utilidad a tu juego de herramientas, que seguro que te viene bien en el futuro.