Hoch

Temporary Directory Hijacking to Local Privilege Escalation Vulnerability in org.springframework.boot:spring-boot

  • Veröffentlicht: 11.07.2022
  • Aktualisiert: 11.10.2026 12:22

spring-boot versions prior to version v2.2.11.RELEASE was vulnerable to temporary directory hijacking. This vulnerability impacted the org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir method.

The vulnerable method is used to create a work directory for embedded web servers such as Tomcat and Jetty. The directory contains configuration files, JSP/class files, etc. If a local attacker got the permission to write in this directory, they could completely take over the application (ie. local privilege escalation).

Impact Location

This vulnerability impacted the following source location:

java
	/**
	 * Return the absolute temp dir for given web server.
	 * @param prefix server name
	 * @return the temp dir for given server.
	 */
	protected final File createTempDir(String prefix) {
		try {
			File tempDir = File.createTempFile(prefix + ".", "." + getPort());
			tempDir.delete();
			tempDir.mkdir();
			tempDir.deleteOnExit();
			return tempDir;
		}

- https://github.com/spring-projects/spring-boot/blob/ce70e7d768977242a8ea6f93188388f273be5851/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/AbstractConfigurableWebServerFactory.java#L165-L177

This vulnerability exists because File.mkdir returns false when it fails to create a directory, it does not throw an exception. As such, the following race condition exists:

java
File tmpDir =File.createTempFile(prefix + ".", "." + getPort()); // Attacker knows the full path of the file that will be generated
// delete the file that was created
tmpDir.delete(); // Attacker sees file is deleted and begins a race to create their own directory before Jetty.
// and make a directory of the same name
// SECURITY VULNERABILITY: Race Condition! - Attacker beats java code and now owns this directory
tmpDir.mkdirs(); // This method returns 'false' because it was unable to create the directory. No exception is thrown.
// Attacker can write any new files to this directory that they wish.
// Attacker can read any files created by this process.

Prerequisites

This vulnerability impacts Unix-like systems, and very old versions of Mac OSX and Windows as they all share the system temporary directory between all users.

Patches

This vulnerability was inadvertently fixed as a part of this patch: https://github.com/spring-projects/spring-boot/commit/667ccdae84822072f9ea1a27ed5c77964c71002d

This vulnerability is patched in versions v2.2.11.RELEASE or later.

Workarounds

Setting the java.io.tmpdir system environment variable to a directory that is exclusively owned by the executing user will fix this vulnerability for all operating systems.

Betroffene Software

Klicken Sie auf eine Technologie, um alle zugehörigen Schwachstellen anzuzeigen.

PlattformPaketAnfällige VersionenBehoben in
Java / Kotlin (Maven) org.springframework.boot:spring-boot < 2.2.11.RELEASE 2.2.11.RELEASE

Verweise

CVSS-Wert 7.8/10
CVSS-Vektor
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H
Schwäche (CWE)
CWE-377, CWE-379, CWE-668
Plattform
Java / Kotlin (Maven)
Paket
org.springframework.boot:spring-boot
Veröffentlicht
11.07.2022
Aktualisiert
11.10.2026 12:22

Quellen und Lizenzen

OSV / GitHub Advisory Database - GHSA-cm59-pr5q-cw85 - CC BY 4.0

Schwachstellenhistorie: org.springframework.boot:spring-boot

Alle veröffentlichten Schwachstellen dieses Pakets (Java / Kotlin (Maven)), neueste zuerst. Zeigt, ob es ein einmaliger Ausrutscher ist oder ein Paket, das man im Auge behalten muss.

Einträge insgesamt
5
Erste → letzte
10.2018 04.2026
Ohne Fix
0
In Angriffen ausgenutzt
0

Verteilung nach Schweregrad

  • Kritisch 1
  • Hoch 3
  • Mittel 1

Veröffentlichungen pro Jahr

  1. 2018: 1
  2. 2019: 0
  3. 2020: 0
  4. 2021: 0
  5. 2022: 1
  6. 2023: 0
  7. 2024: 0
  8. 2025: 1
  9. 2026: 2
  1. Hoch · 7.0 CVE-2026-40973 >= 4.0.0, < 4.0.6, >= 3.5.0, < 3.5.14, >= 3.4.0, <= 3.4.15, >= 3.3.0, <= 3.3.18, <= 2.7.32 4.0.6, 3.5.14
  2. Hoch · 7.3 CVE-2025-22235 <= 2.7.24.2, >= 3.1.0, <= 3.1.15.2, >= 3.2.0, <= 3.2.13.2, >= 3.3.0, < 3.3.11, >= 3.4.0, < 3.4.5 3.3.11, 3.4.5
  3. Temporary Directory Hijacking to Local Privilege Escalation Vulnerability in org.springframework.boot:spring-boot dieser Eintrag
    Hoch · 7.8 CVE-2022-27772 < 2.2.11.RELEASE 2.2.11.RELEASE
  4. Mittel · 5.9 CVE-2018-1196 >= 1.5.0, < 1.5.10 1.5.10

Erkennen Sie Schwachstellen in Ihrer Anwendung

Mit der DockRay-Integration und aktivierter Softwareinventarisierung prüft DockRay gemeldete Komponentenversionen auf bekannte Schwachstellen und benachrichtigt Sie über bestätigte Treffer. Die Abdeckung hängt von der unterstützten Technologie und den verfügbaren Meldungen ab.

Anwendung verbinden
DockRay Newsletter

Anwendungssicherheit in Ihrem Postfach

Wichtige Schwachstellen, konkrete Empfehlungen und praktische Tipps für Ihre Anwendungen. Wählen Sie Ihre Technologien und verfolgen Sie, was für Ihr Projekt relevant ist.

  • Eine tägliche Zusammenfassung neuer Schwachstellen, auch kritischer.
  • Benachrichtigungen über wichtige Updates.
  • Praktische Tipps zur Sicherheit und Überwachung von Anwendungen.

Leer lassen, um Meldungen zu allen Technologien zu erhalten.

Kostenlos anmelden. In jeder E-Mail mit einem Klick abmelden.