Ransomware ate my network (IV)

A brief explanation of this series with some clarifying notes can be read at the beginning of the first part.
Series entries: First part, Second part, Third part, Fourth part, Fifth part

[Editor’s note: Clicking on many images – those whose detail is not fully visible with the size of the main page – shows an enlarged version]


In the previous article we saw how Angela had deduced that the attackers had entered the computer used to connect to the DC from another computer using the PsExec tool. Determined to find the PsExec, Angela begins by converting the MFT extracted by CyLR with mftdump.exe to .csv, and searching for activity around the time she saw the connection on the other computer (about 2:16 p.m. 1:16 p.m. in UTC which is what the MFT shows us).

There is no clear target, but that stalin.exe Prefetch looks suspicious (remember that Prefetches are created the first time the software is run, with a delay of a few seconds).

[Read more…]

Ransomware ate my network (III)

A brief explanation of this series with some clarifying notes can be read at the beginning of the first part.
Series entries: First part, Second part, Third part, Fourth part, Fifth part

In the previous article, we left the investigation with the IP 10.11.2.14 as the source of the connections to the DC (and with connections to the C2 101.143.122.216 as well as the antivirus disabled prior to the generalized attack).

Since we are talking about connections and considering that we have the RAM memory, the first thing Angela does is to use the Volatility netscan plugin to remove the network connections (the memory profile is Win10x64_17134) and confirm the connections with the C2:

Netscan returns a few additional results:

A connection to a remote SSH?

What is this computer doing providing a service on port 443/TCP? Has it gone mad? Clearly we need to dig deeper into these connections to find out what is behind them.

Angela decides to check the Sysmon logs, which should show the network connections… but it seems that the FFP (remember, the Federation of Patron Festivities) did not correctly apply the standard MINAF Sysmon configuration, so no such data is being collected (grrrrrrr).

[Read more…]

Ransomware ate my network (II)

A brief explanation of this series with some clarifying notes can be read at the beginning of the first part.
Series entries: First part, Second part, Third part, Fourth part, Fifth part

In the previous article, we saw how MINAF narrowly avoided a ransomware attack, but we still have a lot of questions to answer. First, finding out the identity of the ransomware group that had affected MINAF.

To do this, Angela converts the MFT of the DC with mftdump.exe and performs a quick search of the v2.exe and v2c.exe files, which seemed a priori those in charge of deploying the ransomware. She hits the spot because she finds the files in the c:\temp\scheduler folder:

Quickly calculates her hashes:

5994df288813a7d9588299c301a8de13479e3ffb630c49308335f20515ffdf57  v2c.exe
b2a304e508415d96f417ed50d26e0b987b7cbd9a77bb345ea48e803b5a7afb49 v2.exe
ffa8722a09829acd7ef8743688947f6ccb58d2ef v2c.exe
7320b34c07206fcaf1319d6ce9bef2b29648a151 v2.exe
eddc0e293b0f0ee90bab106f073a41c9 v2c.exe
91438699bed008be9405995f0a158254 v2.exe

The next thing is to check if they are known. VirusTotal gives you a quick answer:

[Read more…]

Ransomware ate my network (I)

A brief explanation of this series with some clarifying notes can be read below.
Series entries: First part, Second part, Third part, Fourth part, Fifth part

Note 1: This series of posts is a narration of a forensic analysis of a totally fictional incident response case study (but told, we hope, in a didactic and humorous way). If you want a version with the same technical dose but with less narrative, you can check the video of the talk that the author gave at the XIV CCN-CERT STIC Conference, or take a look at the slides of the presentation.

Note 2: These posts reveal a forensic analysis workshop encompassed within the incident response. There will be some things that could be done more efficiently and elegantly, but the idea was to make them simple so that they are easy to understand. And like any practical workshop, you can take advantage of it in several ways: you can download from LORETO the evidence  already worked to follow the case step by step, you can download the raw evidence to do your own investigation… or you can play the CTF DFIR that we have prepared and that will be unfolding the case as you respond to the various challenges.


There are few good months for cybersecurity in a Public Administration, and November is not one of them: projects must be closed, status reports must be made, and it is necessary to make sure that the entire budget is executed (and justified with the corresponding invoices).

Angela de la Guarda, CISO of the MINAF (Ministerio of Alegría y Felicidad, Joy and Happiness in English) has not had a particularly happy year: the pandemic forced the deployment of teleworking for a large part of the personnel, which caused a significant overload on all ICT personnel… and even more so on her and her team, responsible for ensuring the security of all systems.

To make things worse, in the usual restructuring with each change of government, the MINAF has been entrusted with the mission of “unifying all state agencies with skills on joy and happiness.” This has led to the absorption of several entities of different sizes, among which the FFP (Federation of Patron Festivities, in charge of managing all town festivals in Spain) stands out. The FFP has, so to speak… a rather relaxed view of cybersecurity, which made assimilation highly conflictive. In the end, the upper echelons have ruled, and the MINAF finally absorbed the FFP.

