CVE-2015-10082 (published 2023-02-21T07:15Z)

A vulnerability classified as problematic has been found in UIKit0 libplist 1.12. This affects the function plist_from_xml of the file src/xplist.c of the component XML Handler. The manipulation leads to xml external entity reference. The patch is named c086cb139af7c82845f6d565e636073ff4b37440. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-221499.

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/UIKit0/libplist
commit_details: repo_url: https://github.com/UIKit0/libplist
author: Martin Szulecki
author_date: 2015-01-23 14:56:59+01:00
msg: xplist: Fix limited but possible XXE security vulnerability with XML plists

By using a specifically crafted XML file an attacker could use plistutil
to issue a GET request to an arbitrary URL or disclose a local file.
The crafted XML file would be using a custom DTD with an external entity
reference pointing to the file. Practical abuse is limited but let's still
fix it nevertheless. Related to CVE-2013-0339 for libxml2 and CWE-827.
Reported by Loïc Bénis from calypt.com. Thanks!
repository: repo_url: https://github.com/UIKit0/libplist
repo_name: UIKit0/libplist
repo_language: C
owner: UIKit0
file_changes: filename: xplist.c
change_type: ModificationType.MODIFY
diff: @@ -29,6 +29,7 @@
 #include <inttypes.h>
 #include <locale.h>
 
+#include <libxml/xmlIO.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
@@ -555,11 +556,22 @@ PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
     }
 }
 
+static xmlParserInputPtr plist_xml_external_entity_loader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
+{
+    return NULL;
+}
+
 PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist)
 {
-    xmlDocPtr plist_doc = xmlParseMemory(plist_xml, length);
-    xmlNodePtr root_node = xmlDocGetRootElement(plist_doc);
+    /* CVE-2013-0339: disable external entity loading to prevent XXE vulnerability */
+    xmlSetExternalEntityLoader(plist_xml_external_entity_loader);
 
-    xml_to_node(root_node, plist);
-    xmlFreeDoc(plist_doc);
+    /* read XML from memory and disable network access for security reasons */
+    xmlDocPtr plist_doc = xmlReadMemory(plist_xml, length, "plist_from_xml:memory", NULL, XML_PARSE_NONET);
+    if (plist_doc) {
+        xmlNodePtr root_node = xmlDocGetRootElement(plist_doc);
+
+        xml_to_node(root_node, plist);
+        xmlFreeDoc(plist_doc);
+    }
 }

programming_language: C