Try   HackMD

DC506 - Challenge 02

Archivo: A0E816661425A68939DBE4F8B6DF2B2F3242A61D.7z

El archivo se encuentra comprimido, por lo tanto iniciamos verificando el tipo de archivo

file A0E816661425A68939DBE4F8B6DF2B2F3242A61D.7z
A0E816661425A68939DBE4F8B6DF2B2F3242A61D.7z: 7-zip archive data, version 0.4

Extraemos el contenido y observamos que el nombre del archivo es A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe, lo que parece ser su hash, así que lo verificamos con el algoritmo de SHA1 y efectivamente lo es

shasum A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe
a0e816661425a68939dbe4f8b6df2b2f3242a61d  A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe

Probamos inicialmente con el comando strings para ver si tiene algún texto que nos dé alguna pista

strings A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe | grep flag
flag{1m_not_th3_flag!}

Es gracioso el mensaje que aparece flag{1m_not_th3_flag!} y reta a seguir buscando el flag correcto

Parece que tendremos que buscar un poco más de información sobre el archivo

file A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe
A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe: PE32 executable (console) Intel 80386, for MS Windows

PoC #1

Para nuestra primera prueba de concepto podemos utilizar un servicio de sandbox como Cuckoo, en nuestro caso un servicio sandbox online, por ejemplo: Hybrid Analysis o Reverse.it

Nosotros vamos a utilizar Reverse.it. Ingresamos a la página y subimos el archivo A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe y le damos analizar

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Una vez que la plataforma termine de analizar el archivo, nos muestra un resumen lo que encontró y que tan sospechoso es el archivo basado en su comportamiento y además cuales antivirus lo detectan como peligroso, gracias a la integración que tiene con VirusTotal

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Podemos ir a la sección Incident Response y presionar el botón View all details para observar que técnicas de la matrix de MITRE ATT&CK utiliza este archivo

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Posteriormente podemos buscar más detalles observando el reporte completo haciendo click sobre la siguiente sección

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Estando en el reporte, la plataforma nos muestra varias secciones:

  • Incident Response
  • Indicators
  • Incident Response
  • Indicators
  • File Details
  • Screenshots
  • Hybrid Analysis
  • Network Analysis
  • Extracted Strings
  • Extracted Files
  • Notifications
  • Community

Para este ejercicio nos interesan las secciones Extracted Strings y Extracted Files, que es donde podemos encontrar algún flag en las cadenas de texto y analizar que archivos se crean, modifican o borran

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Vemos en la pestaña All Strings (176), lo que nos indica que encontro 176 cadenas de texto legible y nada más buscamos la que nos interesa. Encontramos dos texto con la palabra flag, flag{1m_not_th3_flag!} que esta muy cómica pero no es la que estamos buscando y flag{W1ndows_seems_like_a_n1c3_dude} que es nuestro flag

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Podemos desplazarnos a otra pestaña y también encontramos la cadena de texto que nos interesa

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Por último tenemos la sección Extrated Files donde observamos que durante el proceso de ejecución en el sistema se crea el archivo fla3A8.tmp, importante a considerar cuando hagamos nuestro análisis dinámico

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

PoC #2

Para nuestra segunda prueba de concepto para a utilizar lo siguiente:

Primero hacemos un snapshot de la máquina virtual y copiamos los archivos A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe, ProcessExplorer.zip y ProcessMonitor.zip a la máquina virtual

Descomprimimos ProcessExplorer.zip y ProcessMonitor.zip. Ejecutamos cada programa y lo minimizamos. Posteriormente ejecutamos el archivo A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Vemos que nos abre una consola y nos muestra un mensaje Generating important data

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Abrimos Process Explorer y buscamos el PID del proceso que utiliza el ejecutable A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe. Vemos que su PID es 1780

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Ahora utilizamos el programa Process Monitor y hacemos un filtro con el PID 1780 y le damos OK

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Vemos que el aplicación nos filtra solamente las operaciones que tienen que ver con el PID 1780

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Buscamos alguna función que nos parezca interesante y encontramos la operation CreateFile en la ruta C:\Users\IEUser\AppData\Local\Temp\fla3D0E.tmp, por lo que podemos suponer que en ese archivo que se crea puede estar el flag

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Ahora nos vamos a la ruta C:\Users\IEUser\AppData\Local\Temp y ejecutamos A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe, pero no vemos nada, así que suponemos que el archivo puede tener atributos ocultos y modificamos las opciones de la carpeta para poder visualizarlos

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Vemos que cuando se ejecuta el archivo A0E816661425A68939DBE4F8B6DF2B2F3242A61D.exe se crea un archivo con extensión .tmp pero se borra cuando se cierra la ventana del Command Prompt

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Entonces para mantener el archivo y poder revisar su contenido, cerramos la ventana del Command Prompt cuando vemos el mensaje Generating important data

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Finalmente abrimos el archivo fla3D0E.tmp con un editor de texto y encontramos el flag{W1ndows_seems_like_a_n1c3_dude}

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →