Skip to main content

CVE-2022-21126: Creation of Temporary File in Directory with Insecure Permissions in com.github.samtools:htsjdk

Medium
Published: Tue Nov 29 2022 (11/29/2022, 16:50:19 UTC)
Source: CVE
Vendor/Project: n/a
Product: com.github.samtools:htsjdk

Description

The package com.github.samtools:htsjdk before 3.0.1 are vulnerable to Creation of Temporary File in Directory with Insecure Permissions due to the createTempDir() function in util/IOUtil.java not checking for the existence of the temporary directory before attempting to create it.

AI-Powered Analysis

AILast updated: 06/24/2025, 07:42:41 UTC

Technical Analysis

CVE-2022-21126 is a vulnerability identified in the Java library com.github.samtools:htsjdk, specifically affecting versions prior to 3.0.1. The vulnerability arises from the createTempDir() function located in util/IOUtil.java, which improperly handles the creation of temporary directories. The function does not verify whether the temporary directory already exists before attempting to create it. This oversight can lead to the creation of temporary files in directories with insecure permissions. Insecure permissions on temporary directories or files can allow unauthorized users or processes on the same system to access, modify, or replace these files, potentially leading to information disclosure, privilege escalation, or arbitrary code execution depending on the context in which the temporary files are used. The vulnerability is classified as a medium severity issue and does not currently have any known exploits in the wild. The lack of proper checks in the temporary directory creation process is a common security weakness that can be exploited in multi-user environments or systems where untrusted users have some level of access. Since htsjdk is a widely used Java API for processing high-throughput sequencing data (commonly used in bioinformatics and genomics), the vulnerability could affect applications and services relying on this library for handling sensitive genomic data. The vulnerability does not require authentication or user interaction to be exploited if an attacker has access to the system where the library is used. However, exploitation requires local access or the ability to influence the environment where the temporary files are created. No CVSS score is provided, but the medium severity rating reflects a moderate risk based on the potential for unauthorized access to temporary files and the impact on confidentiality and integrity of data processed by the library.

Potential Impact

For European organizations, particularly those involved in biomedical research, healthcare, and genomics, this vulnerability could pose a risk to the confidentiality and integrity of sensitive genomic data. Unauthorized access or tampering with temporary files could lead to leakage of personally identifiable genetic information or manipulation of data processing results, undermining research validity and patient privacy. The impact is heightened in multi-user environments such as shared research computing clusters or cloud-based bioinformatics platforms common in European research institutions. While the vulnerability does not directly affect availability, the potential for privilege escalation or code injection could lead to broader system compromise if chained with other vulnerabilities. Organizations handling regulated health data under GDPR must be particularly cautious, as data breaches involving genetic information can have severe legal and reputational consequences. The absence of known exploits reduces immediate risk, but the widespread use of htsjdk in European research and healthcare sectors means that unpatched systems remain vulnerable to potential future attacks.

Mitigation Recommendations

European organizations should prioritize updating the com.github.samtools:htsjdk library to version 3.0.1 or later, where the vulnerability has been addressed. If immediate upgrading is not feasible, organizations should implement strict file system permissions on directories used for temporary file creation to restrict access only to authorized users and processes. Employing application sandboxing or containerization can limit the impact of potential exploitation by isolating the environment where temporary files are created. Additionally, monitoring file system changes and access patterns in temporary directories can help detect suspicious activity indicative of exploitation attempts. Organizations should also review and harden their development and deployment practices to ensure that temporary files are created securely, including validating directory existence and permissions programmatically. For cloud or shared environments, enforcing strict access controls and user isolation is critical. Finally, raising awareness among developers and system administrators about secure temporary file handling practices will help prevent similar vulnerabilities in the future.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
snyk
Date Reserved
2022-02-24T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d983fc4522896dcbf0b67

Added to database: 5/21/2025, 9:09:19 AM

Last enriched: 6/24/2025, 7:42:41 AM

Last updated: 8/11/2025, 12:10:39 PM

Views: 13

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats