CVE-2015-10029 (published 2023-01-07T20:15Z)

A vulnerability classified as problematic was found in kelvinmo simplexrd up to 3.1.0. This vulnerability affects unknown code of the file simplexrd/simplexrd.class.php. The manipulation leads to xml external entity reference. Upgrading to version 3.1.1 is able to address this issue. The patch is identified as 4c9f2e028523ed705b555eca2c18c64e71f1a35d. It is recommended to upgrade the affected component. VDB-217630 is the identifier assigned to this vulnerability.

CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: CWE-611
cwe_name: Improper Restriction of XML External Entity Reference
description: The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
extended_description: 
            XML documents optionally contain a Document Type Definition (DTD), which, among other features, enables the definition of XML entities. It is possible to define an entity by providing a substitution string in the form of a URI. The XML parser can access the contents of this URI and embed these contents back into the XML document for further processing.
            By submitting an XML file that defines an external entity with a file:// URI, an attacker can cause the processing application to read the contents of a local file. For example, a URI such as "file:///c:/winnt/win.ini" designates (in Windows) the file C:\Winnt\win.ini, or file:///etc/passwd designates the password file in Unix-based systems. Using URIs with other schemes such as http://, the attacker can force the application to make outgoing requests to servers that the attacker cannot reach directly, which can be used to bypass firewall restrictions or hide the source of attacks such as port scanning.
            Once the content of the URI is read, it is fed back into the application that is processing the XML. This application may echo back the data (e.g. in an error message), thereby exposing the file contents.
         
         

Fix information:
repo_url: https://github.com/kelvinmo/simplexrd
commit_details: repo_url: https://github.com/kelvinmo/simplexrd
author: Kelvin Mo
author_date: 2015-10-24 12:32:09+11:00
msg: Changed XML loading code to prevent XML external entity processing attacks
repository: repo_url: https://github.com/kelvinmo/simplexrd
repo_name: kelvinmo/simplexrd
description: An extraordinarily simple XRD parser written in PHP.
repo_language: PHP
owner: kelvinmo
file_changes: filename: CHANGELOG.md
change_type: ModificationType.MODIFY
diff: @@ -1,3 +1,7 @@
+## 3.1.1
+
+- Changed XML loading code to prevent XML external entity processing attacks
+
 ## 3.1
 
 - Added [Travis CI](https://travis-ci.org/) configuration

programming_language: Markdown
filename: simplexrd.class.php
change_type: ModificationType.MODIFY
diff: @@ -68,7 +68,7 @@ class SimpleXRD {
      * @var resource
      */
     private $reader;
-    
+
     /**
      * XML namespace constant
      * @var string
@@ -80,7 +80,7 @@ class SimpleXRD {
      * @var array
      */
     private $jrd = array();
-    
+
     /**
      * Creates an instance of the XRD parser.
      *
@@ -89,7 +89,7 @@ class SimpleXRD {
     public function __construct() {
         $this->reader = new XMLReader();
     }
-    
+
     /**
      * Frees memory associated with the underlying XML parser.
      *
@@ -107,9 +107,9 @@ class SimpleXRD {
      * @param string $xml the XML document to load
      */
     public function load($xml) {
-        $this->reader->xml($xml);
+        $this->reader->xml($xml, null, LIBXML_NONET);
     }
-    
+
     /**
      * Parses the loaded XRD document and returns the JRD-equivalent structure.
      *
@@ -122,12 +122,12 @@ class SimpleXRD {
      * @return array the JRD equivalent structure
      */
     public function parse($include_expires = false) {
-        while ($this->reader->read()) {            
-            if (($this->reader->nodeType == XMLReader::ELEMENT) 
+        while ($this->reader->read()) {
+            if (($this->reader->nodeType == XMLReader::ELEMENT)
                 && ($this->reader->namespaceURI == self::XRD_NS)) {
                 switch ($this->reader->localName) {
                     case 'XRD':
-                        $this->jrd = array();                        
+                        $this->jrd = array();
                         break;
                     case 'Expires':
                         if ($include_expires) $this->jrd['expires'] = $this->reader->readString();
@@ -148,7 +148,7 @@ class SimpleXRD {
                         $this->parseProperty($this->jrd['properties']);
                         break;
                 }
-            
+
             }
         }
         return $this->jrd;
@@ -177,7 +177,7 @@ class SimpleXRD {
                 ($this->reader->localName == 'Link'))
                 break;
 
-            if (($this->reader->nodeType == XMLReader::ELEMENT) 
+            if (($this->reader->nodeType == XMLReader::ELEMENT)
                 && ($this->reader->namespaceURI == self::XRD_NS)) {
                 switch ($this->reader->localName) {
                     case 'Property':

programming_language: PHP