Skip to content

Commit

Permalink
Preventing XEE attacks by temporarily disabling entity loader for the…
Browse files Browse the repository at this point in the history
… time parsing external XML.
  • Loading branch information
blablabla1234678 authored and = committed Sep 13, 2013
1 parent 1a30b09 commit 2be864c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Slim/Middleware/ContentTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ protected function parseXml($input)
{
if (class_exists('SimpleXMLElement')) {
try {
return new \SimpleXMLElement($input);
$backup = libxml_disable_entity_loader(true);
$result = new \SimpleXMLElement($input);
libxml_disable_entity_loader($backup);
return $result;
} catch (\Exception $e) {
// Do nothing
}
Expand Down

0 comments on commit 2be864c

Please sign in to comment.