Skip to content

Commit

Permalink
[MPLUGIN-453] Fix Temporary File Information Disclosure (#176)
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]>


Bug-tracker: JLLeitschuh/security-research#18

Co-authored-by: Moderne <[email protected]>
Co-authored-by: Guillaume Nodet <[email protected]>
  • Loading branch information
3 people authored Feb 13, 2023
1 parent ce49816 commit 52be8fa
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.Reader;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -140,7 +141,7 @@ private List<String> run(String pluginXml)

File pluginXmlFile = Paths.get(resource.toURI()).toFile();

File jarFile = File.createTempFile("AntMojoWrapperTest.", ".test.jar");
File jarFile = Files.createTempFile("AntMojoWrapperTest.", ".test.jar").toFile();
jarFile.deleteOnExit();

JarArchiver archiver = new JarArchiver();
Expand Down

0 comments on commit 52be8fa

Please sign in to comment.