CVE-2020-15250
JSON

4.4medium

Information disclosure in JUnit4

Severity
4.4medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.70% (higher than 77% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-269g-pwp5-87pp

Description

In JUnit4 from version 4.7 and before 4.13.1, the test rule TemporaryFolder contains a local information disclosure vulnerability. 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. This vulnerability impacts you if the JUnit tests write sensitive information, like API keys or passwords, into the temporary folder, and the JUnit tests execute in an environment where the OS has other untrusted users. 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. For Java 1.7 and higher users: this vulnerability is fixed in 4.13.1. For Java 1.6 and lower users: no patch is available, you must use the workaround below. 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. For more information, including an example of vulnerable code, see the referenced GitHub Security Advisory.

Affected

Product or packageVersionsReported by
junit-team junit4< 4.13.1CVE List
junit:junit (Maven)from 4.7 before 4.13.1GitHub Advisory Database
junit junit4from 4.7 before 4.13.1NVD
debian debian_linux9.0NVD
apache plutobefore 3.1.1NVD
oracle communications_cloud_native_core_policy1.14.0NVD

All scores

GitHub_M4.4medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:N/A:N
GitHub4.4medium CVSS:3.1CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:N/A:N
NVD5.5medium CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
NVD1.9low CVSS:2.0AV:L/AC:M/Au:N/C:P/I:N/A:N

Classification

CWE-200CWE-732

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

In JUnit4 from version 4.7 and before 4.13.1, the test rule TemporaryFolder contains a local information disclosure vulnerability. 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. This vulnerability impacts you if the JUnit tests write sensitive information, like API keys or passwords, into the temporary folder, and the JUnit tests execute in an environment where the OS has other untrusted users. 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. For Java 1.7 and higher users: this vulnerability is fixed in 4.13.1. For Java 1.6 and lower users: no patch is available, you must use the workaround below. 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. For more information, including an example of vulnerable code, see the referenced GitHub Security Advisory.

GitHub Advisory Database
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
        // ...
    }
}
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:

  1. 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.
  2. 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.
Patches

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.
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
Similar Vulnerabilities
For more information

If you have any questions or comments about this advisory, please pen an issue in junit-team/junit4.

NVD (es)

En JUnit4 desde la versión y antes de la versión 4.13.1, la regla de prueba TemporaryFolder contiene una vulnerabilidad de divulgación de información local. En sistemas similares a Unix, el directorio temporal del sistema es compartido entre todos los usuarios de ese sistema. Debido a esto, cuando los archivos y directorios se escribían en este directorio, son, por defecto, legibles por otros usuarios en ese mismo sistema. Esta vulnerabilidad no permite que otros usuarios sobrescriban el contenido de estos directorios o archivos. Esto es solamente una vulnerabilidad de divulgación de información. Esta vulnerabilidad lo impacta si las pruebas de JUnit escriben información confidencial, como claves de API o contraseñas, en la carpeta temporal, y las pruebas de JUnit son ejecutados en un entorno donde el sistema operativo posee otros usuarios que no son de confianza. Debido a que determinadas API del sistema de archivos JDK solo fueron agregadas en JDK versión 1.7. Esta corrección depende de la versión del JDK que esté usando. Para usuarios de Java versión 1.7 y posteriores: esta vulnerabilidad se corrigió en la versión 4.13.1. Para usuarios de Java versión 1.6 y anteriores: ningún parche está disponible, debe utilizar la siguiente solución. Si no es capaz de parchear, o está bloqueado al ejecutar Java versión 1.6, especificar la variable de entorno del sistema "java.io.tmpdir" en un directorio que es propiedad exclusiva del usuario que lo ejecuta, solucionará esta vulnerabilidad. Para más información, se incluye un ejemplo del código vulnerable, consulte el Aviso de Seguridad de GitHub al que se hace referencia

References

https://github.com/junit-team/junit4/security/advisories/GHSA-269g-pwp5-87ppexploit, third-party-advisory, web
https://github.com/junit-team/junit4/commit/610155b8c22138329f0723eec22521627dbc52aepatch, third-party-advisory, web
https://github.com/junit-team/junit4/blob/7852b90cfe1cea1e0cdaa19d490c83f0d8684b50/doc/ReleaseNotes4.13.1.mdrelease-notes, third-party-advisory, web
https://junit.org/junit4/javadoc/4.13/org/junit/rules/TemporaryFolder.htmlvendor-advisory, web
https://lists.apache.org/thread.html/r5f8841507576f595bb783ccec6a7cb285ea90d4e6f5043eae0e61a41%40%3Cdev.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/rbaec90e699bc7c7bd9a053f76707a36fda48b6d558f31dc79147dbf9%40%3Cdev.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/r717877028482c55acf604d7a0106af4ca05da4208c708fb157b53672%40%3Ccommits.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/rb2771949c676ca984e58a5cd5ca79c2634dee1945e0406e48e0f8457%40%3Cdev.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/rde385b8b53ed046600ef68dd6b4528dea7566aaddb02c3e702cc28bc%40%3Ccommits.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/rc49cf1547ef6cac1be4b3c92339b2cae0acacf5acaba13cfa429a872%40%3Cdev.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/r500517c23200fb2fdb0b82770a62dd6c88b3521cfb01cfd0c76e3f8b%40%3Cdev.creadur.apache.org%3Emailing-list
https://lists.apache.org/thread.html/r95f8ef60c4b3a5284b647bb3132cda08e6fadad888a66b84f49da0b0%40%3Ccommits.creadur.apache.org%3Emailing-list

Sources

SourceRecordLicence
CVE ListCVE-2020-15250 changed 2026-10-07CVE Terms of Use
GitHub Advisory DatabaseGHSA-269g-pwp5-87pp changed 2026-09-10CC-BY-4.0
NVDCVE-2020-15250 changed 2026-10-07Public domain