Exchange forensics: The mysterious case of ghost mail (IV)

Articles in the series “Exchange forensics: The mysterious case of ghost mail”: [1] [2] [3] [4]

[Note: This is a fiction story, the characters and situations are not real, the only real thing is the technical part, which is based on a mixture of work done, experiences of other colleagues and research carried out. with the same technical dose but with less narrative, you can consult the video of the talk that the author gave at the 11th STIC Conference of the CCN-CERT here]

We return to the investigation of the incident by examining what our colleague had found in the OWA logs. If we gather all the information regarding the accesses made from the two IP addresses with the Firefox User-Agent, we find several patterns of interest:
[Read more…]

Exchange forensics: The mysterious case of ghost mail (III)

Articles in the series “Exchange forensics: The mysterious case of ghost mail”: [1] [2] [3]

[Note: This is a fiction story, the characters and situations are not real, the only real thing is the technical part, which is based on a mixture of work done, experiences of other colleagues and research carried out. with the same technical dose but with less narrative, you can consult the video of the talk that the author gave at the 11th STIC Conference of the CCN-CERT here]

After a sleepless night (tossing and turning, brooding on the incident and trying to understand what may have happened, what we may have overlooked, what we still need to try), we return loaded with caffeine to the Organization.

Autopsy has finished the processing of the hard disk image, but after a superficial analysis of the results our initial theory is confirmed: the user’s computer is clean. In fact, it is so clean that the malicious email did not even touch that computer. Therefore, it is confirmed that everything that happened must have happened in the Exchange.

We keep thinking about the incident, and there is something that irks us: if the attackers had complete control of the Exchange, they could have deleted the mail from the Recoverable Items folder, which they didn’t. But what they did manage was to erase it from the EventHistoryDB table, which operates at a lower level … or perhaps they didn’t either.

[Read more…]

Exchange forensics: The mysterious case of ghost mail (I)

Articles in the series “Exchange forensics: The mysterious case of ghost mail”: [1] [2] [3] [4]

(Note: This is a fiction story, the characters and situations are not real, the only real thing is the technical part, which is based on a mixture of work done, experiences of other colleagues and research carried out. If you want a version with the same technical dose but with less narrative, you can consult the video of the talk that the author gave at the 11th STIC Conference of the CCN-CERT here).

Another day in the office, with a list of pending tasks to plan longer than the beard of Richard Stallman and none of them entertaining: reports, documentation of a couple of projects and the preparation of a meeting is what the menu of the day offers for almost the entire week.
Luckily, the saying that “no plan survives contact with the enemy” in this case works in our favor. The phone rings, and my boss goes straight to the point: “A YARA rule has been triggered from the ATD group in CARMEN of [Redacted] (entity whose identity we are going to leave anonymously, calling it “the Organization” from now on). Take your stuff and rush over there.”

The adrenaline rush at the thrill of the hunt is instantaneous: ATD is our internal name of a group of attackers that we hunted a few months ago on another client, and our reversers ripped the malware open from top to bottom without mercy. The analysis allowed us to detect a series of particular “irregularities” in their way of acting, which allowed us to generate a series of high fidelity YARA rules (that is, false positives practically null). If it was triggered on CARMEN (our advanced intrusion detection tool), then 99% sure to be infected”.
[Read more…]

Exchange forensics: El misterioso caso del correo fantasma (IV)

Volvemos a la investigación del incidente examinando lo que nuestra compañera había encontrado en los logs del OWA. Si recogemos todos los accesos realizados desde las dos IP con el User-Agent de Firefox, encontramos varios patrones de interés:

  • Patrón 1: Acceso directo: Se observa en los logs cómo los atacantes acceden a la página de login, y luego a la pantalla principal del correo.
  • Patrón 2: Accesos incorrectos: Los atacantes acceden a la página de login, pero la contraseña es incorrecta (observamos repetidos intentos de inicio de sesión, como si estuvieran realizando un ataque manual de fuerza bruta).
  • Patrón 3: Accesos incorrectos + correcto: En un caso específico comprobamos como los atacantes realizan varios intentos de inicio de sesión y al quinto logran entrar.

Este último patrón es el más curioso ¿Cómo han podido los atacantes extraer las contraseñas de un usuario (que son robustas al tener 12 caracteres y forzada la complejidad) en unos pocos intentos? [Read more…]

Exchange forensics: El misterioso caso del correo fantasma (III)

Después de una noche con poco sueño (vueltas, vueltas al incidente intentando comprender qué ha podido pasar, qué nos hemos podido pasar por alto, qué nos falta por probar), volvemos cargados de cafeína a la Organización.

Autopsy ha terminado el procesado de la imagen de disco duro, pero tras un análisis superficial de los resultados nuestra teoría inicial se confirma: el equipo del usuario está limpio. De hecho, está tan limpio que el correo malicioso ni siquiera llegó a tocar ese equipo. Por lo tanto, se confirma que todo lo que haya pasado ha tenido que pasar en el Exchange.

Seguimos dándole vueltas al incidente, y hay algo que nos reconcome: si los atacantes tuvieran control completo del Exchange, habrían podido borrar el correo de la carpeta de los Elementos Recuperables, cosa que no han hecho. Pero lo que sí que han logrado ha sido poder borrarlo de la tabla EventHistoryDB, que opera a más bajo nivel… ¿o a lo mejor no lo han hecho?

[Read more…]

Exchange forensics: El misterioso caso del correo fantasma (II)

(Nota: Esta es una historia de ficción; los personajes y situaciones no son reales; lo único real es la parte técnica, que se basa en una mezcla de trabajos realizados, experiencias de otros compañeros e investigaciones llevadas a cabo. 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 XI Jornadas STIC del CCN-CERT aquí )

Dejamos el anterior artículo con nuestras miras puestas sobre el servidor de correo de la Organización, un Microsoft Exchange 2010.  Lo primero que podemos hacer es solicitar a Sistemas que haga un message tracking (seguimiento del mensaje) del correo, que mediante una herramienta gráfica (aunque también podemos hacerlo por consola) nos localiza el histórico de un correo a alto nivel dentro de Exchange.

Primer intento, y el correo sigue sin aparecer. Repetimos las direcciones y el técnico de Sistemas repite la búsqueda sin éxito. El correo tiene que estar por fuerza, así que le pedimos que busque de nuevo en todo el día completo… y por fin lo encontramos, 14 minutos más tarde de cuando tenía que haber sido enviado.

Al parecer la Organización no tiene bien implementada su estrategia de sincronización de tiempos, y tenemos una deriva de 14 minutos entre el servidor Exchange y los clientes (nota mental: insistir en la necesidad de desplegar un servidor NTP lo antes posible), pero al fin hemos localizado el correo. El pantallazo enviado por Sistemas sería algo similar a este (por temas de confidencialidad no podemos poner ninguno de los originales):

[Read more…]