Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Sun, 6 Dec 2020 14:21:31 +1000
From: Paul King <>
Subject: [CVE-2020-17521]: Apache Groovy Information Disclosure

CVE-2020-17521 Apache Groovy Information Disclosure

Severity: Important

Vendor: The Apache Software Foundation

Versions Affected:

Unsupported Codehaus versions of Groovy from 2.0 to 2.4.4.
Apache Groovy versions 2.4.4 to 2.4.20, 2.5.0 to 2.5.13,
3.0.0 to 3.0.6, and 4.0.0-alpha-1.

Fixed in versions 2.4.21, 2.5.14, 3.0.7, 4.0.0-alpha-2


This vulnerability potentially impacts Unix-like systems, and very old
versions of Mac OSX and Windows. On such OS versions, Groovy may create
temporary directories within the OS temporary directory which is shared
between all users on affected systems. Groovy will create such directories
for internal use when producing Java Stubs (very low impact) or on behalf
of user code via two extension methods[4,5] for creating temporary
If Groovy user code uses either of these extension methods, and stores
executable code in the resulting temporary directory, then the risk is high,
since this can lead to local privilege escalation. If such Groovy code is
use of the temporary directory to store sensitive information, then the
risk is
medium, since such information could be exposed or modified.

When analyzing the impact of this vulnerability, here are the important
questions to ask:

Is the Groovy code running on a machine with an impacted operating system?
Do other users have access to the machine running the Groovy code?
Does the Groovy code create temporary directories using Groovy's
createTempDir extension methods[4,5]?

If you answer no to any of these questions, you are not affected.
If you answered yes, does the Groovy code write or store executable code
in the temporary directory? If you answer yes, the risk is high, and can
lead to
local privilege escalation. Does the Groovy code write sensitive
like API keys or passwords, into the temporary directory? If you answer yes,
the risk is medium, and information may be exposed or modified.


Groovy was making use of a method in the JDK which is now flagged as not
suitable for security-sensitive contexts. In addition, Groovy wasn't
a flag related to successful creation of the temporary directory which leads
to a race condition whereby the vulnerability exists[1].

For the fixed versions, Groovy 2.5 and above is now using a newer JDK method
which creates a directory that is only readable by the user running the
code. The same is true for the fixed Groovy 2.4 version except if running
on a pre-JDK7 version of the JDK in which case a fallback implementation is
used which now checks for successful creation of the temporary directory.
This eliminates the high-risk scenario involving the race condition whereby
executables or information could be modified, but still leaves the potential
for sensitive information leakage. Groovy 2.4/JDK 6 users are recommended
to use the `` mitigation.


Setting the `` system environment variable to a directory
that is exclusively owned by the executing user will fix this vulnerability
for all operating systems and all Groovy versions.

Users who cannot easily move to the fixed Groovy versions may wish to
consider using the JDK's Files#createTempDirectory method instead of the
Groovy extension methods.


This vulnerability was discovered by Jonathan Leitschuh (

Similar Vulnerabilities:

* Jetty -
* JUnit4 -
* Google Guava -
* Apache Ant -
* JetBrains Kotlin Compiler -


[1] CWE-379: Creation of Temporary File in Directory with Insecure
Permissions (
[2] "File.createTempFile" should not be used to create a directory (
[3] Groovy CVE list (
[6] related Jira issue:

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.