{"id":"CVE-2022-27772","aliases":["CVE-2022-27772","GHSA-cm59-pr5q-cw85"],"related":[],"kind":"vulnerability","state":"published","title":"Temporary Directory Hijacking to Local Privilege Escalation Vulnerability in org.springframework.boot:spring-boot","summary":"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. NOTE: This vulnerability only affects products and/or versions that are no longer supported by the maintainer","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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. NOTE: This vulnerability only affects products and/or versions that are no longer supported by the maintainer","source":"cvelist"},{"lang":"en","text":"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.\n\nThe 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).\n\n#### Impact Location\n\nThis vulnerability impacted the following source location:\n\n```java\n\t/**\n\t * Return the absolute temp dir for given web server.\n\t * @param prefix server name\n\t * @return the temp dir for given server.\n\t */\n\tprotected final File createTempDir(String prefix) {\n\t\ttry {\n\t\t\tFile tempDir = File.createTempFile(prefix + \".\", \".\" + getPort());\n\t\t\ttempDir.delete();\n\t\t\ttempDir.mkdir();\n\t\t\ttempDir.deleteOnExit();\n\t\t\treturn tempDir;\n\t\t}\n```\n\\- 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\n\nThis 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:\n\n```java\nFile tmpDir =File.createTempFile(prefix + \".\", \".\" + getPort()); // Attacker knows the full path of the file that will be generated\n// delete the file that was created\ntmpDir.delete(); // Attacker sees file is deleted and begins a race to create their own directory before Jetty.\n// and make a directory of the same name\n// SECURITY VULNERABILITY: Race Condition! - Attacker beats java code and now owns this directory\ntmpDir.mkdirs(); // This method returns 'false' because it was unable to create the directory. No exception is thrown.\n// Attacker can write any new files to this directory that they wish.\n// Attacker can read any files created by this process.\n```\n\n### Prerequisites\n\nThis 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.\n\n### Patches\n\nThis vulnerability was inadvertently fixed as a part of this patch: https://github.com/spring-projects/spring-boot/commit/667ccdae84822072f9ea1a27ed5c77964c71002d\n\nThis vulnerability is patched in versions `v2.2.11.RELEASE` or later.\n\n### Workarounds\n\nSetting 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"** NO SOPORTADO CUANDO SE ASIGNÓ ** spring-boot versiones anteriores a v2.2.11.RELEASE eran vulnerables a un secuestro de directorios temporales. Esta vulnerabilidad afectaba al método org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir. NOTA: Esta vulnerabilidad sólo afecta a productos y/o versiones que ya no son soportadas por el mantenedor","source":"nvd"}],"published":"2022-03-30T17:45:42.000Z","modified":"2026-07-08T06:29:40.989Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:L/AC:L/Au:N/C:P/I:P/A:P","score":4.6,"rating":"MEDIUM"}],"cwes":["CWE-377","CWE-379","CWE-668"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.2.11.RELEASE"}],"ecosystem":"Maven","package":"org.springframework.boot:spring-boot","purl":"pkg:maven/org.springframework.boot/spring-boot","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.2.11"}],"vendor":"vmware","product":"spring_boot","cpe":"cpe:2.3:a:vmware:spring_boot:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/JLLeitschuh/security-research/security/advisories/GHSA-cm59-pr5q-cw85","tags":["exploit","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-27772","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/spring-projects/spring-boot/commit/667ccdae84822072f9ea1a27ed5c77964c71002d","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/spring-projects/spring-boot","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-27772","url":"https://www.cve.org/CVERecord?id=CVE-2022-27772","licence":"CVE Terms of Use","modified":"2024-08-03T05:32:59.831Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cm59-pr5q-cw85","url":"https://github.com/advisories/GHSA-cm59-pr5q-cw85","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:40.989Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-27772","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-27772","licence":"Public domain","modified":"2026-06-17T04:37:28.637Z"}],"updatedAt":"2026-11-25T22:58:10.345Z","epss":{"score":0.00592,"percentile":0.4968,"date":"2026-12-01T12:00:22.000Z"}}