mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-10 16:58:34 +02:00
XXE vulnerability prevention
This commit is contained in:
parent
595d8b7b2f
commit
2f9abb2a11
1 changed files with 5 additions and 1 deletions
|
@ -48,7 +48,11 @@ $server->handle(function (Connection $conn) use ($table, $db) {
|
|||
$length = unpack('N', substr($data, 0, 4))[1];
|
||||
$xmlData = substr($data, 4, $length - 4);
|
||||
|
||||
$xml = simplexml_load_string($xmlData, 'SimpleXMLElement', LIBXML_DTDLOAD | LIBXML_NOENT);
|
||||
// If you're using PHP < 8.0
|
||||
libxml_disable_entity_loader(true);
|
||||
libxml_use_internal_errors(true);
|
||||
|
||||
$xml = simplexml_load_string($xmlData);
|
||||
$xml->registerXPathNamespace('e', 'urn:ietf:params:xml:ns:epp-1.0');
|
||||
$xml->registerXPathNamespace('xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
$xml->registerXPathNamespace('domain', 'urn:ietf:params:xml:ns:domain-1.0');
|
||||
|
|
Loading…
Add table
Reference in a new issue