It’s 5:00 p.m., and Angela is checking emails to finish the first of a week full of reports and go home, when Salvador Bendito (MINAF security analyst) calls her on her mobile: “Boss, we have a very serious problem. One of the canaries has jumped: we are losing the goalkeepers. All of them”.

[Read more…]

Ransomware ate my network (V)

Una breve explicación de esta serie con algunas notas aclaratorias se puede leer al comienzo del primer artículo.
Entradas de la serie:
=> Primera parte
=> Segunda parte
=> Tercera parte
=> Cuarta parte
=> Quinta parte

En el artículo anterior ya habíamos terminado el análisis forense del incidente, por lo que Ángela ya tenía una visión global de todo lo que había ocurrido. Los timelines son una herramienta de análisis sensacional para poder entender lo ocurrido en un incidente, así que construimos una (con las horas en UTC, no perdamos las buenas costumbres):

  • 4/Nov: Los atacantes envían los correos con enlaces maliciosos a personal de la FFP.
  • 9/Nov – 11:37h – dolores.jolgorio abre el correo, descarga y ejecuta el .doc con la macro maliciosa.
  • 11:38h – El equipo se infecta con un agente de Meterpreter.
  • 11:41h – Los atacantes ejecutan diversos comandos para reconocer el sistema.
  • 11:46h – Los atacantes “revenden” el acceso al segundo grupo, cediendo el control con un agente de Empire.
  • 12:01 – Los atacantes elevan privilegios con un exploit de la vulnerabilidad CVE-2020-0787.
  • Entre las 12:01 y las 12:37h: Vuelcan hashes con la funcionalidad Powerdump de Empire.
  • 12:37h – Lanzan SharpHound e identifican W10-PC3 como equipo con una sesión iniciada de administrador de dominio.
  • 13:16h – Con los permisos de administrador local, copian el stager de Empire a W10-PC3 y lo ejecutan con PsExec.
  • Entre las 13:16 y las 13:30h – Obtienen el hash NTLM de la cuenta dom.adm con Mimikatz.
  • 13:51h – Montan el pivot SSH-RDP y acceden al DC con el hash NTLM de la cuenta dom.adm.
  • 13:55h – Copian el fichero temp.zip con las GPO y scripts de Powershell.
  • 13:57h – Despliegan la GPO “All in One”, que erosiona severamente la seguridad de los equipos del dominio.
  • 15:08h – Despliegan la GPO “Scheduler”, que copia el ransomware a los equipos y deja programada una tarea para su ejecución a las 17:15h.
  • 15:13h – Lanzamiento de un agente de Empire.
  • 15:30h – Saltan las alertas en GLORIA.
[Read more…]

Ransomware ate my network (IV)

Una breve explicación de esta serie con algunas notas aclaratorias se puede leer al comienzo del primer artículo.
Entradas de la serie:
=> Primera parte
=> Segunda parte
=> Tercera parte
=> Cuarta parte
=> Quinta parte

[Nota del editor: Pinchando en muchas imágenes –aquellas cuyo detalle no se ve del todo con el tamaño de la página principal– se muestra una versión ampliada]


En el artículo anterior vimos cómo Ángela había deducido que los atacantes habían entrado en el equipo empleado para conectarse al DC desde otro equipo empleando la herramienta PsExec. Dispuesta a encontrar el PsExec, Ángela empieza convirtiendo a .csv la MFT extraída por CyLR con mftdump.exe, y buscando por actividad alrededor de la la hora en la que vio la conexión en el otro equipo (sobre las 14:16h, 13:16h en UTC que es lo que nos muestra la MFT).

No hay un objetivo claro, pero ese Prefetch de stalin.exe parece sospechoso (recordemos que los Prefetch se crean la primera vez que se ejecuta el software, con un retraso de unos pocos segundos).

[Read more…]

Ransomware ate my network (III)

Una breve explicación de esta serie con algunas notas aclaratorias se puede leer al comienzo del primer artículo.
Entradas de la serie:
=> Primera parte
=> Segunda parte
=> Tercera parte
=> Cuarta parte
=> Quinta parte

En el artículo anterior la investigación se había quedado con el equipo con la IP 10.11.2.14 como origen de las conexiones al DC (y que tenía tanto conexiones con el C2 101.143.122.216 como el antivirus desactivado de forma previa al ataque generalizado).

Dado que estamos hablando de conexiones y que disponemos de la memoria RAM, lo primero que hace Ángela es emplear el plugin netscan de Volatility para sacar las conexiones de red (el perfil de memoria es Win10x64_17134) y confirmar las conexiones con el C2:

Netscan devuelve a su vez unos cuantos resultados adicionales:

¿Una conexión a un SSH remoto?

