The vulnerability is a classic XML External Entity (XXE) injection issue within Apache SIS. The root cause lies in the use of javax.xml.stream.XMLInputFactory with its default, insecure configuration, which permits the processing of external entities defined in an XML document. This allows an attacker to supply a crafted XML file (e.g., within a GeoTIFF, GPX, or GML file) that references external entities pointing to local files on the server.
The analysis of the patch commit 5bfa162bd56edb7d41d56a0c926592964d31d83b reveals two primary locations where insecure XMLInputFactory instances were created:
-
org.apache.sis.storage.geotiff.reader.XMLMetadata.toXML(): This function, used for parsing XML metadata from GeoTIFF files, directly instantiated its own XMLInputFactory without secure settings.
-
org.apache.sis.storage.xml.stream.StaxDataStore.inputFactory(): This method served as a factory for XMLInputFactory instances for various XML data stores (including GPX, GML, and ISO 19115 metadata). It created a default, insecure factory that was then used by subclasses for parsing.
The fix involves modifying these methods to ensure that any created XMLInputFactory is configured securely. Specifically, the patch sets the FEATURE_SECURE_PROCESSING property to true and restricts the ACCESS_EXTERNAL_DTD property to only allow http and https protocols, effectively blocking the file protocol and mitigating the XXE vulnerability.