Cybersecurity News

Análisis forense digital de correos electrónicos en Microsoft Office 365

 Antecedentes

Con el avance de la nube y la automatización de los procesos en las empresas, Microsoft Office 365 se está extendiendo de forma imparable, sustituyendo a las clásicas instalaciones de Exchange que requerían de un mayor mantenimiento y control. Sin embargo, la nube trae cambios, y toca adaptarse a un sinfín de nuevas configuraciones, nuevas vías para hacer las cosas a las que ya estábamos habituados y nuevos modos de licenciamiento.

Desde el punto de vista forense, los peritos teníamos diferentes opciones para presentar un dictamen pericial que diese fe de la existencia de determinados correos electrónicos dentro de un buzón. Entre otras opciones destacadas, y atendiendo al principio de siempre “clonar” el mayor contenedor, podíamos acceder a Exchange para exportar el buzón de correo del usuario, podíamos clonar el propio servidor de correo, o incluso, el disco duro del PC del propio usuario del que luego extraer el PST. Sin embargo, todo esto está cambiando. Los servidores ahora están en un proveedor externo, Microsoft (como ya pasaba si teníamos contratado un hosting en modo SaaS), y los usuarios se están habituando a utilizar Office 365 desde su navegador. Y, en estas circunstancias, ¿cómo clonaríamos un buzón de correo electrónico manteniendo todas las garantías de integridad forense? De eso os hablaremos en este artículo.

Introducción

Desde Zerolynx realizamos periciales forenses todos los meses, principalmente derivadas de clientes que nos llaman tras haber sufrido una Estafa del CEO, con el objetivo de, por un lado, analizar el fallo de seguridad que ha propiciado la interceptación del correo, para tratar de ponerle solución, y, por otro lado, para facilitarles la judicialización del caso y la posible recuperación del dinero. Pero sobre estos casos os hablaremos en otro artículo, hoy nos queremos centrar únicamente en Office 365.

Lo primero que tenemos que conocer es que Microsoft tiene diferentes modos de licenciamiento, en función del número de herramientas y funcionalidades incluidas. Y, la seguridad avanzada, solo se encuentra incluida en el plan E5. Dejo este dato aquí reflejado porque más adelante volveremos a ello.

 


La mayor parte de las empresas que trabajamos con Office 365 contamos con el plan E1 o E3, que, por lo general, cubre casi todas las necesidades de las organizaciones. 

Problemática

Cuando desde Zerolynx comenzamos a realizar forenses sobre Office 365, nos mantuvimos trabajando con cierta normalidad, clonando los equipos de los usuarios donde tenían sincronizados sus buzones (dentro del cliente de Outlook), hasta que surgió un caso forense donde esto no era una posibilidad. Obviando la complejidad del caso, que no aporta mayor detalle para contextualizar el artículo en sí, nos dirigimos a la consola de Office 365 con un usuario con los privilegios correspondientes que nos facilitó el cliente, con el objeto de acceder, congelar el buzón para tener una copia íntegra e inmutable que garantizase que siempre obtendríamos la misma firma hash, y descargarlo.

A continuación, mostramos brevemente el proceso de descarga del buzón, ampliamente documentado en multitud de artículos en Internet.

 


Selección del buzón de correo

Detalle de resultados


Exportación de la información


Descarga de los resultados


Una vez descargado el PST, procedimos a firmar el archivo, obteniendo el correspondiente hash SHA256. Y, como siempre tenemos que hacer los forenses para garantizar la integridad, y como buena costumbre, lo descargamos de nuevo y lo volvimos a firmar para verificar que el proceso funcionaba correctamente, y que, en caso de contrapericial, la futura extracción sería idéntica a la actual. Pues cual fue nuestra sorpresa que, a pesar de tener el buzón aparentemente inmovilizado, el hash no coincidió. ¿Qué estaba pasando? Aunque ya teníamos más o menos claro lo que estaba ocurriendo, abrimos un caso con Microsoft, y aprovechamos para debatir el tema en paralelo con otros MVPs que, como nosotros, están lidiando regularmente con estas tecnologías. Y, a los pocos días obtuvimos la siguiente respuesta:

 



