--------------------------------------------------------------------------- Mantis Bugtracker - Remote Database Scanner and XSS Vulnerabilities --------------------------------------------------------------------------- Author: Jose Antonio Coret (Joxean Koret) Date: 2005 Location: Basque Country --------------------------------------------------------------------------- Affected software description: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mantis Bugtracker - Mantis is a php/MySQL/web based bugtracking system Affected versions: + 1.0.0a3 + 1.0.0a2 + 1.0.0a1 + 0.19.2 + 0.19.1 + 0.19.0 + 0.19.0RC1 + 0.19.0a2 + 0.19.0a1 Partially affected versions: + 1.0.0RC1 (A2 Cross Site Scripting Vulnerability) Not affected versions: + 1.0.0RC2 + 0.18.3 and prior versions Web : http://mantisbt.sourceforge.net --------------------------------------------------------------------------- Vulnerabilities Summary ~~~~~~~~~~~~~~~~~~~~~~~ A - Cross Site Scripting Vulnerabilities A1.- Parameter 'dir' of the script "/view_all_set.php" is vulnerable to XSS attacks A2.- XSS in /bug_actiongroup_page.php when deleting a bug from the /view_all_bug_page.php B.- Database scanner via variable poisoning in /core/database_api.php script Vulnerabilities ~~~~~~~~~~~~~~~ A - Cross Site Scripting Vulnerabilities ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A1.- Parameter 'dir' of the script "/view_all_set.php" is vulnerable to XSS attacks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The parameter 'dir' of the /view_all_set.php script is not correctly sanitize and is vulnerable to XSS attacks. The following is a sample url to check the problem: http://[target]/view_all_set.php?sort=severity&dir=">&type=2 This bug is addressed as #0005959 in the MantisBT bug database. A1.- XSS in /bug_actiongroup_page.php when deleting a bug from the /view_all_bug_page.php ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A Cross Site Scripting Vulnerability was found in the script /bug_actiongroup_page.php when deleting a bug from the /view_all_bug_page.php. To reproduce behaviour follow these steps: 1.- Report a bug with the following summary: Test 2.- Enter as administrator and find the bug in /view_all_bug_page.php script 3.- Select the checkbox correspondient to this bug and DELETE in the drop down bellow. 4.- Press OK. 5.- In the /bug_actiongroup_page.php you will see the bug to delete and also a wonderfull javascript alert. This bug may be considered as non exploitable but it is exploitable. If you registers only one bug is possible that the administrator do not selects for deletion it from the /view_all_bug_page.php but, what about if you registers 15 messages? The administrator surely will delete all the bugs by selecting all the bugs from the /view_all_bug_page.php. This bug is addressed as #0006002 in the MantisBT bug database. B.- Database scanner via variable poisoning in /core/database_api.php script ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If the 'register_globals' directive is enabled the script located at /core/database_api.php is vulnerable to variable poisoning attacks. By exploiting the vulnerability an attacker can connect to databases that are in the web server LAN. To reproduce the behavior simply navigate to any of these urls: http://[target]/core/database_api.php?g_db_type=mysql://invaliduser@localhost:3336 [^] http://[target]/core/database_api.php?g_db_type=mysql://root@localhost:3336 [^] http://[target]/core/database_api.php?g_db_type=informix://localhost:8080 [^] Due to this vulnerability an attacker can write a database scanner or a network scanner by simply changing the hostname and port and parsing the responses. Examples: 1.- http://[target]/core/database_api.php?g_db_type=mysql://root@localhost [^] (Fast response) 2.- http://[target]/core/database_api.php?g_db_type=mysql://root@192.168.1.1 [^] (No response in about 30 seconds) 3.- http://[target]/core/database_api.php?g_db_type=mysql://root@10.x.y.z [^] (Response in about 3 seconds) A remote user can supply a specially crafted URL to scan arbitrary ports on arbitrary hosts using a URL with the following form: http://[target]/core/database_api.php?g_db_type=://: Based on the Response Time and the Response returned by MantisBT, the remote user can determine whether the specified port on the specified host is open or closed. As a consecuence, a remote user can invoke MantisBT to scan arbitrary ports on arbitrary hosts. This bug is addressed as #0005956 in the MantisBT bug database. Notes about issue #0005956 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 1.- This vulnerability doesn't allow an attacker to run SQL commands against the database. 2.- Not all sites running Mantis Bugtracker are vulnerables. This only works if the 'register_globals' directive is On. If you're unsure if your site is vulnerable you can try the provided exploit, called 'exploit.py'. Workarounds: ~~~~~~~~~~~~ There is no known workaround for the #0005959 and #0006002 issues. For #0005956 issue you only need to DISABLE the f* PHP directive 'register_globals'. Patches: ~~~~~~~~ The followings are patches that solves the #0005956, #0005959 and #0006002 issues. Patch for issue #0005959 ----------------------------------------------------------------------------------------------------------------------- --- filter_api.orig 2005-07-18 17:07:03.000000000 +0200 +++ filter_api.php 2005-07-18 17:06:15.000000000 +0200 @@ -753,7 +753,7 @@ ?>
-
+ '; } ?> - - - - + + + + \n" - , get_status_color( bug_get_field( $t_bug_id, 'status' ) ), string_get_bug_view_link( $t_bug_id ), bug_get_field( $t_bug_id, 'summary' ) + , get_status_color( bug_get_field( $t_bug_id, 'status' ) ), string_get_bug_view_link( $t_bug_id ), htmlentities(bug_get_field( $t_bug_id, 'summary' )) ); echo '' . "\n"; } ----------------------------------------------------------------------------------------------------------------------- The fix: ~~~~~~~~ Issues #0005956 and #0005959 are correcteds in version 1.0.0RC1. Alternatively, you can use the attacheds non-official patches. How to apply the patches: ~~~~~~~~~~~~~~~~~~~~~~~~~ To apply the patches follow these steps: 1.- Download (or copy/paste) the patch (or patches) that you need (i.e.: 0005956.patch). 2.- Copy the patch to your local '/core/' directory. (i.e.: in my Debian Sarge distribution this is located under /usr/local/mantis/gui/core). 3.- Execute the following command: $ patch -p0 < 0005956.patch After applying the patch: ~~~~~~~~~~~~~~~~~~~~~~~~~ If you have been applied the patch and you're not sure if your system is vulnerable or not, you can run the attached exploit called (originally...) 'exploit.py' and follow the instructions. NOTE: This exploit only probes the issue #0005956. Notes ~~~~~ Thanks to Victor Boctor, and all the Mantis Bugtracker guys. The were very kind and proffessionals. Disclaimer: ~~~~~~~~~~~ The information in this advisory and any of its demonstrations is provided "as is" without any warranty of any kind. I am not liable for any direct or indirect damages caused as a result of using the information or demonstrations provided in any part of this advisory. --------------------------------------------------------------------------- Contact: ~~~~~~~~ Joxean Koret at joxeanpiti<<<<<<<<@>>>>>>>>yah00<<<<<>>>>es ______________________________________________ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es
%s %s