Skip to content

Commit

Permalink
vuln-fix: Temporary Directory Hijacking or Information Disclosure
Browse files Browse the repository at this point in the history
This fixes either Temporary Directory Hijacking, or Temporary Directory Local Information Disclosure.

Weakness: CWE-379: Creation of Temporary File in Directory with Insecure Permissions
Severity: High
CVSSS: 7.3
Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.UseFilesCreateTempDirectory)

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

Bug-tracker: JLLeitschuh/security-research#10

Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
Jonathan Leitschuh and TeamModerne committed Jul 27, 2022
1 parent 0b4f1e6 commit b6ceb60
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import junit.framework.Assert;

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

/**
*
Expand All @@ -16,9 +17,7 @@ public class VectorCASTPublisherTest extends AbstractVectorCASTTestBase {
public void testLocateReports() throws Exception {

// Create a temporary workspace in the system
File w = File.createTempFile("workspace", ".test");
w.delete();
w.mkdir();
File w = Files.createTempDirectory("workspace" + ".test").toFile();
w.deleteOnExit();
FilePath workspace = new FilePath(w);

Expand Down Expand Up @@ -63,4 +62,4 @@ public void testLocateReports() throws Exception {

}

}
}

0 comments on commit b6ceb60

Please sign in to comment.