-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XML plugin: Add config page with access thresholds
Prior to this, any user of a MantisBT instance with the XML Import/Export plugin enabled and knowing the URL to the plugin's import page could upload an XML file and insert data without restriction, regardless of their access level. This vulnerability is particularly dangerous when used in combination with the one described in issue #17725 (CVE-2014-7146) as it makes for a very simple and easily accessible vector for PHP code injection attacks. There was also no access check when exporting data, which could allow an attacker to gain access to confidential information (disclosure of all bug-related data, including usernames). Fixes #17780 (CVE-2014-8598)
- Loading branch information
Showing
6 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
<?php | |||
# Copyright (c) 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net | |||
# Licensed under the MIT license | |||
|
|||
form_security_validate( 'plugin_XmlImportExport_config' ); | |||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | |||
|
|||
/** | |||
* Sets plugin config option if value is different from current/default | |||
* @param string $p_name option name | |||
* @param string $p_value value to set | |||
* @return void | |||
*/ | |||
function config_set_if_needed( $p_name, $p_value ) { | |||
if ( $p_value != plugin_config_get( $p_name ) ) { | |||
plugin_config_set( $p_name, $p_value ); | |||
} | |||
} | |||
|
|||
$t_redirect_url = plugin_page( 'config_page', true ); | |||
|
|||
config_set_if_needed( 'import_threshold' , gpc_get_int( 'import_threshold' ) ); | |||
config_set_if_needed( 'export_threshold' , gpc_get_int( 'export_threshold' ) ); | |||
|
|||
form_security_purge( 'plugin_XmlImportExport_config' ); | |||
|
|||
print_successful_redirect( $t_redirect_url ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
<?php | |||
# Copyright (c) 2014 MantisBT Team - mantisbt-dev@lists.sourceforge.net | |||
# Licensed under the MIT license | |||
|
|||
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) ); | |||
|
|||
html_page_top(); | |||
//print_manage_menu(); | |||
?> | |||
|
|||
<br /> | |||
<form action="<?php echo plugin_page( 'config' ) ?>" method="post"> | |||
<?php echo form_security_field( 'plugin_XmlImportExport_config' ) ?> | |||
<table class="width60" align="center"> | |||
|
|||
<tr> | |||
<td class="form-title" colspan="2"><?php echo plugin_lang_get("config_title") ?></td> | |||
</tr> | |||
|
|||
<tr <?php echo helper_alternate_class() ?>> | |||
<td class="category"><?php echo plugin_lang_get( 'import_threshold' ) ?></td> | |||
<td><select name="import_threshold"><?php | |||
print_enum_string_option_list( | |||
'access_levels', | |||
plugin_config_get( 'import_threshold' ) | |||
); | |||
?></select></td> | |||
</tr> | |||
|
|||
<tr <?php echo helper_alternate_class() ?>> | |||
<td class="category"><?php echo plugin_lang_get( 'export_threshold' ) ?></td> | |||
<td><select name="export_threshold"><?php | |||
print_enum_string_option_list( | |||
'access_levels', | |||
plugin_config_get( 'export_threshold' ) | |||
); | |||
?></select></td> | |||
</tr> | |||
|
|||
<tr> | |||
<td class="center" colspan="2"><input type="submit" value="<?php echo plugin_lang_get("action_update") ?>"/></td> | |||
</tr> | |||
|
|||
</table> | |||
</form> | |||
|
|||
<?php | |||
html_page_bottom(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters