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

Bug-tracker: JLLeitschuh/security-research#10

Co-authored-by: Moderne <[email protected]>
  • Loading branch information
JLLeitschuh and TeamModerne committed Jul 27, 2022
1 parent 0b1a24c commit ed37067
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
Expand Down Expand Up @@ -153,9 +154,7 @@ public void setup() {
public void initTest() throws IOException {

//Setup distribution channel
tempDistributionChannelRoot = File.createTempFile("temp", Long.toString(System.nanoTime()));
tempDistributionChannelRoot.delete();
tempDistributionChannelRoot.mkdir();
tempDistributionChannelRoot = Files.createTempDirectory("temp" + Long.toString(System.nanoTime())).toFile();


DistributionChannel distributionChannel = new DistributionChannel();
Expand Down

0 comments on commit ed37067

Please sign in to comment.