applied security research
Rik van Duijn - 19 aug 2021

Office 365 audit logging

It’s important to enable audit logging for o365 even if you are not monitoring them actively. Atleast if you get hacked there’s logging to investigate :). The audit log is not always enabled by default, it seems to rely on license levels. However there are some important things to take into consideration.

You can enable the unified audit log and be done. However there are some things to take into consideration. Especially when it comes to mailbox operations and logging. Office 365 audit logging can be tricky to manage. There’s some things you need to be wary of when relying on the o365 logging. Essentially we need to make sure Unified Audit log is enabled and the mailbox audit settings are set correctly.

Unified Audit log

The unified audit log is a combination of logging from SharePoint, Exchange Online, Teams and more. If you use o365 just make sure to enable it. It can be checked using “Get-AdminAuditLogConfig | FL UnifiedAuditLogIngestionEnabled”. Enabling can be done via: “Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $true”

Audit log settings

Make sure you can detect any modifications to the UnifiedAuditLogIngestionEnabled setting.

Mailbox Audit settings

Mailbox Audit settings describe which operations on the mailbox are logged. Unfortunately we cannot set a standard set of operations that are logged for every mailbox. This forces the administrator to set them per user. After a new mailbox is created we need to set which mailbox operations are logged. Which audit operations are set seems to depend on the license level (business vs e3 vs e5).

Let’s say we create a new user the following auditoptions are set:

Checking mailbox audit settings

The different operations are documented here:

https://docs.microsoft.com/en-us/microsoft-365/compliance/enable-mailbox-auditing?view=o365-worldwide

There are three different types of operations:

  • Owner: The owner of the mailbox.
  • Admin: Mailbox accessed via Content search, eDiscovery or Microsoft Exchange Mapi Editor.
  • Delegate: Sendas of sendonbehalf users actions or an admin who’s using the mailbox.

After creation of a new user some operations related to the user’s mailbox will not be logged by default. The following are interesting:

  • Owner: MailboxLogin
  • Delegate: Folderbind
  • Admin: Folderbind

Folderbind: “A mailbox folder was accessed. This action is also logged when the admin or delegate opens the mailbox.”

Mailboxlogin: “The user signed into their mailbox.”

If we dont change anything and log into a mailbox and create a mailbox rule the following logs are created:

Default logging after account creation.

If we enable the MailboxLogin operations we can see the login operation and perfoming another, unrelated, action:

Logging after we enable audit on all mailbox operations.

Note: keep in mind that mailboxlogins != azureAD logins. So accessing other resources then mail will not be logged by these settings. Those logs are paywalled by AzureAD p1/p2 licenses. AzureAD can be bought separately but is also included in e3/e5 licenses.

Subverting logging

Attackers can try to subvert logging in order to obfuscate their actions.

Unsetting auditoptions to prevent logging

It’s possible to unset all audit operations for a specific mailbox. Doing so will result in less logs however not all log operations will be hidden. After setting every audit option to zero we can still see mailbox rules being created and auto forwarding being set.

“Set-Mailbox -Identity [email protected] -AuditEnabled $true -AuditOwner @()  -AuditDelegate @() -AuditAdmin @()”

We can verify the audit settings are set to nothing:

All audit operations set to null.

The mailbox login is not logged, but rule creating and forwarding being set on the mailbox are. It seems there’s always a default set of items being logged. It’s not quite clear to me from available documentation what is in that default set, but I guess it’s based on the type of license the user is assigned.

Logs after unsetting audit options.

Set-MailboxAuditBypassAssociation

Mailbox Audit Bypass according to the documentation should prevent activities from being logged. It’s a technique that has been described in the BlackHat talk: “Cloudy with a chance of APT”.


I tried setting the bypass on our test mailbox. Surprisingly, Audit logging kept coming in. I’ve asked one of the authors of the talk and it seems they’ve seen similar behavior. Still it’s smart to keep track of the bypass association..

Attic and logging

Within the Microsoft365 module in Attic a tenant is monitored for different logging factors including the capability to automatically fix issues (pending user approval). In relation to audit logging we monitor the following

The following fixes exist:

  • Enable unified audit log
  • Correctly set mailbox audit settings

Want to know what it is we check and fix? Check our checks and fixes here. Or buy a subscription here.

