Vulnerabilities in pkg:maven/org.apache.sling/org.apache.sling.xss

PACKAGE
Advisory Identifier: GHSA-7g54-vgp6-jj5w
Advisory Summary

CVE-2016-6798 is a CRITICAL (CVSS 9.8) xml external entity reference vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Org.apache.sling.xss libraries in the Maven ecosystem. The issue involves xml external entity reference in apache sling. Remediation is available by upgrading affected packages to version 1.0.12, 1.1.0.

3 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/org.apache.sling/org.apache.sling.xss

3 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/org.apache.sling/org.apache.sling.xss. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-7g54-vgp6-jj5w CVE-2016-6798 CRITICAL XML External Entity Reference in Apache Sling
GHSA-xwf4-88xr-hx2j CVE-2016-5394 MODERATE Cross site scripting in Apache Sling
GHSA-7mfw-43c4-45mq CVE-2017-15717 MODERATE Cross-site Scripting in Apache Sling XSS Protection API

CVE-2016-6798 at a Glance

CVE Identifier CVE-2016-6798
GHSA Identifier GHSA-7g54-vgp6-jj5w
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product Org.apache.sling.xss
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2016-6798

To remediate this vulnerability, upgrade all affected Org.apache.sling.xss dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.apache.sling:org.apache.sling.xss fixed: 1.0.12
<dependency>
    <groupId>org.apache.sling</groupId>
    <artifactId>org.apache.sling.xss</artifactId>
    <version>1.0.12</version>
</dependency>
org.apache.sling:org.apache.sling.xss.compat fixed: 1.1.0
<dependency>
    <groupId>org.apache.sling</groupId>
    <artifactId>org.apache.sling.xss.compat</artifactId>
    <version>1.1.0</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.apache.sling

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2016-6798, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.sling

Analyze the terminal output to locate any version of Org.apache.sling.xss in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.12), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.apache.sling command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where 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. In Org.apache.sling.xss, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

In the XSS Protection API module before 1.0.12 in Apache Sling, the method XSS.getValidXML() uses an insecure SAX parser to validate the input string, which allows for XXE attacks in all scripts which use this method to validate user input, potentially allowing an attacker to read sensitive data on the filesystem, perform same-site-request-forgery (SSRF), port-scanning behind the firewall or DoS the application.

CVE-2016-6798 Affected Org.apache.sling.xss Versions

2 component(s)
Fixed Versions:
1.0.121.1.0
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.sling:org.apache.sling.xss
Maven
< 1.0.12
1.0.12
org.apache.sling:org.apache.sling.xss.compat
Maven
< 1.1.0
1.1.0

References

Frequently Asked Questions

What is CVE-2016-6798?
CVE-2016-6798 is a security vulnerability in Org.apache.sling.xss involving XML External Entity Reference in Apache Sling under CWE-611: Improper Restriction of XML External Entity Reference.
Which Org.apache.sling.xss versions are affected?
Affected versions include releases prior to 1.0.12, 1.1.0 across affected packages: org.apache.sling:org.apache.sling.xss, org.apache.sling:org.apache.sling.xss.compat.
What version fixes CVE-2016-6798?
Upgrading to 1.0.12, 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is org.apache.sling.xss affected?
Yes, org.apache.sling:org.apache.sling.xss is affected in releases prior to 1.0.12. Upgrade your dependency to 1.0.12 or later.
Is org.apache.sling.xss.compat affected?
Yes, org.apache.sling:org.apache.sling.xss.compat is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What is the CVSS score of CVE-2016-6798?
CVE-2016-6798 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2016-6798?
CVE-2016-6798 is classified under CWE-611: Improper Restriction of XML External Entity Reference (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.).
How can I check Maven dependencies for CVE-2016-6798?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.sling'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7g54-vgp6-jj5w",
  "modified" : "2022-11-03T20:48:21Z",
  "published" : "2022-05-17T02:26:22Z",
  "aliases" : [ "CVE-2016-6798" ],
  "summary" : "XML External Entity Reference in Apache Sling",
  "details" : "In the XSS Protection API module before 1.0.12 in Apache Sling, the method XSS.getValidXML() uses an insecure SAX parser to validate the input string, which allows for XXE attacks in all scripts which use this method to validate user input, potentially allowing an attacker to read sensitive data on the filesystem, perform same-site-request-forgery (SSRF), port-scanning behind the firewall or DoS the application.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.sling:org.apache.sling.xss"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.0.12"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.sling:org.apache.sling.xss.compat"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-6798"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/sling-org-apache-sling-xss/commit/de32b144ad2be3367559f6184d560db42a220529"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jensdietrich/xshady-release/tree/main/CVE-2016-6798"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/b72c3a511592ec70729b3ec2d29302b6ce87bbeab62d4745617a6bd0@%3Cdev.sling.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/99873"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-03T20:48:21Z",
    "nvd_published_at" : "2017-07-19T15:29:00Z"
  }
}