Personally, I am happy to see no critical and zero-day issues have been found, no immediate action on Tuesday night this time 😊. However, these are still important security updates so you must install them as soon as possible.
These Security Updates are only available for the Exchange versions mentioned above. If you are on an older version of Exchange, you must first upgrade your Exchange servers to the latest CU and then deploy these Security Updates. Security Updates are cumulative, to a Security Update contains all previous fixes for this specific Cumulative Update.
A couple of remarks:
If you are running Exchange Hybrid, even if you have all your mailboxes in Exchange Online and use the on-premises Exchange server only for management purposes, you still must deploy these Security Updates on the Hybrid Server. If you have an Exchange management server (with only the management tools installed) you do not need to install the Security Updates.
Start the Security Update from a command prompt with elevated privileges. If you do not use elevated privileges, setup will fail and leave your Exchange server in an unknown state. Known problems here are with OWA and EAC. This does not apply when installing the Security Update using Windows Update or WSUS.
When the installation of the Security Update has finished it does not ask for a reboot although this is needed, so reboot the server when finished.
There we go again…. Last week there has been some rumor going on about pwn2own 2021, some kind of security contest to find any security issues in software products and according to this statement taken from the pwn2own site, vulnerabilities were found in Exchange:
“SUCCESS – The DEVCORE team combined an authentication bypass and a local privilege escalation to complete take over the Exchange server. They earn $200,000 and 20 Master of Pwn points.”
Today Microsoft released security updates for Exchange 2013, Exchange 2016 and Exchange 2019 that addresses security vulnerability found recently. The following Remote Code Execution vulnerabilities are fixed with these updates:
At this moment no active exploits using these vulnerabilities are reported.
These vulnerabilities only concern Exchange 2013/2016/2019 on-premises. Exchange Online is not vulnerable because of its different architecture. Please remember that Exchange Online uses a different codebase.
Updates are specific for Cumulative Updates, an update for CU9 cannot be installed on CU8. The CU version is in the name of the update.
Updates are cumulative, so these updates also contain all previous updates for this CU versions.
If you are running Exchange hybrid you need to update the hybrid servers as well, even when all mailboxes are in Exchange Online.
Previous mitigation scripts like EOMT will not mitigate the April 2021 vulnerabilities.
Start the updates from a command prompt with elevated privileges. If you do not, the update can finish successfully (or report no errors) but under the hood stuff will break. When updating from Windows Update there’s no need to use elevated privileges.
Use the Exchange Server Health Checker script (available from Microsoft Github) for an inventory of your Exchange environment. The script will return if any servers are behind with Cumulative Updates and Security Updates.
If you are unlucky and your Exchange server is infected because of the HAFNIUM zero-day vulnerability, you must nuke your Exchange server and rebuild it. And I already got the first questions on how to do this. It is not that difficult and does not take days of time if some prerequisites are met of course.
Note. This blog was written with the HAFNIUM infected machines in mind, but from a procedural point of view it can be used for every disaster recovery scenario of course. Also, I used Windows 2012 R2 and Exchange 2013 for this blog, but this procedure can also be used for Exchange 2016 and Exchange 2019.
Basically, what happens is that the old server is forcibly removed (shutdown, delete VM) but that the computer account in AD is not deleted but reset (shown in screenshot below). A new server is built, same OS, same patching, same configuration, same computername and joined to the domain. This way the SID will remain the same, which makes recovering a lot easier.
Rebuilding Windows server including all prerequisite software and Windows patches will take most of the time in this entire process.
You must use the same server version when rebuilding the server. So, if you old server was running Windows 2012 R2, then you MUST use Windows 2021 R2 again. If you try different, bad things will happen.
Exchange is a bit more flexible these days. You can use the /RecoverServer option with a newer Cumulative Update. For example, when your old server is running Exchange 2016 CU11, you can do a /RecoverServer with Exchange 2016 CU19. The only drawback here is that the CU11 version information is stored in Active Directory, and even when CU19 is used, it will show up as CU11 for the AdminDisplayVersion. But that’s cosmetic and will automatically be corrected the next time a new CU is installed.
What you CANNOT do is use /RecoverServer to upgrade to a newer version of Exchange, like upgrading from Exchange 2013 to Exchange 2016. Again, bad things will happen.
Storage with Mailbox database need of course to be kept. If configured on separate disks of VHD’s you must connect these to the new server. Use the same drive letters or mount points. In the screenshot below the old disk with the Mailbox database is mounted to the new VM with Windows 2012 R2. Exchange 2013 is not yet installed on this server.
Note. Instead of my approach (connecting the existing storage) it is also possible to recover the server and restore the mailbox database later from backup. This can range from any backup application to a file level backup of your .EDB file. The latter needs extensive knowledge about the Mailbox database internals and how to deal with that.
When Windows is up and running it is time to install the server. Use the same Cumulative Update for this and use the unattended setup of Exchange with the RecoverServer option. Open a command prompt with elevated privileges and execute the following command:
Z:\ in this case is the DVD drive letter, but you can use a different drive letter of course.
There’s one catch here. If Exchange is installed in a different location, for example on the D:\ drive, you must use the /TargetDir option to specify the location where the Exchange binaries must be installed.
The /RecoverServer will retrieve all configuration information from Active Directory (instead of using the default settings) and install Exchange using this configuration. For example, all Mailbox database information is stored in Active Directory, so when setup has finished, the ‘new’ server has all the correct Mailbox database information. Even better, after a reboot it will even automatically mount the Mailbox databases.
Some settings are not stored in Active Directory, especially when looking at server specific configuration that are stored in local .config files. OWA customization and SSL Certificates for example that are configured on the server are lost. So, existing documentation of the Exchange server is vital here to quickly rebuild the Exchange server.
After reinstallation, the server was rebooted, I had to mount the Mailbox database manually (but without issues). The following settings I had to configure manually:
Import the SSL certificate and bind it to the Exchange services.
Set the Exchange Virtual Directories (I did not expect this one).
Relocate the SMTP Queue database.
To my surprise the SMTP relay connector that was configured on the Exchange server was available instantly and working correctly.
If you have to rebuild your Exchange server, whether it be it crashed or got infected or something, you can use the Setup.exe /RecoverServer option of Exchange (Exchange 2013 and up). This will retrieve a lot of the information from Active Directory, and if you have the Mailbox databases available you can use these directly without any restore from backup activities.
There are some settings that are still manually configured after the server is recovered, so proper documentation is important to have to make life much easier when recovering.
Last week Microsoft discovered a zero-day vulnerability for Exchange (which was initially detected by security companies last January) and an urgent patch was released. Unfortunately this patch is only available for recent versions of Exchange 2019 and Exchange 2016 and the last version of Exchange 2013. If you have an older version of Exchange running you have to bring it to the latest Cumulative Update first and then deploy the Security Update.
There are some mitigation rules available though:
Exchange server that are not available on the Internet are much less vulnerable (ok, this is an open door, I know). I have two customers that have their Exchange servers available only via a VPN connection. This works well from a security perspective.
Microsoft also posted a number of mitigation rules on the Microsoft Security Response Center Blog. These mitigation rules are temporary though and should only be used until the Exchange servers are fully patched. Mitigation rules are an IIS Re-Write Rule, disabling UM services and disable OAB en ECP Application Pool.
When you run the script it will show in seconds if something is found:
Too bad that this is a production Exchange 2016 server that was compromised.
At this moment I would recommend to turn off and remove the Exchange server and rebuild it using the /Mode:RecoverServer option of the Exchange setup application. This is documented in my next blog Rebuild your server (after HAFNIUM infection. When other (better or easier) recommendations are published I’ll update this blog.
Microsoft has detected multiple 0-day exploits being used to attack on-premises versions of Exchange Server in limited and targeted attacks. In the campaigns observed, threat actors used this vulnerability to access on-premises Exchange servers, which enabled access to email accounts, and install additional malware to facilitate long-term access to victim environments. Microsoft Threat Intelligence Center (MSTIC) attributes this campaign with high confidence to HAFNIUM, a group assessed to be state-sponsored and operating out of China, based on observed victimology, tactics, and procedures.
Because Microsoft is aware of active exploits of related vulnerabilities in the wild (limited targeted attacks), Microsoft released security updates for four different Exchange Server vulnerabilities. Microsoft strongly urge customers to update on-premises Exchange servers immediately to protect against these exploits and prevent future abuse across the ecosystem. Even though Microsoft has worked quickly to deploy an update for the HAFNIUM exploits, it is known that many nation-state actors and criminal groups will move quickly to take advantage of any unpatched systems for years to come. Promptly applying the security updates is the best protection against this attack.
To stress the importance of this issue, Microsoft conducted a series of webcasts earlier today, at least in the APAC and EMEA regions. Hand-out of the webcast is available at https://aka.ms/ExOOB.
A few remarks:
All Exchange server versions are affected and the exploit has been detected on Exchange 2013, Exchange 2016 and Exchange 2019.
If you have restricted your firewall to Microsoft only (when running Exchange hybrid) you are less vulnerable, but the risk is not reduced to zero.
Updates are available for the current CU and the CU before. If you are on an older version of Exchange, please upgrade to the current CU before you can install this Security Update. If you run a really old version of Exchange you will run into .NET Framework update issues. Please use the overview of fellow MVP Michel de Rooij: Upgrade Paths for CU’s & .NET | EighTwOne (821)
Please note that the security updates are CU specific. Also, Security Updates are cumulative, so this security update contains previous security updates as well.
Installation is straightforward, download the update from the Microsoft website (but I already saw it appear in our WSUS environment this morning) and install it. Personally I start the update from an elevated command prompt. Installation is the same on Windows 2019 server core as well as Windows 2019 Desktop Experience.
If you have Exchange servers in a DAG, don’t forget to put them in maintenance mode first. After installation the Exchange servers need to be rebooted.
More information, including CVE information can be found on: