CSteipp has uploaded a new change for review.
https://gerrit.wikimedia.org/r/59342
Change subject: Disable external entities in Import
......................................................................
Disable external entities in Import
Temporarily disable loading entities in XMLReader when calling read()
during import.
bug: 47251
Change-Id: I0b39386e6cf4ec0244aab8ebc4095922511e2964
---
M includes/Import.php
1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/42/59342/1
diff --git a/includes/Import.php b/includes/Import.php
index 11f3795..480239f 100644
--- a/includes/Import.php
+++ b/includes/Import.php
@@ -432,10 +432,16 @@
* @return bool
*/
public function doImport() {
+
+ // Calls to reader->read need to be wrapped in calls to
+ // libxml_disable_entity_loader() to avoid local file
+ // inclusion attacks (bug 46932).
+ $oldDisable = libxml_disable_entity_loader( true );
$this->reader->read();
if ( $this->reader->name != 'mediawiki' ) {
- throw new MWException( "Expected <mediawiki> tag, got ".
+ libxml_disable_entity_loader( $oldDisable );
+ throw new MWException( "Expected <mediawiki> tag, got "
.
$this->reader->name );
}
$this->debug( "<mediawiki> tag is correct." );
@@ -473,6 +479,7 @@
}
}
+ libxml_disable_entity_loader( $oldDisable );
return true;
}
--
To view, visit https://gerrit.wikimedia.org/r/59342
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0b39386e6cf4ec0244aab8ebc4095922511e2964
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: REL1_20
Gerrit-Owner: CSteipp <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits