Vulnerabilities in pkg:maven/com.diffplug.spotless/spotless-maven-plugin

PACKAGE
Advisory Identifier: GHSA-7v35-qwwj-p98g
Advisory Summary

CVE-2019-9843 is a HIGH (CVSS 7.5) improper restriction of xml external vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Spotless plugin gradle libraries in the Maven ecosystem. The issue involves improper restriction of xml external entity reference in diffplug spotless. Remediation is available by upgrading affected packages to version 3.20.0, 1.20.0.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/com.diffplug.spotless/spotless-maven-plugin

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/com.diffplug.spotless/spotless-maven-plugin. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-7v35-qwwj-p98g CVE-2019-9843 HIGH Improper Restriction of XML External Entity Reference in DiffPlug Spotless

CVE-2019-9843 at a Glance

CVE Identifier CVE-2019-9843
GHSA Identifier GHSA-7v35-qwwj-p98g
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product Spotless plugin gradle
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2019-9843

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

com.diffplug.spotless:spotless-plugin-gradle fixed: 3.20.0
<dependency>
    <groupId>com.diffplug.spotless</groupId>
    <artifactId>spotless-plugin-gradle</artifactId>
    <version>3.20.0</version>
</dependency>
com.diffplug.spotless:spotless-maven-plugin fixed: 1.20.0
<dependency>
    <groupId>com.diffplug.spotless</groupId>
    <artifactId>spotless-maven-plugin</artifactId>
    <version>1.20.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=com.diffplug.spotless

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=com.diffplug.spotless

Analyze the terminal output to locate any version of Spotless plugin gradle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.20.0), your application is affected.

Note: The mvn dependency:tree -Dincludes=com.diffplug.spotless 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 Spotless plugin gradle, 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 DiffPlug Spotless before 1.20.0 (library and Maven plugin) and before 3.20.0 (Gradle plugin), the XML parser would resolve external entities over both HTTP and HTTPS and didn't respect the resolveExternalEntities setting. For example, this allows disclosure of file contents to a MITM attacker if a victim performs a spotlessApply operation on an untrusted XML file.

CVE-2019-9843 Affected Spotless plugin gradle Versions

2 component(s)
Fixed Versions:
3.20.01.20.0
Product / Package Ecosystem Affected Versions Fixed Version
com.diffplug.spotless:spotless-plugin-gradle
Maven
< 3.20.0
3.20.0
com.diffplug.spotless:spotless-maven-plugin
Maven
< 1.20.0
1.20.0

References

Frequently Asked Questions

What is CVE-2019-9843?
CVE-2019-9843 is a security vulnerability in Spotless plugin gradle involving Improper Restriction of XML External Entity Reference in DiffPlug Spotless under CWE-611: Improper Restriction of XML External Entity Reference.
Which Spotless plugin gradle versions are affected?
Affected versions include releases prior to 3.20.0, 1.20.0 across affected packages: com.diffplug.spotless:spotless-plugin-gradle, com.diffplug.spotless:spotless-maven-plugin.
What version fixes CVE-2019-9843?
Upgrading to 3.20.0, 1.20.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is spotless-plugin-gradle affected?
Yes, com.diffplug.spotless:spotless-plugin-gradle is affected in releases prior to 3.20.0. Upgrade your dependency to 3.20.0 or later.
Is spotless-maven-plugin affected?
Yes, com.diffplug.spotless:spotless-maven-plugin is affected in releases prior to 1.20.0. Upgrade your dependency to 1.20.0 or later.
What is the CVSS score of CVE-2019-9843?
CVE-2019-9843 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2019-9843?
CVE-2019-9843 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-2019-9843?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=com.diffplug.spotless'. 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-7v35-qwwj-p98g",
  "modified" : "2022-11-17T18:10:27Z",
  "published" : "2019-07-05T21:07:40Z",
  "aliases" : [ "CVE-2019-9843" ],
  "summary" : "Improper Restriction of XML External Entity Reference in DiffPlug Spotless",
  "details" : "In DiffPlug Spotless before 1.20.0 (library and Maven plugin) and before 3.20.0 (Gradle plugin), the XML parser would resolve external entities over both HTTP and HTTPS and didn't respect the resolveExternalEntities setting. For example, this allows disclosure of file contents to a MITM attacker if a victim performs a spotlessApply operation on an untrusted XML file.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.diffplug.spotless:spotless-plugin-gradle"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.20.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "com.diffplug.spotless:spotless-maven-plugin"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.20.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-9843"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/diffplug/spotless/issues/358"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/diffplug/spotless/pull/369"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/diffplug/spotless"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md#version-3200---march-11th-2018-javadoc-jcenter"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/diffplug/spotless/blob/master/plugin-maven/CHANGES.md#version-1200---march-14th-2018-javadoc-jcenter"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-07-01T16:09:01Z",
    "nvd_published_at" : "2019-06-28T18:15:00Z"
  }
}