Default PHP installation causes System Vulnerabilities

Source: Internet
Author: User


This vulnerability was published in packetstorm. I converted it into Chinese and added some annotations to execute it on NT.
PHP friends have some help.

After you download PHP, the installation file in it helps PHP install in NT + Apache Web Server
The installation help will require you to add the following lines to the httpd. conf configuration file of apache.
It will guide you to open your System Portal.

The command lines are as follows:

ScriptAlias/php/"c:/php /"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php.exe"

We will further explain these three settings. These settings commands require Apache to directly map the/php/virtual directory to c:/php/
Directory, so when you use:

Http://www.example.com/php"

When you link a webpage, the Web Server directly accesses the c:/php/directory. At this time, you will see "Access Denied"
But when you use:

Http://www.example.com/php/php.exe"

Command to connect, you will find that the server sent back the "No input file specified." line, this line of words is by php.exe
The returned message indicates that you have just executed the php Execution file on this server.

If your server is configured using the installation method taught in php, you may have the following crisis.

[** Vulnerability 1 **]

We can exploit this vulnerability to read any file on this server, or even read it across disks, as long as the connection is as follows:

"Http://www.example.com/php/php.exe? C: \ winnt \ repair \ sam"

PHP will throw the file "c: \ winnt \ repair \ sam" to the browser and display it. This file is exactly Windows NT
Save the password,

"Http://www.example.com/php/php.exe? D: \ winnt \ repair \ sam"

PHP will output the same file in D: disk.
With this SAM file, hackers can crack the password you set on this machine.

[** Vulnerability 2 **]

If you specify a file in the php Directory, your Web server will attempt to execute this file and send an error message, so when you
Used:

Http://www.example.com/php/php4ts.dll"

This error will cause the Web Server to return "couldn <|> t create child process: 22693: C:/php/php4ts. dll"
This information leaks the real directory of your PHP installation.

PS. After my tests, the second vulnerability will return the "Internal Server Error" Error when executed on PHP V4.11,
The directory structure is not leaked, but the first vulnerability is still valid in PHP V4.11.

Simple Solution: Use a long and difficult-to-determine virtual directory to place PHP Execution files, for example:

ScriptAlias/php-mY-sCrIpT/"c:/php411 /"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php-mY-sCrIpT/php.exe"

In this way, intruders will not be able to learn about the directory where PHP is stored, thus reducing the chance of intrusion.
After changing httpd. conf, remember to restart Apache Service:

NET STOP APACHE
NET START APACHE

[END]

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.