Skip to content

Commit

Permalink
vuln-fix: Temporary File Information Disclosure
Browse files Browse the repository at this point in the history
This fixes temporary file information disclosure vulnerability due to the use
of the vulnerable `File.createTempFile()` method. The vulnerability is fixed by
using the `Files.createTempFile()` method which sets the correct posix permissions.

Weakness: CWE-377: Insecure Temporary File
Severity: Medium
CVSSS: 5.5
Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.SecureTempFileCreation)

Reported-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>
Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>

Bug-tracker: JLLeitschuh/security-research#18


Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
JLLeitschuh and TeamModerne committed Nov 19, 2022
1 parent 83b29a8 commit 450fdee
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.fasterxml.sort.std;

import java.io.*;
import java.nio.file.Files;

import com.fasterxml.sort.TempFileProvider;

Expand Down Expand Up @@ -35,7 +36,7 @@ public StdTempFileProvider(String prefix, String suffix) {
@Override
public File provide() throws IOException
{
File f = File.createTempFile(_prefix, _suffix);
File f = Files.createTempFile(_prefix, _suffix).toFile();
f.deleteOnExit();
return f;
}
Expand Down

0 comments on commit 450fdee

Please sign in to comment.