Pues sí, al contrario de lo que cabría pensar, Microsoft modifica los archivos en tiempo real durante cada descarga, añadiendo determinados bytes que alteran su contenido, y, por tanto, su hash. Por tanto, no es posible descargar un buzón de correo completo manteniendo su integridad.

En estas circunstancias y con algo de pensamiento lateral, aun podía justificarse la situación en el informe pericial, contando el problema tecnológico, e, irremediablemente, extrayendo el “msg” del correo a ratificar en sí, firmando, aunque fuese este último, con el fin de evidenciar que, si se extrajese en el futuro de una nueva descarga, se obtendría el mismo hash. Pero, de nuevo nos llevamos una sorpresa, los msg tampoco eran íntegros, y en ellos también se incluían determinados nuevos bytes con cada descarga. 

Por tanto, solo quedaba una solución, y es la que refleja Microsoft como respuesta en su caso, adquirir una licencia de tipo E5, la cual, y con la opción Advanced eDiscovery sí permite generar un hash “online” y garantizar dicho hash durante las descargas.

Anteriormente, éramos las empresas que nos dedicábamos a forense quienes debíamos adquirir las herramientas necesarias para realizar las clonaciones y los análisis, pero, con el nuevo enfoque de la nube, todo se dirige a que sean los clientes quienes tengan ahora que comprar estas herramientas y darnos acceso a los forenses para poder trabajar.

Para que veáis como se generaría el hash con una licencia E5, os compartimos a continuación algunas capturas del proceso.

 

Acceso a Advanced eDiscovery


Creación del caso


Posteriormente, se crearía una suspensión de la cuenta de correo para preservar el contenido del buzón de forma íntegra.


 Suspensión de la cuenta de correo


Detalle de suspensión de la cuenta seleccionada y filtros de fecha

A continuación, se asignaría un custodio al caso:


Asignación de Custodio


Más adelante, se crearía una colección, es decir, se seleccionaría el contenido completo del buzón que sería descargado:


Detalle de la Colección

En este punto, se crearía un conjunto de revisión que sería asignado a la colección anteriormente definida:


Creación de Conjunto de Revisión


Asignación de Conjunto de Revisión a Colección

Y, finalmente, se generaría el archivo de exportación forense:

 

Exportación de la información


Una vez generada la exportación, se procedería a su descarga.


Descarga de los resultados


Una vez descargado, este ya sí, mantiene su integridad y, por tanto, garantiza su hash en el tiempo.

Conclusión

Lo más importante en un informe pericial es ser claros, garantes y concluir sin lugar a duda, que nuestras premisas son las correctas. Es cierto que se puede garantizar la inmutabilidad del contenido de una evidencia aun modificándose su firma hash, pero si podemos evitarlo, en este caso, contratando una nueva licencia, nos ahorraremos explicaciones y preguntas durante la ratificación en la sede judicial. Por tanto, antes de comenzar un análisis forense de Office 365, aseguraos de que vuestro cliente cuente con una licencia de tipo E5 a la que pueda daros acceso, o, de lo contrario, el tema puede que os de algún que otro quebradero de cabeza.


Juan Antonio Calles, CEO de Zerolynx

Jorge Escabias, Responsable de Seguridad Ofensiva

Mauro de Croce, Analista de Ciberseguridad

Digital Forensics of emails in Microsoft Office 365

Context

The advancement of the cloud and the automation of processes in companies are leading Microsoft Office 365 to spread unstoppably, replacing traditional installations of Exchange that required greater maintenance and control. However, the cloud brings changes, and we have to adapt to a host of new settings, new ways to do things and new licensing modes. 

From a forensic point of view, experts had different options to present an expert opinion attesting to the existence of certain emails within a mailbox. Among other outstanding options —and according to the principle of always "cloning" the largest container—, we could access Exchange to export the user's mailbox, we could clone the mail server itself, or even, the hard disk of the user's own PC from which then the PST would be extracted. However, this is changing. Servers are now in an external provider: Microsoft (as was already the case if we had contracted a hosting in SaaS mode), and users are getting used to using Office 365 from their browser. Under these circumstances, how could we clone an email inbox while fully guaranteeing forensic integrity? Keep reading to find out! 

