Summary
TemporaryFolder on unix-like systems does not limit access to created files
Vulnerability
The JUnit4 test rule TemporaryFolder contains a local information disclosure vulnerability.
Example of vulnerable code:
public static class HasTempFolder {
@Rule
public TemporaryFolder folder = new TemporaryFolder();
@Test
public void testUsingTempFolder() throws IOException {
folder.getRoot(); // Previous file permissions: `drwxr-xr-x`; After fix:`drwx------`
File createdFile= folder.newFile("myfile.txt"); // unchanged/irrelevant file permissions
File createdFolder= folder.newFolder("subfolder"); // unchanged/irrelevant file permissions
// ...
}
}
Workarounds
If you are unable to patch, or are stuck running on Java 1.6, specifying the java.io.tmpdir system environment variable to a directory that is exclusively owned by the executing user will fix this vulnerability.
References
- CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
- Fix commit https://github.com/junit-team/junit4/commit/610155b8c22138329f0723eec22521627dbc52ae
Similar Vulnerabilities
- Google Guava - https://github.com/google/guava/issues/4011
- Apache Ant - https://nvd.nist.gov/vuln/detail/CVE-2020-1945
- JetBrains Kotlin Compiler - https://nvd.nist.gov/vuln/detail/CVE-2020-15824
For more information
If you have any questions or comments about this advisory, please pen an issue in junit-team/junit4.
Impact
On Unix like systems, the system's temporary directory is shared between all users on that system. Because of this, when files and directories are written into this directory they are, by default, readable by other users on that same system.
This vulnerability does not allow other users to overwrite the contents of these directories or files. This is purely an information disclosure vulnerability.
When analyzing the impact of this vulnerability, here are the important questions to ask:
- Do the JUnit tests write sensitive information, like API keys or passwords, into the temporary folder?
- If yes, this vulnerability impacts you, but only if you also answer 'yes' to question 2.
- If no, this vulnerability does not impact you.
- Do the JUnit tests ever execute in an environment where the OS has other untrusted users.
This may apply in CI/CD environments but normally won't be 'yes' for personal developer machines.- If yes, and you answered 'yes' to question 1, this vulnerability impacts you.
- If no, this vulnerability does not impact you.
A file, directory, or other resource is assigned permissions that allow broader access than intended. Typical impact: unauthorized read, modification, or execution of the resource.
CVE-2020-15250 has a CVSS score of 4.4 (Medium). The vector is requires local access, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (4.13.1); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Because certain JDK file system APIs were only added in JDK 1.7, this this fix is dependent upon the version of the JDK you are using.
- Java 1.7 and higher users: this vulnerability is fixed in 4.13.1.
- Java 1.6 and lower users: no patch is available, you must use the workaround below.
Frequently Asked Questions
- What is CVE-2020-15250? CVE-2020-15250 is a medium-severity incorrect permission assignment for critical resource vulnerability in junit:junit (maven), affecting versions >= 4.7, < 4.13.1. It is fixed in 4.13.1. A file, directory, or other resource is assigned permissions that allow broader access than intended.
- How severe is CVE-2020-15250? CVE-2020-15250 has a CVSS score of 4.4 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of junit:junit are affected by CVE-2020-15250? junit:junit (maven) versions >= 4.7, < 4.13.1 is affected.
- Is there a fix for CVE-2020-15250? Yes. CVE-2020-15250 is fixed in 4.13.1. Upgrade to this version or later.
- Is CVE-2020-15250 exploitable, and should I be worried? Whether CVE-2020-15250 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2020-15250 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2020-15250? Upgrade
junit:junitto 4.13.1 or later.