Ticket #215 (closed defect: fixed)

Opened 1 year ago

Last modified 1 month ago

Files inclusion vulnerability

Reported by: Raphael (atomo64) Assigned to:
Priority: blocker Milestone: ispCP ω 1.0.0 - RC3
Component: Frontend (GUI) Version: ispCP ω 1.0.0 - RC2
Severity: Keywords: vulnerability,files inclusion
Cc:

Description

Explanation: When register_globals = on, it is possible to modify the included adodb scripts by using local files. The vulnerability is caused because of a non initialised variable ($include_path) which can easily be injected by passing the variable to the script from the web. Thanks to the usage of realpath() this vulnerability is limited to a local level, so only people who has enough server access to create two malicious scripts can take advantage of this bug.

Results of abuse: This vulnerability can be used to retrieve the password of the mysql account being used by the system.

Affected files: gui/include/sql.php

Affected versions: RC1, RC2. Prior versions may also be affected. It is most likely all the installations are affected because register_globals = on is required to get the files manager working due to it's bad codding.

Exploit: Opening http://domain.tld/vhcs2/include/sql.php?include_path=/path/to/directory/with/malicious/scripts Where /path/to/directory/with/malicious/ is a directory which contains at least /adodb/adodb.inc.php and /adodb/adodb-pager.inc.php Those scripts can eventually load the rest of the panel scripts and emulate the ADONewConnection and $sql->Connect functions and retrieve the password being used to connect to the sql database.

Fix: The fix used in VHCS (which isn't affected by this vulnerability) is to call $include_path = realpath(dirname(_ _FILE_ _)); right before the scripts inclusion. Even tough this is enough to fix the vulnerability, I recommend replacing the usage of include_once() in all the scripts with a simple require(). If the code is designed correctly there's no real reason to make use of require_once which in a possible files inclusion could even continue the script execution instead of stopping. An other way to prevent any other attack of this kind, I recommend on all the included files that shouldn't be called directly to verify the existence of a constant which should be defined by the script that is directly called.

Attachments

opt1180900774z.jpg (211.4 kB) - added by anonymous on 01/15/2008 07:08:50 AM.

Change History

04/24/2007 10:42:01 PM changed by malte

  • status changed from new to closed.
  • resolution set to fixed.

thx - i fixed it in r521

We'll release rc2-b now ;)

04/24/2007 11:54:42 PM changed by atomo64

  • status changed from closed to reopened.
  • resolution deleted.

before releasing, please correct the code:

$include_path = realpath(dirname(_ _FILE_ _));

should be

$include_path = realpath(dirname(__FILE__));

Since trac replaces a double underscore with the equiv of <b> I used a spaced underscore.

04/25/2007 12:36:28 AM changed by malte

  • status changed from reopened to closed.
  • resolution set to fixed.

typo is fixed r215

04/25/2007 12:42:29 AM changed by Raphael

talking about typos... the right revision is 522, not 215 ;-)

04/25/2007 12:44:27 AM changed by malte

damn you're right have to sleep more :( thats me being a bit tired & mad

07/07/2007 03:35:05 AM changed by anonymous

08/01/2007 08:37:48 AM changed by anonymous

08/01/2007 09:29:53 AM changed by anonymous

08/28/2007 06:35:58 AM changed by anonymous

01/15/2008 07:08:50 AM changed by anonymous

  • attachment opt1180900774z.jpg added.

04/03/2008 04:35:33 AM changed by cialis

<a href="http://groups.google.com/group/cialis-20">buy cialis</a>


Add/Change #215 (Files inclusion vulnerability)




Action