Failed patches: Getting paid twice is nice

Back in my ZDI contribution days, I always had a big question in mind, “What product should I audit?”

 

Of course, it stinks for a researcher to spend weeks auditing a certain product for bugs and in the end he/she gets a “not interested in the product” email.

 

To avoid disappointments, I tried as much as I could to target well-known vendors. Besides well-known vendors, I used to look at the “Upcoming” section in the ZDI website and check for vendors that interest ZDI.

 

One product that matched the “well-known vendor” category was Citrix. So, I started checking the applications available for download from their website. One of the products that I checked was Citrix Provisioning Services.

 

Citrix Patch Fail

Initially, I found a remote code execution bug in the streamprocess.  Citrix put out a patch as ZDI-11-023.  But the fun for me, was finding that the patch actually failed to fix the problem. I won’t cover the steps that I took to find the bug, I’ll just highlight the problem quickly. Here’s the initial bug that I found (from the report that I submitted to ZDI back then):

MOV  EDI,DWORD PTR DS:[ECX]

ADD  ECX,0C

MOV  DWORD PTR SS:[EBP-C], ECX

CMP  EDI,DWORD PTR SS:[EBP+8]

JA   SHORT XXXXX

PUSH EDI

MOV  EDX,ECX

MOV  ECX,ESI

CALL COPY_FUNCTION_

 

Basically, if you bypassed that CMP, the copy function will copy your buffer blindly to the stack. Eventually, Citrix “fixed” this bug and released version 5.6 sp1. Here’s what actually happened with the patch:

image 1.PNG

 

Bright. :)

 

The problem is that there is no NULL check here.  This allows us to put the zero back into this zero-day.

By supplying a NULL value, it bypasses the JA instruction and the LEA instruction will load 0xFFFFFFFF into EAX causing the overflow to still occur.  Patch fail.

 

When the execution reaches wcsncpy() the stack  would look like this:

image 2.PNG

 

The results looked like this:

image 3.PNG

 

And eventually, looked better:

Image4.PNG

 

This was reported to Citrix by ZDI. And Citrix addressed the bug correctly, the second time, as ZDI-13-018.  :)

 

I got paid for the initial bug and ZDI paid me for finding the patch bypass, as well.

 

A guest post by Abdul Aziz Hariri

HP ESP Senior Security Researcher

 

Leave a Comment

We encourage you to share your comments on this post. Comments are moderated and will be reviewed
and posted as promptly as possible during regular business hours

To ensure your comment is published, be sure to follow the Community Guidelines.

Be sure to enter a unique name. You can't reuse a name that's already in use.
Be sure to enter a unique email address. You can't reuse an email address that's already in use.
Type the characters you see in the picture above.Type the words you hear.
Search
Showing results for 
Search instead for 
Do you mean 
About the Author
Featured


Follow Us
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.