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 <Jonathan.Leitschuh@gmail.com>
Signed-off-by: Jonathan Leitschuh <Jonathan.Leitschuh@gmail.com>

Bug-tracker: JLLeitschuh/security-research#18


Co-authored-by: Moderne <team@moderne.io>
  • Loading branch information
2 people authored and tdunning committed Nov 20, 2022
1 parent adf58aa commit 1e7bd9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/org/apache/mahout/pig/LogisticRegression.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.pig.impl.util.UDFContext;

import java.io.*;
import java.nio.file.Files;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -159,7 +160,7 @@ public LogisticRegression(String modelParams) throws IOException {
}

if (!inMemory) {
tmpFile = File.createTempFile("trainingData", "tmp");
tmpFile = Files.createTempFile("trainingData", "tmp").toFile();
tmpFile.deleteOnExit();
}
}
Expand Down

0 comments on commit 1e7bd9f

Please sign in to comment.