Skip to content

Commit 2cae09b

Browse files
committedDec 14, 2021
Skip symlink patch, updated to 1.3.1
1 parent f3c2036 commit 2cae09b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed
 

‎README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
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.
44

55
### Download
6-
* [log4j2-scan 1.3.0 (Windows x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v1.3.0/logpresso-log4j2-scan-1.3.0-win64.7z)
6+
* [log4j2-scan 1.3.1 (Windows x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v1.3.1/logpresso-log4j2-scan-1.3.1-win64.7z)
77
* If native executable doesn't work, use the JAR instead. 32bit is not supported.
8-
* [log4j2-scan 1.3.0 (Linux x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v1.3.0/logpresso-log4j2-scan-1.3.0-linux.tar.gz)
8+
* [log4j2-scan 1.3.1 (Linux x64)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v1.3.1/logpresso-log4j2-scan-1.3.1-linux.tar.gz)
99
* If native executable doesn't work, use the JAR instead. 32bit is not supported.
10-
* [log4j2-scan 1.3.0 (Any OS, 10KB)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v1.3.0/logpresso-log4j2-scan-1.3.0.jar)
10+
* [log4j2-scan 1.3.1 (Any OS, 10KB)](https://github.com/logpresso/CVE-2021-44228-Scanner/releases/download/v1.3.1/logpresso-log4j2-scan-1.3.1.jar)
1111

1212
### How to use
1313
Just run log4j2-scan.exe or log4j2-scan with target directory path.
1414

1515
Usage
1616
```
17-
Logpresso CVE-2021-44228 Vulnerability Scanner 1.3.0 (2021-12-15)
17+
Logpresso CVE-2021-44228 Vulnerability Scanner 1.3.1 (2021-12-15)
1818
Usage: log4j2-scan [--fix] target_path
1919
2020
--fix
@@ -43,7 +43,7 @@ On Linux
4343
```
4444
On UNIX (AIX, Solaris, and so on)
4545
```
46-
java -jar logpresso-log4j2-scan-1.3.0.jar [--fix] target_path
46+
java -jar logpresso-log4j2-scan-1.3.1.jar [--fix] target_path
4747
```
4848

4949
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. It is necessary to shutdown any running JVM process before applying patch. Start affected JVM process after fix.

‎pom.xml

+1-1
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>1.3.0</version>
9+
<version>1.3.1</version>
1010
<packaging>jar</packaging>
1111
<name>Logpresso Log4j2 Scanner</name>
1212

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import java.util.zip.ZipOutputStream;
2525

2626
public class Log4j2Scanner {
27-
private static final String BANNER = "Logpresso CVE-2021-44228 Vulnerability Scanner 1.3.0 (2021-12-15)";
27+
private static final String BANNER = "Logpresso CVE-2021-44228 Vulnerability Scanner 1.3.1 (2021-12-15)";
2828

2929
public enum Status {
3030
NOT_VULNERABLE, VULNERABLE, MITIGATED
@@ -281,6 +281,11 @@ private void fix(boolean trace) {
281281
System.out.println("");
282282

283283
for (File f : vulnerableFiles) {
284+
if (isSymlink(f)) {
285+
System.out.println("Skipping symlink patch: " + f.getAbsolutePath());
286+
continue;
287+
}
288+
284289
if (trace)
285290
System.out.println("Patching " + f.getAbsolutePath());
286291

@@ -508,7 +513,7 @@ private boolean isSymlink(File f) {
508513
absolutePath = absolutePath.toUpperCase();
509514
}
510515

511-
return f.isDirectory() && !canonicalPath.contains(absolutePath);
516+
return !canonicalPath.contains(absolutePath);
512517
} catch (IOException e) {
513518
}
514519

@@ -697,4 +702,4 @@ private void ensureClose(ZipFile zipFile) {
697702
}
698703
}
699704
}
700-
}
705+
}

0 commit comments

Comments
 (0)