Skip to content

Commit 8cb0604

Browse files
Update README.md
latest version is now aware of log4j versions 2.3.2, 2.12.4, and 2.17.1
1 parent 530e81c commit 8cb0604

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

README.md

+39-35
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<h1>Log4-detector</h1>
44

5-
Scanner that detects vulnerable Log4J versions to help teams assess their exposure to [CVE-2021-44228](https://mergebase.com/vulnerability/CVE-2021-44228/), [CVE-2021-45046](https://mergebase.com/vulnerability/CVE-2021-45046/) and [CVE-2021-45105](https://mergebase.com/vulnerability/CVE-2021-45105/). Can search for Log4J instances by carefully examining the complete file-system, including all installed applications. It is able to find Log4J instances that are hidden several layers deep. Works on Linux, Windows, and Mac, and everywhere else Java runs, too!
5+
Scanner that detects vulnerable Log4J versions to help teams assess their exposure to **[CVE-2021-44228](https://mergebase.com/vulnerability/CVE-2021-44228/) (CRITICAL)**, [CVE-2021-45046](https://mergebase.com/vulnerability/CVE-2021-45046/), [CVE-2021-45105](https://mergebase.com/vulnerability/CVE-2021-45105/), and [CVE-2021-44832](https://mergebase.com/vulnerability/CVE-2021-44832/). Can search for Log4J instances by carefully examining the complete file-system, including all installed applications. It is able to find Log4J instances that are hidden several layers deep. Works on Linux, Windows, and Mac, and everywhere else Java runs, too!
66

77
# Table of Contents
88
- [Introduction](#itemdetector)
@@ -26,7 +26,7 @@ Scanner that detects vulnerable Log4J versions to help teams assess their exposu
2626

2727
# Introduction <a name="itemdetector"></a>
2828

29-
Currently reports [log4j-core](https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/) versions 2.3.1, 2.12.3, and 2.17.0 as **\_SAFE\_**, 2.12.2, 2.15.0 and 2.16.0 as **\_OKAY\_** and all other versions as **\_VULNERABLE\_**
29+
Currently reports [log4j-core](https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/) versions 2.3.2, 2.12.4, and 2.17.1 as **\_SAFE\_**, 2.3.1, 2.12.2, 2.12.3, 2.15.0, 2.16.0, and 2.17.0 as **\_OKAY\_** and all other versions as **\_VULNERABLE\_**
3030
(although it does report pre-2.0-beta9 as **\_POTENTIALLY_SAFE\_**). It reports older [log4j-1.x](https://repo1.maven.org/maven2/log4j/log4j/) versions as **\_OLD\_**.
3131

3232
Can correctly detect log4j inside executable spring-boot jars/wars, dependencies blended
@@ -35,48 +35,49 @@ exploded jar files just sitting uncompressed on the file-system (aka *.class).
3535

3636
We currently maintain a collection of [log4j-samples](https://github.com/mergebase/log4j-samples) we use for testing.
3737

38-
# Example Usage: <a name="itemexample"></a>
39-
40-
java -jar log4j-detector-2021.12.29.jar [path-to-scan] > hits.txt
41-
42-
![Terminal output from running java -jar log4j-detector.jar in a terminal](./images/log4j-detector.png)
43-
44-
# More Example Usage: <a name="itemmore"></a>
38+
# Example Usage: <a name="itemmore"></a>
4539

4640
```
4741
java -jar log4j-detector-2021.12.29.jar ./samples
4842
4943
-- github.com/mergebase/log4j-detector v2021.12.29 (by mergebase.com) analyzing paths (could take a while).
5044
-- Note: specify the '--verbose' flag to have every file examined printed to STDERR.
51-
/opt/mergebase/log4j-detector/samples/clt-1.0-SNAPSHOT.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
52-
/opt/mergebase/log4j-detector/samples/infinispan-embedded-query-8.2.12.Final.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
53-
/opt/mergebase/log4j-detector/samples/log4j-1.1.3.jar contains Log4J-1.x <= 1.2.17 _OLD_
54-
/opt/mergebase/log4j-detector/samples/log4j-1.2.13.jar contains Log4J-1.x <= 1.2.17 _OLD_
55-
/opt/mergebase/log4j-detector/samples/log4j-1.2.17.jar contains Log4J-1.x <= 1.2.17 _OLD_
56-
/opt/mergebase/log4j-detector/samples/log4j-core-2.0-beta2.jar contains Log4J-2.x <= 2.0-beta8 _POTENTIALLY_SAFE_ (or did you already remove JndiLookup.class?)
57-
/opt/mergebase/log4j-detector/samples/log4j-core-2.0-beta9.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
58-
/opt/mergebase/log4j-detector/samples/log4j-core-2.0.2.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
59-
/opt/mergebase/log4j-detector/samples/log4j-core-2.0.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
60-
/opt/mergebase/log4j-detector/samples/log4j-core-2.10.0.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
61-
/opt/mergebase/log4j-detector/samples/log4j-core-2.12.1.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
62-
/opt/mergebase/log4j-detector/samples/log4j-core-2.12.2.jar contains Log4J-2.x == 2.12.2 _OKAY_
63-
/opt/mergebase/log4j-detector/samples/log4j-core-2.12.3.jar contains Log4J-2.x >= 2.12.3 _SAFE_
64-
/opt/mergebase/log4j-detector/samples/log4j-core-2.14.1.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
65-
/opt/mergebase/log4j-detector/samples/log4j-core-2.15.0.jar contains Log4J-2.x == 2.15.0 _OKAY_
66-
/opt/mergebase/log4j-detector/samples/log4j-core-2.16.0.jar contains Log4J-2.x == 2.16.0 _OKAY_
67-
/opt/mergebase/log4j-detector/samples/log4j-core-2.17.0.jar contains Log4J-2.x >= 2.17.0 _SAFE_
68-
/opt/mergebase/log4j-detector/samples/log4j-core-2.3.1.jar contains Log4J-2.x == 2.3.1 _SAFE_
69-
/opt/mergebase/log4j-detector/samples/log4j-core-2.4.1.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
70-
/opt/mergebase/log4j-detector/samples/log4j-core-2.9.1.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
45+
false-hits/log4j-core-2.12.2.jar contains Log4J-2.x == 2.12.2 _OKAY_
46+
false-hits/log4j-core-2.12.3.jar contains Log4J-2.x == 2.12.3 _OKAY_
47+
false-hits/log4j-core-2.12.4.jar contains Log4J-2.x == 2.12.4 _SAFE_
48+
false-hits/log4j-core-2.15.0.jar contains Log4J-2.x == 2.15.0 _OKAY_
49+
false-hits/log4j-core-2.16.0.jar contains Log4J-2.x == 2.16.0 _OKAY_
50+
false-hits/log4j-core-2.17.0.jar contains Log4J-2.x == 2.17.0 _OKAY_
51+
false-hits/log4j-core-2.17.1.jar contains Log4J-2.x >= 2.17.1 _SAFE_
52+
false-hits/log4j-core-2.3.1.jar contains Log4J-2.x == 2.3.1 _OKAY_
53+
false-hits/log4j-core-2.3.2.jar contains Log4J-2.x == 2.3.2 _SAFE_
54+
true-hits/log4j-core-2.0-beta9.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
55+
true-hits/log4j-core-2.10.0.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
56+
true-hits/log4j-core-2.10.0.zip contains Log4J-2.x >= 2.10.0 _VULNERABLE_
57+
true-hits/log4j-core-2.11.0.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
58+
true-hits/log4j-core-2.11.1.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
59+
true-hits/log4j-core-2.11.2.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
60+
true-hits/log4j-core-2.12.0.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
61+
true-hits/log4j-core-2.12.1.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
62+
true-hits/log4j-core-2.14.0.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
63+
true-hits/log4j-core-2.14.1.jar contains Log4J-2.x >= 2.10.0 _VULNERABLE_
64+
true-hits/log4j-core-2.2.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
65+
true-hits/log4j-core-2.3.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
66+
true-hits/log4j-core-2.4.1.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
67+
true-hits/log4j-core-2.4.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
68+
true-hits/log4j-core-2.9.1.jar contains Log4J-2.x >= 2.0-beta9 (< 2.10.0) _VULNERABLE_
69+
old-hits/log4j-1.1.3.jar contains Log4J-1.x <= 1.2.17 _OLD_
70+
old-hits/log4j-1.2.17.jar contains Log4J-1.x <= 1.2.17 _OLD_
71+
old-hits/log4j-core-2.0-beta2.jar contains Log4J-2.x <= 2.0-beta8 _POTENTIALLY_SAFE_ (Did you remove JndiLookup.class?)
7172
```
7273

7374
# Understanding The Results <a name="itemresults"></a>
7475

7576
**\_VULNERABLE\_** -> You need to upgrade or remove this file.
7677

77-
**\_OKAY\_** -> We only report this for Log4J versions 2.12.2, 2.15.0, and 2.16.0. We recommend upgrading to 2.17.0.
78+
**\_OKAY\_** -> We report this for Log4J versions 2.3.1, 2.12.2, 2.12.3, 2.15.0, 2.16.0, and 2.17.0. We recommend upgrading to 2.17.1.
7879

79-
**\_SAFE\_** -> We currently only report this for Log4J versions 2.3.1, 2.12.3, and 2.17.0 (and greater).
80+
**\_SAFE\_** -> We currently only report this for Log4J versions 2.3.2, 2.12.4, and 2.17.1 (and greater).
8081

8182
**\_OLD\_** -> You are safe from CVE-2021-44228, but should plan to upgrade because Log4J 1.2.x has been EOL for 7 years and has several known-vulnerabilities.
8283

@@ -110,7 +111,7 @@ Docs - https://github.com/mergebase/log4j-detector
110111
git clone https://github.com/mergebase/log4j-detector.git
111112
cd log4j-detector/
112113
mvn install
113-
java -jar target/log4j-detector-2021.12.29.jar
114+
java -jar target/log4j-detector-latest.jar
114115
```
115116
# Testing: <a name="itemtesting"></a>
116117

@@ -130,6 +131,9 @@ on your file-system, it then examines that file for this String: "Invalid JNDI U
130131
literal is only present in the patched version of Log4J (version 2.15.0). Any versions of Log4J without that String are
131132
vulnerable.
132133

134+
This same technique of examining *.class files for String literals is further extended to accurately detect safe
135+
versions 2.3.2, 2.12.4, and 2.17.1.
136+
133137
## This Scanner Only Reports Hits Against The `log4j-core` Library. What About `log4j-api`? <a name="itemapi"></a>
134138

135139
Many scanners (including GitHub's own [Dependabot](https://github.com/dependabot)) currently report both "`log4j-core`" and "`log4j-api`" libraries as vulnerable. These scanners are incorrect. There is currently no existing version of the "`log4j-api`" library that can be exploited by any of these vulnerabilities.
@@ -145,8 +149,8 @@ Version 2.12.2 is important because it's a Java 7 compatible version of Log4J th
145149

146150
Versions 2.15.0 and 2.16.0 are important because these are the first versions where Log4J's default out-of-the-box configuration is not vulnerable to CVE-2021-44228.
147151

148-
And versions 2.3.1, 2.12.3, and 2.17.0 are important because they are not vulnerable to more recently discovered CVEs such as CVE-2021-45046 and CVE-2021-45105.
149-
Despite these being much less serious vulnerabilities, we anticipate everyone will want to patch to one of 2.3.1, 2.12.3, or 2.17.0.
152+
And versions 2.3.2, 2.12.4, and 2.17.1 are important because they are not vulnerable to more recently discovered CVEs such as CVE-2021-45046 and CVE-2021-45105.
153+
Despite these being much less serious vulnerabilities, we anticipate everyone will want to patch to one of 2.3.2, 2.12.4, or 2.17.1.
150154

151155
## What are those "file1.war!/path/to/file2.zip!/path/to/file3.jar!/path/to/log4j.jar" results about? <a name="itemwar"></a>
152156

@@ -168,7 +172,7 @@ Only versions of Log4J 2.x (from 2.0-beta9 to 2.14.1) are vulnerable to CVE-2021
168172

169173
## How Can I Be Sure This Isn't A Trojan Pretending To Be A Log4J Detector? <a name="itemtrojan"></a>
170174

171-
Great question! Since we include the complete source code here in Github (all 2200 lines of Java), as well as the steps
175+
Great question! Since we include the complete source code here in Github (all 2500 lines of Java), as well as the steps
172176
to build it, and since this tool has zero dependencies, it shouldn't take too long to carefully study the code to your
173177
satisfaction. If you don't trust Maven you can go directly into the "src/main/java/com/mergebase/log4j" directory and
174178
type "javac \*.java". That works, too!

0 commit comments

Comments
 (0)