Introduction

In Zerolynx we carry out forensic expert reports every month, mainly derived from clients who call us after having suffered a CEO Scam, with the aim of, on the one hand, analysing the security breach that has led to the interception of the mail to try to tackle the issue, and, on the other hand, to facilitate the prosecution of the case and the potential recovery of the money. But we will talk about these cases in another article, today we want to focus only on Office 365. 

The first thing we need to know is that Microsoft has different licensing modes, depending on the number of tools and functionalities included. Advanced security is only included in the E5 suite. Please, keep this in mind, because later we will return to this detail.

 


Most of the companies that work with Office 365 have E1 or E3 suites, which usually cover almost all the needs of organizations. 

Problem

When Zerolynx started performing forensics in Office 365, we kept working as usual, cloning the computers of the users where their mailboxes were synchronized (within the Outlook client), but then we came up with a forensic case where this was not possible. Omitting the complexity of the case, which does not provide any further detail to contextualize the article itself, we referred to the Office 365 compliance centre with a user with the corresponding privileges provided by the client. Our aim was to access, freeze the mailbox to have a full and unalterable copy that guaranteed that we would always get the same hash signature, and download it. 

Below, we briefly show the mailbox downloading process, widely documented in multiple articles on the Internet. .

 

Mailbox selection


Details of results


Exporting information


Downloading the results


Once the PST was downloaded, we then signed the file, obtaining the corresponding SHA256 hash. And, as a regular habit in forensics to ensure integrity, and as a good habit, we downloaded it again and re-signed it to verify that the process was working correctly, so that, in case of issuing a second report, the future extraction would be identical to the current one. To our surprise, despite having the mailbox apparently immobilized, the hash did not match. What was happening? Although we were more or less clear about what was going on, we opened a case with Microsoft, and we took the opportunity to discuss the issue in parallel with other MVPs who, like us, are regularly dealing with these technologies. A few days later we got the following answer:

 



Yes indeed, contrary to what you might think, Microsoft modifies the files in real time during each download, adding certain bytes that alter their content, and, therefore, their hash. Thus, it is not possible to download an entire mailbox while maintaining its integrity. 

Under these circumstances and with some lateral thinking, the situation could still be justified in the expert report: the technological problem was reported, and, irremediably, the "msg" was extracted from the mail to be ratified itself, signing (even if it were the latter) in order to evidence that the same hash would be obtained if extracted in a future download. But, once again we got a surprise: the msg were not whole either, and they also included certain new bytes with each download.  

Hence, there was only one solution left, and it is the one that Microsoft gives as a response: acquire a E5 license, which, with the Advanced eDiscovery option, does allow to generate an "online" hash and guarantee said hash during downloads. 

Formerly, the companies specialising in forensics were the ones who had to acquire the necessary tools to perform cloning and analysis, but, with the new approach to the cloud, everything is oriented to customers who now have to buy these tools and give us investigators access so we can work. 

Here follow some of the screenshots of the process so that you can see how the hash would be generated with an E5 license.

 

Access to Advanced eDiscovery


Case creation


Subsequently, a suspension of the mail account would be created to preserve the contents of the mailbox in its entirety.


 Suspension of mail account


Selected Account Suspension Detail and Date Filters

A custodian would then be assigned to the case:


Custodian Assignment


Later, a collection would be created, that is, the complete content of the mailbox to be downloaded would be selected:


Collection Detail

At this point, a review set would be created that would be assigned to the previously defined collection:


Creation of Review Set 


Assignment of Review Set to Collection 

And finally, the forensic export file would be generated:

 

Exporting information 


Once the export has been generated, it would be downloaded.


Downloading the results


Once downloaded, it maintains its integrity and, therefore, guarantees its hash over time.

Conclusion

The most important thing in an expert report is to be clear, to be sure and conclude without a doubt that our premises are the right ones. It is true that the inalterability of the content of an evidence can be guaranteed even if its hash signature is modified. But if we can avoid it, in this case, by contracting a new license, we will save explanations and questions during ratification in court. Therefore, before starting an Office 365 forensic analysis, make sure that your client has an E5 license you have access to, or, otherwise, the issue may cause you some major headaches.