Audit Exchange 2007 SP2 Auditing
There have been a few cases that have been coming through the support channels stating that auditing is not working for whatever reason. After reviewing the cases, we have found that this is due to users or groups in the Configuration Partition of Active Directory that have been granted Full Access to the containers in the tree or having the All Extended Rights permission. Having these permissions will essentially bypass any auditing events from occurring.
Let’s take a step back for a moment. When applying Exchange 2007 SP2 in an organization, the schema is extended with the right ms-Exch-Store-Bypass-Access-Auditing. If a user previously has been granted Full Control within the Configuration tree, that user or group will then take on an allow right for this Bypass auditing right, thus being exempt from being audited. This is not good for compliance reasons and the end results will not contain audit entries for all users that can/will be accessing mailboxes.
The other problem is that there is currently no way to lock down the ability for any administrator to add a specific Allow on an object in Active Directory for this bypass right, thus excluding them from being audited.
Listed below are the *default* groups that have the Bypass Auditing right due to various permission settings:
- Domain Admins
- Enterprise Admins
- Exchange Organization Administrators
Once the Schema has been extended, there are 5 places to add auditing bypass entries in the configuration container in Active Directory as shown below.
- Exchange Organization Container
- Exchange Administrative Group Container
- Exchange Servers Container
- Exchange Server object
- Exchange Database object
When auditing is not working as expected, it would be a rather tedious process to check permissions throughout the configuration tree for these objects where the bypass extended right has been set. I have created a powershell script (AuditBypassPerm.ps1) that should help export permissions for each of these objects to make your job finding permissions problems that much easier.
Before I go over the script, I want to describe some of the terms that you will need to know when looking through the output of this script. Objects in Active Directory can be assigned using Access Rights using System.DirectoryServices.ActiveDirectoryRights[]. These Access rights control what type of permission a user or group has on a particular object. A listing of all the available Access rights can be found at https://msdn.microsoft.com/en-us/library/system.directoryservices.activedirectoryrights.aspx.
The three main rights that we are concerned with relationship to this auditing are the following:
ms-Exch-Store-Bypass-Access-Auditing = Bypass Exchange Access Auditing in the Information Store
GenericAll = The right to create or delete children, delete a subtree, read and write properties, examine children and the object itself, add and remove the object from the directory, and read or write with an extended right.
ExtendedRight = A customized control access right. This can be used to specifically apply a particular right such as ms-Exch-Store-Bypass-Access-Auditing or this could mean that you may have an allow right for All Extended Rights as shown below. All Extended Rights mean just that, All rights including the “Bypass Exchange Access Auditing in the Information Store” right.
So with that said, these are the three main rights that we need to concentrate on when we are trying to find a needle in the haystack. The next piece that we also need to be cognizant about is whether there is a specific deny or one of the 3 rights is being inherited from some other object in the Configuration tree.
In my example, I used an account called AuditTest1 to show how one would troubleshoot something like this. I granted a deny to the bypass right at the organization level so that this users account would be audited, but then at the Database object level, I granted the All Extended Rights right for this account. What this essentially did is to bypass auditing for this user at the database level, thus logging no events for any mailbox access for mailboxes on that database.
The syntax for the script is as follows:
.\AuditBypassPerm.ps1 <MBXServername>
After running the script, you will get output similar to the following
Once the script has completed, notepad will open up a text file which will provide information similar to the below pictorial. This allows you to visually see at each of the 5 objects where we can set the bypass permissions what rights were assigned to this user.
The key takeaway here is to view what groups/accounts have the ms-Exch-Store-Bypass-Access-Auditing,GenericAll , or ExtendedRight right set on them and if it is set, to determine at what level in the Configuration Tree a potential override has been set that would prevent auditing specific accounts from being audited.
If there is an Inherited permission that you cannot view what rights has been set at each of the 5 object levels, then you will need to open up ADSIEdit.msc and then walk the tree up from that object until you find the object in which permissions have been changed.
So that sounds great, but what happens when you have a user that is not listed in the tree, but is still not being audited? The main reason for this is that this user is a part of a group that could have permission in to the tree to have one of these 3 rights.
Since Powershell V1 does not have a direct way to view a users group membership, I created another really small script to list out the groups that these users are a part of. This is not the same format that is listed above, but will help provide a general understanding of what groups the user is a part of that you can then compare to the output listed above for your troubleshooting efforts.
The syntax for the group membership script is as follows:
.\GetUserGroups.ps1 <Username>
Note: This can be in simple format or domain\username format as shown below.
These set of scripts can be downloaded here
I hope this helps untangle the inability to get auditing working for some users/groups as reviewing permissions is sometimes a very tedious task.
Another question that comes up is how do I map the Message ID that is listed in the event when accessing the message to an actual message in a users mailbox? A sample event is listed below with the relevant parts highlighted.
So from that, we can see that we have a message ID of <6B83547937704D4EB0EFA4327EF0DEC82D8F92EC36@MIKELAGDC.mikelaglab.com> and this message was opened in the folder /Calendar.
For every message on an Exchange 2007 server, we generate a unique Message ID that is stamped on the PR_INTERNET_MESSAGE_ID MAPI property of each message. This MAPI property is also equivalent to 0X1035000E.
With MFCMAPI, you can find this message rather easily by creating a content restriction in the mailbox. To do this, you would need to create a MAPI profile for that user specifically on an administrative workstation or use a MAPI profile that has full access to all mailboxes.
IMPORTANT: While going in with an administrative account performing these operations, if the message is touched in the mailbox while using MFCMAPI, an auditing event will be logged to the Exchange Auditing log. If you don’t want to log any events while doing your investigation, it may be best to logon with an approved account that has the Bypass Auditing right so that whatever actions you are taking inside a users mailbox is not audited or use an account that is specific to finding what object was audited.
Once you open the mailbox in MFCMAPI, you would then need to navigate to and open the folder that was listed in the auditing event as shown above. In this case, it was the Calendar folder. After the folder is opened, click on Table on the Menu and then select
Create an Apply Content Restriction.
Next, we need to specify what Property Tag we are looking for which in this example is 0X1035000E. Once this property tag number is entered, you will see that the Property Name field will show what we want to filter on. Click OK when you are finished.
In the Property Value field, enter <6B83547937704D4EB0EFA4327EF0DEC82D8F92EC36@MIKELAGDC.mikelaglab.com> including the < > characters as shown below. This is very important that the < > characters are entered, otherwise, the restriction will not return the message. Click OK when you are done.
The result should be the message that you are looking for.
That is all for now….
Happy Auditing!!
Comments
Anonymous
January 01, 2003
Thanks for sharing such a nice information related to Exchange 2007 SP2 Auditing and describe how Audit Exchange server . I already tried this tool (http://www.exchangeauditing.com/ ) to audit specific mailboxes and know about every happening in the exchange server.Anonymous
July 20, 2010
Mike: Great Article.. Question for you though... On technet.microsoft.com/.../ee221156(EXCHG.80).aspx there is a matrix for folder access that defines what should be set for Administrators. What would be the definition of an Administrator is this sense? Is it that the user must belong to one of the Exchange native administrative groups or is there some attribute or something that defines the admin?Anonymous
October 28, 2011
Mike, I've enabled Folder Access Auditing at Level 2 using EMS. I've excluded the BESAdmin account and everything seems to be working well. I have noticed however that around 80% of the logs are when one user accesses another users Calendar. This is not very useful. We want to know when UserA is messing around in UserB's Inbox or custom folders, I'm not really concered about users looking at each others calendars. Is there any way to exclude the Calendar folder from the Auditing in this scenario?