Code to Trigger MS14-066 ECDSA Server BOF Vulnerability

Microsoft recently released a patch for a critical vulnerability in Microsoft Secure Channel (aka Schannel).  This vulnerability is being referred to as MS14-066.

A description of how to trigger the MS14-066 ECDSA Heap Buffer Overflow vulnerability was posted by BeyondTrust, which also explained the research method used in narrowing down where this vulnerability presented itself.  Their article mentions leveraging the OpenSSL s_client to authenticate to an IIS server, and by patching the s3_cInt.c file to fuzz the particular code path they were able to trigger a crash in memcpy.  (BeyondTrust’s research team is to be thanked for saving others in our community a lot of work and time!)

Our researchers were able to write a demonstration program by patching the OpenSSL 1.0.1 source code to trigger this specific vulnerability and show how this could be used for exploitation.

The diff output is provided below:

You can change the rlen and slen easily and send the packet via OpenSSL s_client to an unpatched IIS server.

The following is WinDBG output showing the entry into the schannel function iCM_DecodeSigAndReverse:

image 1

Figure 1: Debugger output showing entry into schannel iCM_DecodeSigAndReverse function.

There are two vulnerable memcpy function calls.  At each memcpy we can see that the size matches the rlen and slen sized in the patched OpenSSL code above which means a remote user can control the size passed into those functions.

image 2

Figure 2: Debugger output showing memcpy rlen and slen manipulation.

The heap has been overflowed and a code 0xc0000005 (Access violation) has been generated due to an invalid memory dereference.

image 3

Figure 3: Debugger output showing the resulting heap overflow access violation.

Palo Alto Networks has released threat signatures 37057-37061 to protect against this vulnerability.  Our protocol decoder-based analysis statefully decodes the protocol and then intelligently applies signatures to detect vulnerability exploits.

Our Advanced Endpoint Protection system will also protect against this vulnerability by using an innovative approach to prevent known exploitation techniques that allow an attacker to gain control of the system. Learn more about Advanced Endpoint Protection here.