¿Y qué hace este equipo prestando un servicio en el puerto 443/TCP? ¿Se ha vuelto loco? Está claro que tenemos que profundizar en estas conexiones saber qué hay detrás de ellas. Ángela decide revisar los logs de Sysmon, en los que tendrían que aparecer las conexiones de red… pero parece que la FFP no aplicó correctamente la configuración de Sysmon estándar del MINAF, por lo que no se están recogiendo esos datos (grrrrrrr).

[Read more…]

Ransomware ate my network (II)

Una breve explicación de esta serie con algunas notas aclaratorias se puede leer al comienzo del primer artículo.
Entradas de la serie:
=> Primera parte
=> Segunda parte
=> Tercera parte
=> Cuarta parte
=> Quinta parte

En el artículo anterior vimos cómo el MINAF había evitado por los pelos un ataque de ransomware, pero nos quedaban muchísimas preguntas por resolver.  En primer lugar, averiguar la identidad del grupo de ransomware que había afectado al MINAF. 

Para ello Ángela convierte la MFT del DC con mftdump.exe y realiza una búsqueda rápida de los ficheros v2.exe y v2c.exe, que parecían a priori los encargados de desplegar el ransomware. Da en el clavo porque encuentra los ficheros en la carpeta c:\temp\scheduler:

Rápidamente calcula sus hashes:

5994df288813a7d9588299c301a8de13479e3ffb630c49308335f20515ffdf57  v2c.exe
b2a304e508415d96f417ed50d26e0b987b7cbd9a77bb345ea48e803b5a7afb49 v2.exe
ffa8722a09829acd7ef8743688947f6ccb58d2ef v2c.exe
7320b34c07206fcaf1319d6ce9bef2b29648a151 v2.exe
eddc0e293b0f0ee90bab106f073a41c9 v2c.exe
91438699bed008be9405995f0a158254 v2.exe

Lo siguiente es comprobar si son conocidos. VirusTotal le da una respuesta rápida:

[Read more…]

Ransomware ate my network (I)

Una breve explicación de esta serie con algunas notas aclaratorias se puede leer al comienzo del primer artículo.
Entradas de la serie:
=> Primera parte
=> Segunda parte
=> Tercera parte
=> Cuarta parte
=> Quinta parte

Nota 1: Esta serie de posts es una narración de un análisis forense de un caso práctico de respuesta ante incidentes totalmente ficticio (pero contada, esperamos, de forma didáctica y con gracia y salero). Si queréis una versión con la misma dosis técnica pero con menos narrativa, podéis consultar el vídeo de la charla que el autor dio en las XIV Jornadas STIC del CCN-CERT, o echar un ojo las slides de la presentación.

Nota 2: Estos posts desgranan un taller de análisis forense englobado dentro de la respuesta ante un incidente. Habrá algunas cosas que se podrían hacer de manera más eficiente y elegante, pero la idea era hacerlas de forma sencilla para que sean fáciles de entender. Y como todo taller práctico, se puede aprovechar de varias maneras: podéis descargar desde LORETO las evidencias ya trabajadas para poder seguir el caso paso por paso, podéis descargaros las evidencias en bruto para hacer vuestra propia investigación … o podéis jugar al CTF DFIR que hemos preparado y que os irá desgranando el caso a medida que vayáis respondiendo a los diversos retos.


Hay pocos meses buenos para la ciberseguridad en una Administración Pública, y noviembre no es uno de ellos: hay que tener cerrados los proyectos, realizar informes de estado, asegurarse de que todo el presupuesto está ejecutado (y justificado con las facturas correspondientes).

Ángela de la Guarda, CISO del MINAF (Ministerio de la Alegría y la Felicidad) no ha tenido un año especialmente alegre: la pandemia obligó a desplegar a marchas forzadas teletrabajo para buena parte del personal, lo que causó una sobrecarga importante sobre todo el personal TIC … y más si cabe sobre su ella y su equipo, responsables de garantizar la seguridad de todos los sistemas.

Para más inri, en la consabida reestructuración con cada cambio de gobierno, al MINAF se le ha encargado la misión de “unificar todos los organismos estatales con competencias sobre la alegría y la felicidad”. Esto ha supuesto la absorción de varios entes de diverso tamaño, entre los que destaca la FFP (Federación de Festejos Patronales, encargada de la gestión de todas las fiestas de pueblo de España). La FFP tiene, por así decirlo … una visión más bien relajada de la ciberseguridad, lo que está haciendo que la asimilación haya sido altamente conflictiva. Al final las altas esferas han mandado, y el MINAF ha absorbido a la FFP “de aquellas maneras”.

Son las 17.00h, y Ángela está revisando correos para terminar el primero de una semana llena de informes y poder irse a su casa, cuando Salvador Bendito (analista de seguridad del MINAF) la llama al móvil: “Jefa, tenemos un problema muy serio. Ha saltado uno de los canarios: estamos perdiendo a los porteros. A todos ellos”.

[Read more…]