CVE-2018-1271: Path Traversal in org.springframework:spring-core
Summary
CVE-2018-1271: Path Traversal in org.springframework:spring-core. Affects org.springframework:spring-core across 2 version ranges.
< 4.3.15
>= 5.0.0, < 5.0.5
Fixed in 4.3.15 or 5.0.5, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The org.springframework:spring-core package is a core component of the Spring Framework, which is a popular Java-based framework used for building enterprise-level applications. It provides essential functionality and utilities for various Spring modules, including Spring MVC. Spring MVC allows applications to serve static resources such as CSS, JS, and images. These resources can be served from either the classpath, the ServletContext, or the file system on Windows. However, a vulnerability in versions 5.0 prior to 5.0.5 and versions 4.3 prior to 4.3.15 (and older unsupported versions) allows a malicious user to exploit a directory traversal attack when static resources are served from the file system on Windows.
Vulnerability Detail
The vulnerability arises from a lack of proper input validation and sanitization in the handling of user-supplied URLs. By crafting a specially crafted URL, an attacker can bypass the intended resource restrictions and access arbitrary files on the file system. This can lead to unauthorized disclosure of sensitive information, remote code execution, or other malicious activities. The vulnerability has a CVSS score of 5.9, indicating a moderate severity level.
How To Fix
Latest published version: 7.1.0-RC1 as of 22 Oct 2026
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 4.3.154.3.15 -
>= 5.0.0, < 5.0.55.0.5
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If upgrading to a fixed version is not immediately feasible, a temporary workaround is to serve static resources from the classpath or the ServletContext instead of the file system on Windows. This can be achieved by configuring Spring MVC accordingly. Here is an example of how to configure Spring MVC to serve static resources from the classpath:
@Configuration
@EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/resources/**")
.addResourceLocations("classpath:/static/");
}
}
By using this workaround, the risk of a directory traversal attack can be mitigated.
Conclusion
In conclusion, the org.springframework:spring-core package is vulnerable to a path traversal attack when serving static resources from the file system on Windows. Upgrading to a fixed version of the Spring Framework is the recommended solution. In the meantime, serving static resources from the classpath or the ServletContext can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for org.springframework:spring-core →
FAQ
The vulnerability allows an attacker to perform directory traversal attacks, potentially leading to unauthorized access to sensitive files, remote code execution, or other malicious activities.
Versions 5.0 prior to 5.0.5 and versions 4.3 prior to 4.3.15 (and older unsupported versions) are affected by this vulnerability.
Yes, the CVSS score for this vulnerability is 5.9, indicating a moderate severity level.
To fix this vulnerability, it is recommended to upgrade to a fixed version of the Spring Framework. For versions 5.0, upgrade to version 5.0.5 or later. For versions 4.3, upgrade to version 4.3.15 or later.
Yes, a temporary workaround is to serve static resources from the classpath or the ServletContext instead of the file system on Windows. This can be achieved by configuring Spring MVC accordingly.
References
Related vulnerabilities
Recent vulnerabilities recorded for org.springframework:spring-core.