Future work

  • Detect license downgrade as described in the BlackHat talk “Cloudy with a Chance of APT” By Doug Bienstock and Josh Madeley. https://www.slideshare.net/DouglasBienstock/bhusa-2021-cloud-with-a-chance-of-apt
  • Figure out if AdminAuditLogExcludedCmdlets actually works, would be shitty to miss Set-MailboxRule or something like that.
  • Create a fix to unset any Auditbypass. Not hard: Get-Mailbox -ResultSize Unlimited | Set-MailboxAuditBypassAssociation  -AuditBypassEnabled $false
  • currently working on an automated rollout of Sentinel including the OfficeActivity/AzureActivity connectors
  • Figure out if setting AdminAuditLogEnabled to false is possible and results in no logging
  • Investigate what is logged once a Graph app interacts with mailboxes

Blogs

Public SharePoint sites - the new open shares

Wesley Neelen - 16 sep 2021
During one of our engagements we were investigating a Microsoft 365 environment. My colleague Rik discovered that many SharePoint sites were publicly available within the organization. We were surprised by the amount sites that were wide open this way. A lot of sensitive information was located on those sites, for example PII-information and passwords for […] Lees verder

Decrypt passwords from Xerox Workcentre config backups

Rik van Duijn - 29 aug 2021
During a recent engagement we encountered Xerox WorkCentre printers using default credentials (admin:1111). Usually it’s just another finding, but this time we noticed the printer had SMB and e-mail credentials configured. For LDAP we usually point the printer to our own IP and get access to the plaintext creds that way. But in the case […] Lees verder

Office 365 audit logging

Rik van Duijn - 19 aug 2021
It’s important to enable audit logging for o365 even if you are not monitoring them actively. Atleast if you get hacked there’s logging to investigate :). The audit log is not always enabled by default, it seems to rely on license levels. However there are some important things to take into consideration. You can enable […] Lees verder

Ransomware, nationale crisis?

Erik Remmelzwaal - 04 aug 2021
Als er 1 digitale dreiging is die veel in het nieuws komt, dan is het ransomware. Er wordt zelfs gesproken van een nationale crisis. Lees verder

Mijlpalen en hoe het gaat

Zolder B.V. - 02 jul 2021
Vandaag gebeurden er op Zolder toch een paar dingen die blogwaardig zijn. Dus prima aanleiding om nog maar eens de laptop open te klappen en te vertellen hoe het gaat. Nieuwe collega’s Het is 1 juli 2021 en we zijn ruim een jaartje onderweg als Zolder. De belangrijkste stap die we vandaag zetten, is dat […] Lees verder

Zolder wordt hoofdsponsor HCZ

Zolder B.V. - 01 jul 2021
Vandaag is bekend geworden dat Zolder de nieuwe hoofdsponsor is van HCZ – Hockeyclub Zevenbergen. De komende drie seizoenen zal het logo van Zolder daarom voorop de shirts van alle HCZ leden prijken. We zijn heel erg trots op deze nieuwe stap voor ons jonge bedrijf, en hopen zo de relatie met onze regio te […] Lees verder

Breda Robotics

Erik Remmelzwaal - 10 mei 2021
Zolder BV is toegetreden tot het netwerk van Breda Robotics. Deze vereniging brengt organisaties bij elkaar die actief zijn rondom robotisering in de regio West-Brabant. Voor Zolder geeft Breda Robotics de mogelijkheid om samen te werken met de robotiseringsindustrie. Te begrijpen hoe die sector precies werk en op welke vlakken cybersecurity kennis kan worden ingezet […] Lees verder

27% .nl domeinen slecht beschermd tegen spoofing

Erik Remmelzwaal - 29 apr 2021
TLDR: We scanden de DNS records van 1,6 miljoen .nl domeinen en vonden uit: 9% is rechtstreeks gekoppeld aan Microsoft 365, daarmee is Microsoft veruit de grootste Google is nr2 en heeft 4% van de domeinen aan zich verbonden, nagenoeg gelijk aan een aantal andere spelers. Van alle mail-enabled domeinen heeft 27% geen SPF record […] Lees verder

Zolder biedt MKB betaalbare en eenvoudige security-app

Zolder B.V. - 12 apr 2021
“Attic voorkomt dat security een luchtbel wordt” Security is bij mkb-bedrijven vaak het ondergeschoven kindje. Ze hebben er de mensen en het budget niet voor. Dat maakt deze doelgroep een aantrekkelijk doelwit voor cybercriminelen. Voor de vier doorgewinterde cybersecurity-experts van start-up Zolder reden om Attic te introduceren. Deze eenvoudige, goedkope en toekomstbestendige app maakt mkb’ers […] Lees verder

Nieuwe Themesong voor Zoldersessions

