Default PHP installation causes system vulnerabilities

Source: Internet
Author: User
This vulnerability was published in packetstorm. I turned it into Chinese and added some annotations, hoping to help my friends who execute PHP on NT. After you download PHP, the installation file in it helps PHP install in NT + ApacheWebServer, the installation help requires you to add the following lines to the httpd of apache. the conf setting file 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.