AI for Security Summit: Join Figma, Perplexity & Wiz. [Register]

CVE-2021-20202
Java vulnerability analysis and mitigation

Overview

A temporary directory hijacking vulnerability was discovered in Keycloak, identified as CVE-2021-20202. The vulnerability was discovered on January 29, 2021, and affects Unix-like systems (excluding MacOS) where the system temporary directory is shared between all users. The issue stems from incorrect file permissions and directory creation verification in the Java process (Red Hat Bugzilla).

Technical details

The vulnerability occurs because directories can be created prior to the Java process creating them in the temporary directory, but with wider user permissions. Since the directory names are not randomized, an attacker can create these directories ahead of Keycloak. When this happens, the Java process doesn't complain about pre-existing directories, with mkdir and mkdirs simply returning false. By default, directories are created with drwxr-xr-x permissions, allowing malicious local users to read the contents of the temporary directory (Red Hat Bugzilla).

Impact

The vulnerability can lead to local information disclosure or local file hijacking by another user. In the worst-case scenario, this could result in a local privilege escalation vulnerability. The issue allows malicious local users to read the contents of the temporary directory, potentially compromising sensitive information (Red Hat Bugzilla).

Exploitability

The vulnerability can be exploited by local attackers who can create directories before the Java process initializes them. Since the directory names are predictable and not randomized, exploitation is straightforward for attackers with local access to the system (Red Hat Bugzilla).

Mitigation and workarounds

The recommended mitigation is to switch to the Files API, which allows exclusive setting of file permissions when creating directories or creating temporary directories. This vulnerability was addressed in Keycloak version 13.0.0 (Red Hat Bugzilla).

Community reactions

The vulnerability was discovered and reported by security researcher Jonathan Leitschuh (Twitter: JLLeitschuh) (Red Hat Bugzilla).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Arch Linux

Fixed

rolling

keycloak: 13.0.0-1

Fixed

SourceThis report was generated using AI

Related Java vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-69205HIGH8.7
  • Java logoJava
  • org.http4s:http4s-ember-core_2.12
NoYesSep 15, 2026
CVE-2026-88975HIGH7.5
  • Java logoJava
  • org.http4s:http4s-ember-core_2.12
NoYesSep 15, 2026
CVE-2026-69218HIGH7.5
  • Java logoJava
  • org.http4s:http4s-ember-core_2.12
NoYesSep 15, 2026
CVE-2026-69215MEDIUM6.8
  • Java logoJava
  • org.http4s:http4s-client_2.12
NoYesSep 15, 2026
CVE-2026-69206MEDIUM5.9
  • Java logoJava
  • org.http4s:http4s-ember-core_2.12
NoYesSep 15, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management