Erik Remmelzwaal - 13 mrt 2021
Ik vond het tijd worden voor een nieuw liedje voor onze Zoldersessions. Tot nu toe hadden we er een rechtenvrij liedje onder staan, namelijk EVA_失望した, maar wilden toch iets meer 'eigens'. Daar schakelden we Bjørgen van Essen voor in met dit eindresultaat. Dit is hoe dat tot stand kwam. Lees verder

Zolder.App Open Beta

Zolder B.V. - 02 feb 2021
We launched the final beta release to the Google and Apple appstores. Any business running on Microsoft 365 is more than welcome to join. As a beta-tester you will receive a free subscription to the Zolder.App Premium Plan for the remainder of the beta phase, which is scheduled to run through April 30th 2021. Zolder.App […] Lees verder

GGD data is topje van ijsberg

Erik Remmelzwaal - 26 jan 2021
Maandag kwam RTL Nieuws, na onderzoek van Daniël Verlaan, naar buiten met het nieuws dat gestolen data van de GGD online wordt verhandeld door criminelen. Het gaat om data die onderdeel uitmaakt van het bron- en contactonderzoek dat de GGD uitvoert als onderdeel van de bestrijding van Corona/COVID-19. De data bevat gevoelige persoonsgegevens en criminelen […] Lees verder

#CES2021 - We Are Ready!

Erik Remmelzwaal - 06 jan 2021
We are very excited to be part of the #CES2021NL mission! Meet us at CES (Januari 11-14) in our online booth 10609 and see how we solve global challenges with NLTech. Erik Remmelzwaal, Co-Founder & CEO Yes I indeed think we are ready for CES. At this virtual event we will showcase Zolder.App. I am […] Lees verder

Zolder.App Blog 3 - Feedback

Erik Remmelzwaal - 27 nov 2020
Bij het ontwikkelen van een nieuwe dienst, zeker als dit Software-as-a-Service betreft, is feedback vanuit (potentiële) afnemers cruciaal. In het geval van Zolder.App is de doelgroep het MKB. We zijn al gelijk na lancering van het merk Zolder gestart met het vinden van MKB-ers die als tester wilden helpen. Oproep 19-apr-2020 Dit leidde tot best […] Lees verder

Azure App Consent Policies

Rik van Duijn - 11 nov 2020
OAuth consent phishing has been on the rise for a while now. Unsurprisingly, Microsoft has gradually introduced measures to protect from this type of attack. Latest: Risk-Based Step-Up Consent. Lees verder

Honeytokens using Azure Keyvaults

Rik van Duijn - 15 okt 2020
In 2017 Wesley and I gave a presentation at SHA2017 about honey/pot/tokens. We actually planned on building a fully fledged platform. But never came further then the POC phase of that project. This week we got a product demo from the guys at Thinkst, i’ve always loved this way of thinking: let the attacker come […] Lees verder

Zolder.App Blog 2 - Probleem & Oplossing

Zolder B.V. - 08 okt 2020
Het is best een goed idee om voordat je begint met het bouwen van een product of dienst, te weten welk probleem je ermee gaat oplossen. Voor Zolder.App: we lossen het probleem dat MKB-ers slecht beveiligd zijn op door enterprise-niveau security voor hen toegankelijk te maken. In feite zijn er een aantal problemen die we […] Lees verder

Risk of exposed home automation services

Wesley Neelen - 24 sep 2020
At home, I am automating many things for fun. Currently I am using Home Assistant, an incredibly powerful piece of software for automating your home. Regularly I am combining the home automation experiences with security. Home automation is often related to physical things such as changing lights, moving curtains, opening door locks or turning the […] Lees verder

Zoldersessions Studio Setup

Zolder B.V. - 27 aug 2020
Here is the kitlist which we end up with to record our Zoldersessions 🙂 Audio Input 4x Rode Procaster microphone 4x Triton Audio FetHead Microphone PreAmp 4x YellowTec m!ka Mic Boom Focusrite Scarlett 18i8 3rd gen Audio Output 4x Shure SRH840 Headphone ART HeadAmp 4 headphone amplifier Video Input 2x Sony Handycam main cameras Logitech […] Lees verder

Zolder.App blog 1 - het idee

Erik Remmelzwaal - 27 aug 2020
Op Zolder bouwen wij aan een mobiele app die MKB’ers op een baanbrekende manier moet helpen digitaal weerbaar te zijn. We verwachten in het vierde kwartaal van 2020 de app te kunnen lanceren. In deze blogreeks neem ik je mee in de ontwikkeling van Zolder.App. Eigenlijk was er niet 1 idee, maar is Zolder.App het […] Lees verder