Skip to content

Commit 80a49a1

Browse files
committed
Added product and cve columns to report. v2.3.6
1 parent c042d21 commit 80a49a1

File tree

6 files changed

+38
-20
lines changed

6 files changed

+38
-20
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
log4j2-scan is a single binary command-line tool for CVE-2021-44228 vulnerability scanning and mitigation patch. It also supports nested JAR file scanning and patch. It also detects CVE-2021-45046 (log4j 2.15.0), CVE-2021-45105 (log4j 2.16.0), CVE-2021-4104 (log4j 1.x), and CVE-2021-42550 (logback 0.9-1.2.7) vulnerabilities.
44

55
### Download
6-
* [log4j2-scan 2.3.5 (Windows x64, 7z)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.5/logpresso-log4j2-scan-2.3.5-win64.7z)
7-
* [log4j2-scan 2.3.5 (Windows x64, zip)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.5/logpresso-log4j2-scan-2.3.5-win64.zip)
6+
* [log4j2-scan 2.3.6 (Windows x64, 7z)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.6/logpresso-log4j2-scan-2.3.6-win64.7z)
7+
* [log4j2-scan 2.3.6 (Windows x64, zip)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.6/logpresso-log4j2-scan-2.3.6-win64.zip)
88
* If you get `VCRUNTIME140.dll not found` error, install [Visual C++ Redistributable](https://docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170).
99
* If native executable doesn't work, use the JAR instead. 32bit is not supported.
1010
* 7zip is available from www.7zip.org, and is open source and free.
11-
* [log4j2-scan 2.3.5 (Linux x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.5/logpresso-log4j2-scan-2.3.5-linux.tar.gz)
12-
* [log4j2-scan 2.3.5 (Linux aarch64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.5/logpresso-log4j2-scan-2.3.5-linux-aarch64.tar.gz)
11+
* [log4j2-scan 2.3.6 (Linux x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.6/logpresso-log4j2-scan-2.3.6-linux.tar.gz)
12+
* [log4j2-scan 2.3.6 (Linux aarch64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.6/logpresso-log4j2-scan-2.3.6-linux-aarch64.tar.gz)
1313
* If native executable doesn't work, use the JAR instead. 32bit is not supported.
14-
* [log4j2-scan 2.3.5 (Mac OS)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.5/logpresso-log4j2-scan-2.3.5-darwin.tar.gz)
15-
* [log4j2-scan 2.3.5 (Any OS, 20KB)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.5/logpresso-log4j2-scan-2.3.5.jar)
14+
* [log4j2-scan 2.3.6 (Mac OS)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.6/logpresso-log4j2-scan-2.3.6-darwin.tar.gz)
15+
* [log4j2-scan 2.3.6 (Any OS, 20KB)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v2.3.6/logpresso-log4j2-scan-2.3.6.jar)
1616

1717
### Build
1818
* [How to build Native Image](https://github.com/logpresso/CVE-2021-44228-Scanner/wiki/FAQ#how-to-build-native-image)
@@ -22,7 +22,7 @@ Just run log4j2-scan.exe or log4j2-scan with target directory path. The logpress
2222

2323
Usage
2424
```
25-
Logpresso CVE-2021-44228 Vulnerability Scanner 2.3.5 (2021-12-20)
25+
Logpresso CVE-2021-44228 Vulnerability Scanner 2.3.6 (2021-12-20)
2626
Usage: log4j2-scan [--scan-log4j1] [--fix] target_path1 target_path2
2727
2828
-f [config_file_path]
@@ -85,7 +85,7 @@ On Linux
8585
```
8686
On UNIX (AIX, Solaris, and so on)
8787
```
88-
java -jar logpresso-log4j2-scan-2.3.5.jar [--fix] target_path
88+
java -jar logpresso-log4j2-scan-2.3.6.jar [--fix] target_path
8989
```
9090

9191
If you add `--fix` option, this program will copy vulnerable original JAR file to .bak file, and create new JAR file without `org/apache/logging/log4j/core/lookup/JndiLookup.class` entry. In most environments, JNDI lookup feature will not be used. However, you must use this option at your own risk. Depending the Operating System:

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.logpresso</groupId>
88
<artifactId>log4j2-scanner</artifactId>
9-
<version>2.3.5</version>
9+
<version>2.3.6</version>
1010
<packaging>jar</packaging>
1111
<name>Logpresso Log4j2 Scanner</name>
1212

src/main/java/com/logpresso/scanner/Detector.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import com.logpresso.scanner.utils.ZipUtils;
2626

2727
public class Detector {
28-
private static final String POTENTIALLY_VULNERABLE = "N/A - potentially vulnerable";
28+
private static final String POTENTIALLY_VULNERABLE = "N/A";
29+
2930
private static final String JNDI_LOOKUP_CLASS_PATH = "org/apache/logging/log4j/core/lookup/JndiLookup.class";
3031
private static final String JNDI_LOOKUP_CLASS_SHADE_PATH = "/log4j/core/lookup/JndiLookup.class";
3132
private static final String LOG4J_CORE_POM_PROPS = "META-INF/maven/org.apache.logging.log4j/log4j-core/pom.properties";
@@ -370,7 +371,7 @@ else if (version.startsWith("2.16.") || version.equals("2.12.2"))
370371
msg += " (mitigated)";
371372

372373
System.out.println(msg);
373-
addReport(jarFile, pathChain, version, mitigated, potential);
374+
addReport(jarFile, pathChain, "Log4j 2", version, cve, mitigated, potential);
374375
}
375376

376377
private void printDetectionForLog4j1(File jarFile, List<String> pathChain, String version, boolean mitigated) {
@@ -384,7 +385,7 @@ private void printDetectionForLog4j1(File jarFile, List<String> pathChain, Strin
384385

385386
System.out.println(msg);
386387

387-
addReport(jarFile, pathChain, version, false, true);
388+
addReport(jarFile, pathChain, "Log4j 1", version, "CVE-2021-4104", false, true);
388389
}
389390

390391
private void printDetectionForLogback(File jarFile, List<String> pathChain, String version, boolean mitigated) {
@@ -398,10 +399,11 @@ private void printDetectionForLogback(File jarFile, List<String> pathChain, Stri
398399

399400
System.out.println(msg);
400401

401-
addReport(jarFile, pathChain, version, false, true);
402+
addReport(jarFile, pathChain, "Logback", version, "CVE-2021-42550", false, true);
402403
}
403404

404-
private void addReport(File jarFile, List<String> pathChain, String version, boolean mitigated, boolean potential) {
405+
private void addReport(File jarFile, List<String> pathChain, String product, String version, String cve, boolean mitigated,
406+
boolean potential) {
405407
List<ReportEntry> entries = fileReports.get(jarFile);
406408
if (entries == null) {
407409
entries = new ArrayList<ReportEntry>();
@@ -414,7 +416,7 @@ private void addReport(File jarFile, List<String> pathChain, String version, boo
414416
else if (potential)
415417
status = Status.POTENTIALLY_VULNERABLE;
416418

417-
ReportEntry entry = new ReportEntry(jarFile, StringUtils.toString(pathChain), version, status);
419+
ReportEntry entry = new ReportEntry(jarFile, StringUtils.toString(pathChain), product, version, cve, status);
418420
entries.add(entry);
419421
}
420422
}

src/main/java/com/logpresso/scanner/Log4j2Scanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.logpresso.scanner.utils.ZipUtils;
1616

1717
public class Log4j2Scanner {
18-
private static final String BANNER = "Logpresso CVE-2021-44228 Vulnerability Scanner 2.3.5 (2021-12-20)";
18+
private static final String BANNER = "Logpresso CVE-2021-44228 Vulnerability Scanner 2.3.6 (2021-12-20)";
1919

2020
private static final boolean isWindows = File.separatorChar == '\\';
2121

src/main/java/com/logpresso/scanner/ReportEntry.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
public class ReportEntry {
88
private File path;
99
private String entry;
10+
private String product;
1011
private String version;
12+
private String cve;
1113
private Status status;
1214
private boolean fixed;
1315
private Date reportTime = new Date();
1416

15-
public ReportEntry(File path, String entry, String version, Status status) {
17+
public ReportEntry(File path, String entry, String product, String version, String cve, Status status) {
1618
this.path = path;
1719
this.entry = entry;
20+
this.product = product;
1821
this.version = version;
22+
this.cve = cve;
1923
this.status = status;
2024
}
2125

@@ -27,10 +31,22 @@ public String getEntry() {
2731
return entry;
2832
}
2933

34+
public String getProduct() {
35+
return product;
36+
}
37+
38+
public void setProduct(String product) {
39+
this.product = product;
40+
}
41+
3042
public String getVersion() {
3143
return version;
3244
}
3345

46+
public String getCve() {
47+
return cve;
48+
}
49+
3450
public Status getStatus() {
3551
return status;
3652
}
@@ -49,7 +65,7 @@ public Date getReportTime() {
4965

5066
public String getCsvLine() {
5167
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
52-
return String.format("\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"%n", path.getAbsolutePath(), entry, version, status,
53-
fixed ? "FIXED" : "", df.format(reportTime));
68+
return String.format("\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"%n", path.getAbsolutePath(), entry, product,
69+
version, cve, status, fixed ? "FIXED" : "", df.format(reportTime));
5470
}
5571
}

src/main/java/com/logpresso/scanner/ReportGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static File generateReportFileName(Configuration config) {
5959

6060
private static void writeCsvReport(Configuration config, Map<File, List<ReportEntry>> fileReports, FileOutputStream csvStream)
6161
throws IOException, UnsupportedEncodingException {
62-
String header = String.format("Hostname,Path,Entry,Version,Status,Fixed,Detected at%n");
62+
String header = String.format("Hostname,Path,Entry,Product,Version,CVE,Status,Fixed,Detected at%n");
6363
csvStream.write(header.getBytes("utf-8"));
6464

6565
String hostname = getHostname(config.isDebug());

0 commit comments

Comments
 (0)