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 b9c3d09 commit 1dfecdd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/hockeyapp/HockeyappRecorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import hudson.scm.ChangeLogSet.Entry;
import java.io.*;
import java.nio.file.Files;
import java.util.*;

import net.sf.json.JSONObject;
Expand Down Expand Up @@ -137,9 +138,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
EnvVars vars = build.getEnvironment(listener);

// Copy remote file to local file system.
tempDir = File.createTempFile("jtf", null);
tempDir.delete();
tempDir.mkdirs();
tempDir = Files.createTempDirectory("jtf").toFile();

File file = getFileLocally(build.getWorkspace(),
vars.expand(filePath), tempDir);
Expand Down

0 comments on commit 1dfecdd

Please sign in to comment.