CVE-2021-28168 is a medium-severity (CVSS 5.5) CWE-378 vulnerability in org.glassfish.jersey.core:jersey-common. 2 public exploit references exist, so weaponization risk is real. A fix is available for org.glassfish.jersey.core:jersey-common — see the affected versions and patch details below.
Local information disclosure via system temporary directory
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-28168 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 395,308 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
org.glassfish.jersey.core:jersey-common☕org.glassfish.jersey.core:jersey-commonReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Maven packages — download data is not available via public APIs for these ecosystems.
Description
Impact
Eclipse Jersey 2.28 - 2.33 and Eclipse Jersey 3.0.0 - 3.0.1 contains a local information disclosure vulnerability. This is due to the use of the File.createTempFile which creates a file inside of the system temporary directory with the permissions: -rw-r--r--. Thus the contents of this file are viewable by all other users locally on the system. As such, if the contents written is security sensitive, it can be disclosed to other local users.
Workaround
This issue can be mitigated by manually setting the java.io.tmpdir system property when launching the JVM.
Patches
Jersey 2.34 and 3.0.2 forward sets the correct permissions on the temporary file created by Jersey.
References
- https://github.com/eclipse-ee4j/jersey/pull/4712
- CWE-378: Creation of Temporary File With Insecure Permissions
- CWE-379: Creation of Temporary File in Directory with Insecure Permissions
Similar Vulnerabilities
Similar, but not the same:
- JUnit 4 - https://github.com/junit-team/junit4/security/advisories/GHSA-269g-pwp5-87pp
- 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
- Eclipse Jetty - https://github.com/eclipse/jetty.project/security/advisories/GHSA-g3wg-6mcf-8jj6
Original Disclosure:
Hello Jersey Security Team,
Utilizing a custom CodeQL query written as a part of the GitHub Security Lab Bug Bounty program, I've unearthed a local temporary file information disclosure vulnerability.
You can see the custom CodeQL query utilized here: https://lgtm.com/query/8831016213790320486/
This particular vulnerability exists because on unix-like systems (not including modern versions of MacOS) the system temporary directory is shared between all users. As such, failure to correctly set file permissions and/or verify exclusive creation of directories can lead to either local information disclosure, or local file hijacking by another user.
This vulnerability impacts the following locations in this project's source:
- https://github.com/eclipse-ee4j/jersey/blob/01c6a32a2064aeff2caa8133472e33affeb8a29a/core-common/src/main/java/org/glassfish/jersey/message/internal/FileProvider.java#L64-L73
- https://github.com/eclipse-ee4j/jersey/blob/01c6a32a2064aeff2caa8133472e33affeb8a29a/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/internal/FormDataParamValueParamProvider.java#L202-L208
This vulnerability exists because of the vulnerability in the
Utils.createTempFile:This is because
File.createTempFilecreates a file inside of the system temporary directory with the permissions:-rw-r--r--. Thus the contents of this file are viewable by all other users locally on the system.If there is sensitive information written to these files, it is disclosed to other local users on this system.
The fix for this vulnerability is to use the
FilesAPI (instead of theFileAPI) to create temporary files/directories as this new API correctly sets the posix file permissions.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| ☕Maven | org.glassfish.jersey.core:jersey-common | ≥ 2.28&&< 2.34 | 2.34org.glassfish.jersey.core:jersey-common:2.34 |
| ☕Maven | org.glassfish.jersey.core:jersey-common | ≥ 3.0.0&&< 3.0.2 | 3.0.2org.glassfish.jersey.core:jersey-common:3.0.2 |
Affected Products
jerseyeclipsecommunications cloud native core policyoraclecommunications cloud native core unified data repositoryoracleResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for org.glassfish.jersey.core:jersey-common, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update org.glassfish.jersey.core:jersey-common to 2.34 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-28168 is resolved across your whole dependency graph.
Workarounds
Assume what was exposed is already known: rotate any credential, token or key that the affected component could return, restrict the endpoint to callers that genuinely need it, and strip sensitive fields from responses and error output at the boundary rather than relying on the client not to read them.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Red Hat OpenStack Platform's OpenDaylight will not be updated for this flaw because it was deprecated as of OpenStack Platform 14 and is only receiving security fixes for Important and Critical flaws.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat AMQ Streams 1.8.0 | jersey-common | RHSA-2021:3225 |
| RHINT Camel-K 1.6.4 | jersey-common | RHSA-2022:1029 |
| RHINT Camel-Q 2.2.1 | see advisory | RHSA-2022:1013 |
Frequently Asked Questions
Is CVE-2021-28168 in your dependencies?
Find it across Maven, including transitive dependencies.