diff --git a/mod/lti/service.php b/mod/lti/service.php index beae870997e..362f1e9751a 100644 --- a/mod/lti/service.php +++ b/mod/lti/service.php @@ -54,7 +54,14 @@ if ($sharedsecret === false) { throw new Exception('Message signature not valid'); } -$xml = new SimpleXMLElement($rawbody); +// TODO MDL-46023 Replace this code with a call to the new library. +$origentity = libxml_disable_entity_loader(true); +$xml = simplexml_load_string($rawbody); +if (!$xml) { + libxml_disable_entity_loader($origentity); + throw new Exception('Invalid XML content'); +} +libxml_disable_entity_loader($origentity); $body = $xml->imsx_POXBody; foreach ($body->children() as $child) {