CVE-2016-9878: Spring Framework Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-2m8h-fgr8-2q9w
CVSS 7.5
CWE-22
Published
Advisory Summary

CVE-2016-9878 is a HIGH (CVSS 7.5) remote code execution vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Spring Framework libraries in the Maven ecosystem. The issue involves pivotal spring framework paths provided to the resourceservlet were not properly sanitized. Remediation is available by upgrading affected packages to version 3.2.18, 4.2.9, 4.3.5.

CVE-2016-9878 at a Glance

CVE Identifier CVE-2016-9878
GHSA Identifier GHSA-2m8h-fgr8-2q9w
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Spring Framework
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:L/PR:N/UI:N/S:U/C:H/I:N/A:N).

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 None (I:N)
Availability None (A:N)

How to Fix CVE-2016-9878

To remediate this vulnerability, upgrade all affected Spring Framework 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.springframework:spring-webmvc fixed: 3.2.18
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>3.2.18</version>
</dependency>
org.springframework:spring-webmvc fixed: 4.2.9
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>4.2.9</version>
</dependency>
org.springframework:spring-webmvc fixed: 4.3.5
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>4.3.5</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.springframework

How to Check if You Are Affected

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

mvn dependency:tree -Dincludes=org.springframework

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

Note: The mvn dependency:tree -Dincludes=org.springframework 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Spring Framework, 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

An issue was discovered in Pivotal Spring Framework before 3.2.18, 4.2.x before 4.2.9, and 4.3.x before 4.3.5. Paths provided to the ResourceServlet were not properly sanitized and as a result exposed to directory traversal attacks.

CVE-2016-9878 Affected Spring Framework Versions

3 component(s)
Fixed Versions:
3.2.184.2.94.3.5
Product / Package Ecosystem Affected Versions Fixed Version
org.springframework:spring-webmvc
Maven
< 3.2.18
3.2.18
org.springframework:spring-webmvc
Maven
≥ 4.2.0
< 4.2.9
4.2.9
org.springframework:spring-webmvc
Maven
≥ 4.3.0
< 4.3.5
4.3.5

References

NVD — CVE-2016-9878 NVD
https://nvd.nist.gov/vuln/detail/CVE-2016-9878
Spring Framework Source Repository REPOSITORY
https://github.com/spring-projects/spring-framework/issues/19513
Security Fix Commit FIX COMMIT
https://github.com/spring-projects/spring-framework/commit/43bf008fbcd0d7945e2fcd5e30039bc4d74c7a98
Security Fix Commit FIX COMMIT
https://github.com/spring-projects/spring-framework/commit/a7dc48534ea501525f11369d369178a60c2f47d0
Security Fix Commit FIX COMMIT
https://github.com/spring-projects/spring-framework/commit/e2d6e709c3c65a4951eb096843ee75d5200cfcad
access.redhat.com/errata/rhsa-2017:31... WEB
https://access.redhat.com/errata/RHSA-2017:3115
GitHub Advisory / Wiki ADVISORY
https://github.com/advisories/GHSA-2m8h-fgr8-2q9w
Spring Framework Source Repository REPOSITORY
https://github.com/spring-projects/spring-framework
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2019/07/msg00012.html
Spring Framework Security Information SECURITY
https://pivotal.io/security/cve-2016-9878
Spring Framework Security Information SECURITY
https://security.netapp.com/advisory/ntap-20180419-0002
Spring Framework Security Information SECURITY
https://www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.html
Spring Framework Security Information SECURITY
http://www.oracle.com/technetwork/security-advisory/cpuapr2018-3678067.html
Spring Framework Security Information SECURITY
http://www.oracle.com/technetwork/security-advisory/cpujan2018-3236628.html
Spring Framework Security Information SECURITY
http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html
Spring Framework Security Information SECURITY
http://www.securityfocus.com/bid/95072
Spring Framework Security Information SECURITY
http://www.securitytracker.com/id/1040698

Frequently Asked Questions

What is CVE-2016-9878?
CVE-2016-9878 is a security vulnerability in Spring Framework involving Pivotal Spring Framework Paths provided to the ResourceServlet were not properly sanitized under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Spring Framework versions are affected?
Affected versions include releases prior to 3.2.18, 4.2.9, 4.3.5 across affected packages: org.springframework:spring-webmvc.
What version fixes CVE-2016-9878?
Upgrading to 3.2.18, 4.2.9, 4.3.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is spring-webmvc affected?
Yes, org.springframework:spring-webmvc is affected in releases prior to 3.2.18, 4.2.9, 4.3.5. Upgrade your dependency to 3.2.18, 4.2.9, 4.3.5 or later.
What is the CVSS score of CVE-2016-9878?
CVE-2016-9878 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2016-9878?
CVE-2016-9878 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Maven dependencies for CVE-2016-9878?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.springframework'. 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-2m8h-fgr8-2q9w",
  "modified" : "2024-03-05T17:45:42Z",
  "published" : "2018-10-04T20:29:55Z",
  "aliases" : [ "CVE-2016-9878" ],
  "summary" : "Pivotal Spring Framework Paths provided to the ResourceServlet were not properly sanitized",
  "details" : "An issue was discovered in Pivotal Spring Framework before 3.2.18, 4.2.x before 4.2.9, and 4.3.x before 4.3.5. Paths provided to the ResourceServlet were not properly sanitized and as a result exposed to directory traversal attacks.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework:spring-webmvc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.18"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework:spring-webmvc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.2.0"
      }, {
        "fixed" : "4.2.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.springframework:spring-webmvc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.3.0"
      }, {
        "fixed" : "4.3.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-9878"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-framework/issues/19513"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-framework/commit/43bf008fbcd0d7945e2fcd5e30039bc4d74c7a98"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-framework/commit/a7dc48534ea501525f11369d369178a60c2f47d0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/spring-projects/spring-framework/commit/e2d6e709c3c65a4951eb096843ee75d5200cfcad"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2017:3115"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-2m8h-fgr8-2q9w"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/spring-projects/spring-framework"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2019/07/msg00012.html"
  }, {
    "type" : "WEB",
    "url" : "https://pivotal.io/security/cve-2016-9878"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20180419-0002"
  }, {
    "type" : "WEB",
    "url" : "https://www.oracle.com/technetwork/security-advisory/cpujul2019-5072835.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.oracle.com/technetwork/security-advisory/cpuapr2018-3678067.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.oracle.com/technetwork/security-advisory/cpujan2018-3236628.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.oracle.com/technetwork/security-advisory/cpujul2018-4258247.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/95072"
  }, {
    "type" : "WEB",
    "url" : "http://www.securitytracker.com/id/1040698"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T20:52:31Z",
    "nvd_published_at" : "2016-12-29T09:59:00Z"
  }
}