CVE-2022-24913: Java Merge-sort Insecure Temporary File vulnerability in com.fasterxml.util:java-merge-sort
Summary
CVE-2022-24913: Java Merge-sort Insecure Temporary File vulnerability. Affects com.fasterxml.util:java-merge-sort versions < 1.1.0. Fixed in 1.1.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The package com.fasterxml.util:java-merge-sort is a Java library that provides merge-sort functionality. It is commonly used in applications that require sorting large datasets efficiently. This package uses temporary files during the sorting process to store intermediate results. However, versions before 1.1.0 are vulnerable to an Insecure Temporary File issue in the StdTempFileProvider() function in StdTempFileProvider.java. This function uses the permissive File.createTempFile() function, which exposes the contents of temporary files.
Vulnerability Detail
The Insecure Temporary File vulnerability in com.fasterxml.util:java-merge-sort allows an attacker to access the contents of temporary files created during the sorting process. This can lead to unauthorized disclosure of sensitive information stored in these files. The vulnerability arises from the use of the permissive File.createTempFile() function, which does not enforce proper file permissions. An attacker with local access to the system can exploit this vulnerability to read the temporary file contents and potentially extract sensitive data.
How To Fix
Minimum fixed version
1.1.0
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can manually modify the code in StdTempFileProvider.java to use a more secure method for creating temporary files. One possible approach is to use the Files.createTempFile() method from the Java NIO API, which provides better control over file permissions. Here is an example of the modified code:
import java.nio.file.Files;
import java.nio.file.Path;
public class StdTempFileProvider {
public File createTempFile() throws IOException {
Path tempFilePath = Files.createTempFile(null, null);
return tempFilePath.toFile();
}
}
Conclusion
The Insecure Temporary File vulnerability in com.fasterxml.util:java-merge-sort exposes the contents of temporary files, potentially leading to unauthorized disclosure of sensitive information. To mitigate this vulnerability, it is recommended to upgrade to version 1.1.0 or later. A temporary workaround is also available by modifying the code in StdTempFileProvider.java. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for com.fasterxml.util:java-merge-sort →
FAQ
This vulnerability allows an attacker with local access to the system to read the contents of temporary files created during the sorting process. This can potentially lead to unauthorized disclosure of sensitive information stored in these files.
No, only versions before 1.1.0 are affected. It is recommended to upgrade to version 1.1.0 or later to mitigate the vulnerability.
Yes, a temporary workaround is to modify the code in StdTempFileProvider.java to use a more secure method for creating temporary files, such as Files.createTempFile() from the Java NIO API. Please refer to the 'workaround' section for an example.
Yes, the vulnerability has been fixed in version 1.1.0 of com.fasterxml.util:java-merge-sort. It is recommended to upgrade to this version or later.
You can find more information about this vulnerability in the GitHub Advisory Database: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/01/GHSA-qxxc-7mq4-mf79/GHSA-qxxc-7mq4-mf79.json