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 <[email protected]>
Signed-off-by: Jonathan Leitschuh <[email protected]>

Bug-tracker: JLLeitschuh/security-research#18


Co-authored-by: Moderne <[email protected]>
  • Loading branch information
2 people authored and JLLeitschuh committed Nov 19, 2022
1 parent a77431a commit 776647a
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 776647a

Please sign in to comment.