CVE-2020-0688: Remote Code Execution on Microsoft Exchange Server
Microsoft Exchange Server installations used the same static cryptographic keys for ViewState validation and decryption, allowing an authenticated attacker to craft malicious ViewState data that the server would deserialize, leading to remote code execution as SYSTEM.
thezdi.com
Published on thezdi.com
This most recent Patch Tuesday, Microsoft released an Important-rated patch to address a remote code execution bug in Microsoft Exchange Server. This vulnerability was reported to us by an anonymous researcher and affects all supported versions of Microsoft Exchange Server up until the recent patch.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Exchange Server failed to generate unique cryptographic keys per installation, using the same static validationKey and decryptionKey in web.config for all installations.
Impact
An authenticated attacker could execute arbitrary code as SYSTEM and fully compromise the Exchange server, potentially divulging or falsifying corporate email communications.
What the attacker needed
Authenticated access to Exchange (any user account)
The fix
Microsoft fixed the vulnerability by randomizing the cryptographic keys at installation time.
How it was found
- Log in to the Exchange Control Panel at /ecp/default.aspx with any account.
- Use browser developer tools to capture the raw response and find the __VIEWSTATEGENERATOR value and the ASP.NET_SessionId cookie.
- Generate a malicious ViewState payload using ysoserial.net with the known validation key, algorithm, generator, and session ID.
- URL-encode the ViewState payload and construct a URL with the __VIEWSTATEGENERATOR and __VIEWSTATE parameters.
- Submit the URL to the server, which deserializes the ViewState and executes the embedded code.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
ViewState is a way for ASP.NET web applications to store data on the client and send it back to the server. The server uses secret keys to ensure the data hasn't been tampered with. Because every Exchange server used the same keys, an attacker who logged in could create their own malicious ViewState data that the server would trust, and when the server processed it, it would run the attacker's code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.