VYPR
Moderate severityNVD Advisory· Published Feb 19, 2015· Updated May 6, 2026

CVE-2014-3578

CVE-2014-3578

Description

Directory traversal vulnerability in Pivotal Spring Framework 3.x before 3.2.9 and 4.0 before 4.0.5 allows remote attackers to read arbitrary files via a crafted URL.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
org.springframework:spring-coreMaven
>= 3.0.0, < 3.2.93.2.9
org.springframework:spring-coreMaven
>= 4.0.0, < 4.0.54.0.5

Affected products

1

Patches

3
8ee465103850

Improve StringUtils.cleanPath

https://github.com/spring-projects/spring-frameworkRossen StoyanchevMay 15, 2014via ghsa
2 files changed · +8 1
  • spring-core/src/main/java/org/springframework/util/StringUtils.java+6 1 modified
    @@ -622,7 +622,12 @@ public static String cleanPath(String path) {
     		String prefix = "";
     		if (prefixIndex != -1) {
     			prefix = pathToUse.substring(0, prefixIndex + 1);
    -			pathToUse = pathToUse.substring(prefixIndex + 1);
    +			if (prefix.contains("/")) {
    +				prefix = "";
    +			}
    +			else {
    +				pathToUse = pathToUse.substring(prefixIndex + 1);
    +			}
     		}
     		if (pathToUse.startsWith(FOLDER_SEPARATOR)) {
     			prefix = prefix + FOLDER_SEPARATOR;
    
  • spring-core/src/test/java/org/springframework/util/StringUtilsTests.java+2 0 modified
    @@ -299,6 +299,8 @@ public void testCleanPath() {
     		assertEquals("../mypath/myfile", StringUtils.cleanPath("../mypath/../mypath/myfile"));
     		assertEquals("../mypath/myfile", StringUtils.cleanPath("mypath/../../mypath/myfile"));
     		assertEquals("/../mypath/myfile", StringUtils.cleanPath("/../mypath/myfile"));
    +		assertEquals("/mypath/myfile", StringUtils.cleanPath("/a/:b/../../mypath/myfile"));
    +		assertEquals("file:///c:/path/to/the%20file.txt", StringUtils.cleanPath("file:///c:/some/../path/to/the%20file.txt"));
     	}
     
     	public void testPathEquals() {
    
f6fddeb6eb7d

Improve StringUtils.cleanPath

https://github.com/spring-projects/spring-frameworkRossen StoyanchevMay 15, 2014via ghsa
2 files changed · +8 1
  • spring-core/src/main/java/org/springframework/util/StringUtils.java+6 1 modified
    @@ -621,7 +621,12 @@ public static String cleanPath(String path) {
     		String prefix = "";
     		if (prefixIndex != -1) {
     			prefix = pathToUse.substring(0, prefixIndex + 1);
    -			pathToUse = pathToUse.substring(prefixIndex + 1);
    +			if (prefix.contains("/")) {
    +				prefix = "";
    +			}
    +			else {
    +				pathToUse = pathToUse.substring(prefixIndex + 1);
    +			}
     		}
     		if (pathToUse.startsWith(FOLDER_SEPARATOR)) {
     			prefix = prefix + FOLDER_SEPARATOR;
    
  • spring-core/src/test/java/org/springframework/util/StringUtilsTests.java+2 0 modified
    @@ -299,6 +299,8 @@ public void testCleanPath() {
     		assertEquals("../mypath/myfile", StringUtils.cleanPath("../mypath/../mypath/myfile"));
     		assertEquals("../mypath/myfile", StringUtils.cleanPath("mypath/../../mypath/myfile"));
     		assertEquals("/../mypath/myfile", StringUtils.cleanPath("/../mypath/myfile"));
    +		assertEquals("/mypath/myfile", StringUtils.cleanPath("/a/:b/../../mypath/myfile"));
    +		assertEquals("file:///c:/path/to/the%20file.txt", StringUtils.cleanPath("file:///c:/some/../path/to/the%20file.txt"));
     	}
     
     	public void testPathEquals() {
    
748167bfa33c

Improve StringUtils.cleanPath

https://github.com/spring-projects/spring-frameworkRossen StoyanchevMay 15, 2014via ghsa
2 files changed · +8 1
  • spring-core/src/main/java/org/springframework/util/StringUtils.java+6 1 modified
    @@ -622,7 +622,12 @@ public static String cleanPath(String path) {
     		String prefix = "";
     		if (prefixIndex != -1) {
     			prefix = pathToUse.substring(0, prefixIndex + 1);
    -			pathToUse = pathToUse.substring(prefixIndex + 1);
    +			if (prefix.contains("/")) {
    +				prefix = "";
    +			}
    +			else {
    +				pathToUse = pathToUse.substring(prefixIndex + 1);
    +			}
     		}
     		if (pathToUse.startsWith(FOLDER_SEPARATOR)) {
     			prefix = prefix + FOLDER_SEPARATOR;
    
  • spring-core/src/test/java/org/springframework/util/StringUtilsTests.java+2 0 modified
    @@ -299,6 +299,8 @@ public void testCleanPath() {
     		assertEquals("../mypath/myfile", StringUtils.cleanPath("../mypath/../mypath/myfile"));
     		assertEquals("../mypath/myfile", StringUtils.cleanPath("mypath/../../mypath/myfile"));
     		assertEquals("/../mypath/myfile", StringUtils.cleanPath("/../mypath/myfile"));
    +		assertEquals("/mypath/myfile", StringUtils.cleanPath("/a/:b/../../mypath/myfile"));
    +		assertEquals("file:///c:/path/to/the%20file.txt", StringUtils.cleanPath("file:///c:/some/../path/to/the%20file.txt"));
     	}
     
     	public void testPathEquals() {
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

15

News mentions

0

No linked articles in our index yet.