You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
+
# Log4JShell Bytecode Detector
2
+
1
3
This repository contains a tool to detect if a jar file is affected by the critical CVE-2021-44228. The tool scans the jar file and compares the classses against a set of vulnerable hashes for classes within the jar file. The hashes have been pre-computed for artifacts on [Maven Central](https://mvnrepository.com/repos/central).
2
4
3
-
# How to run this tool
5
+
##How to run this tool
4
6
5
7
1. Download the jar file under releases. TODO add link.
6
8
2. Run `java -cp <PATH_TO_DOWNLOADED_JAR> de.codeshield.log4jcheck.Log4JDetector <PATH_TO_`
@@ -13,15 +15,15 @@ CVE-2021-44228 found declared as dependency in META-INF/maven/org.apache.logging
13
15
CVE-2021-44228 found in class file org/apache/logging/log4j/core/net/JndiManager$1.class
14
16
```
15
17
16
-
# Background on CVE-2021-44228
18
+
##Background on CVE-2021-44228
17
19
A serious Remote Code Execution vulnerability has been discovered within log4j and version 2.0-beta9 to 2.14 are affected. The vulnerability has been classified as critical, as it affected log4j one of the most used logging libraries for Java. There are many references and article out there.
Log4j is and has been used in mostly any Java project for logging purporse. Now we need to understand which projects and libraries are actually affected. As of Java's dependency mechanism, an application can also be affected if it `transitively` includes the vulnerable library version. A project `A` includes a library `lib``transitively`, if one of the direct dependecy `B` of `A` has a dependecy to `lib`. A simple test if one is affected can be done using using the maven dependecy tree:
26
28
27
29
Example: Execute command `mvn dependency:tree` on a maven project.
@@ -42,20 +44,20 @@ Java programs are frequently:
42
44
Consquently, _*any*_ library a Java project is using can include the vulnerability into your project. An in-depth bytecode analysis helps, which is what we publish as part of this repository.
43
45
44
46
45
-
# How the script works
47
+
##How the script works
46
48
1. Extract pom.xml files from .jar
47
49
2. check declared dependencies against a [pre-computed list](src/main/resources/VulnerableGavs.csv) of affected groupId:artifactId:version list for artifacts hosten on Maven Central
48
50
3. Extract .class files from .jar
49
51
6. Compute SHA hashes of the class file
50
52
7. Match SHAs against a [pre-computed list](src/main/resources/VulnerableClassSHAs.csv)
51
53
52
-
# Build Instructions
54
+
##Build Instructions
53
55
54
56
To build this tool run
55
57
56
58
`mvn compile`
57
59
58
-
# Precomputed Hashes of Vulnerable Classes
60
+
##Precomputed Hashes of Vulnerable Classes
59
61
60
62
The set of vulnerable hashes for classes has been pre-compute on entire [Maven Central](https://mvnrepository.com/repos/central) repository. The hashes of the classes contain all hashes that we identified as bytecode-similiar using the Fingerprinting technology.
61
63
@@ -68,7 +70,7 @@ The pre-computed information contains:
68
70
69
71
As affected version range we considered [2.0-beta9, 2.14) [Reference](https://logging.apache.org/log4j/2.x/security.html).
70
72
71
-
# Fingerprinting Technology
73
+
##Fingerprinting Technology
72
74
This tool uses a new bytecode fingerprinting technology for Java that has been invented by Andreas Dann. The basic flow is as follows.
73
75
1. Use the available fix commits [Commit1](https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=7fe72d6), [Commit2](https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=d82b47c), and [Commit3](https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=c77b3cb) to identify which classes are affected.
74
76
2. Compute bytecode hashes using the Fingerprinting technologites of the vulnerable classes.
0 commit comments