CVE-2022-21126
Java vulnerability analysis and mitigation

Overview

The vulnerability CVE-2022-21126 affects the package com.github.samtools:htsjdk versions before 3.0.1. The vulnerability is related to the Creation of Temporary File in Directory with Insecure Permissions, specifically in the createTempDir() function within util/IOUtil.java. The issue stems from the function not checking for the existence of the temporary directory before attempting to create it (Snyk Advisory).

Technical details

The vulnerability exists due to an insecure implementation of temporary directory creation. The issue occurs in a chain of calls involving File.createTempFile(..) followed by file.delete() and either file.mkdir() or file.mkdirs(). This implementation doesn't properly verify the success of directory creation operations, leading to potential security issues. The CVSS v3.1 base score is 7.3 (High), with the vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L (Snyk Advisory, GitHub PR).

Impact

The vulnerability can have two potential impacts: 1) Temporary Directory Information Disclosure - allowing malicious actors co-resident on the same machine to view potentially sensitive files, and 2) Temporary Directory Hijacking - which not only allows viewing but also manipulation of directory contents. In the case of code execution from this temporary directory, it could potentially lead to local privilege escalation (GitHub PR).

Exploitability

The vulnerability is easily exploitable by an unauthenticated attacker with network access. The attack complexity is low, requiring no privileges or user interaction. The vulnerability can be exploited through a race condition where an attacker can create their own directory before the java code, gaining ownership and the ability to read or write files in that directory (GitHub PR).

Mitigation and workarounds

The recommended fix is to upgrade com.github.samtools:htsjdk to version 3.0.1 or higher. The vulnerability was fixed by replacing the insecure implementation with Java's Files.createTempDirectory() API, which creates directories securely with random, non-conflicting names and proper permissions that only allow the currently executing user to read or write the contents (GitHub Commit, GitHub PR).

Additional resources


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-73644CRITICAL9.6
  • Java logoJava
  • org.openidentityplatform.opendj:opendj-server-legacy
NoYesAug 13, 2026
CVE-2026-73507HIGH7.5
  • Java logoJava
  • io.netty:netty-codec-xml
NoYesAug 13, 2026
CVE-2026-49989HIGH7.1
  • Java logoJava
  • io.crate:crate
NoYesAug 14, 2026
CVE-2026-53660HIGH7
  • Java logoJava
  • org.openidentityplatform.openam:openam-core
NoYesAug 14, 2026
CVE-2026-73508MEDIUM5.3
  • Java logoJava
  • keycloak-fips-26.7
NoYesAug 13, 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