Skip to content

Commit b5517d0

Browse files
authored
Merge pull request #9 from alkestis-s/main
Update README.md
2 parents a63ec5a + fa9f451 commit b5517d0

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

README.md

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<img src="logo.png" width="400">
22

3-
# Log4JShell Bytecode Detector
3+
# 🔍 Log4JShell Bytecode Detector
44

5-
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).
5+
Log4jShell Bytecode Detector is an open source tool that helps identify 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).
66

77
**IMPORTANT UPDATE: We extended [the list of affected artifacts](src/main/resources/VulnerableGavs.csv) on Maven Central. The list contains 18.816 artifacts. The artifacts either use log4j-core as declared dependency, or we identified .class files within the artifacts that match to the affected versions of log4j-core.**
88

9-
## How to run this tool
9+
## 📝 How to run
1010

1111
1. Download the [jar file](https://github.com/CodeShield-Security/Log4JShell-Bytecode-Detector/releases/download/v0.4/Log4JDetector-0.4-jar-with-dependencies.jar) under releases.
1212
2. Run `java -cp <PATH_TO_DOWNLOADED_JAR> de.codeshield.log4jshell.Log4JDetector <ABSOLUTE_PATH_TO_JAR_TO_CHECK>`
@@ -19,23 +19,25 @@ CVE-2021-44228 found declared as dependency in META-INF/maven/org.apache.logging
1919
CVE-2021-44228 found in class file org/apache/logging/log4j/core/net/JndiManager$1.class
2020
```
2121

22-
## How to run this tool on a live server (no need to stop your running Java instances)
22+
## 📝 How to run on a live server (no need to stop your running Java instances)
2323

2424
1. Download the [jar file](https://github.com/CodeShield-Security/Log4JShell-Bytecode-Detector/releases/download/v0.5/Log4JDetector-0.5-jar-with-dependencies.jar) under releases.
2525
2. Run `java -cp <PATH_TO_DOWNLOADED_JAR> de.codeshield.log4jshell.Log4JProcessDetector`
2626
3. The jar searches the classpath of all running java processes for vulnerable log4j instances
2727

2828

29-
## Background on CVE-2021-44228
29+
## ❓ Background on CVE-2021-44228
30+
3031
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.
3132

3233
* [Hackernews](https://thehackernews.com/2021/12/extremely-critical-log4j-vulnerability.html)
3334
* [BSI (german only)](https://www.bsi.bund.de/SharedDocs/Cybersicherheitswarnungen/DE/2021/2021-549032-10F2.pdf?__blob=publicationFile&v=6)
3435
* [Proof of Concept for exploiting the vulnerability](https://github.com/0x0021h/apache-log4j-rce)
3536
* [Log4JShell Cheat Sheet](https://www.techsolvency.com/story-so-far/cve-2021-44228-log4j-log4shell/)
3637

37-
## Why is it so important?
38-
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:
38+
## 👀 Why is it important?
39+
40+
Log4j is and has been used in mostly any Java project for logging purposes. 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 to see if one is affected can be done using using the maven dependecy tree:
3941

4042
Example: Execute command `mvn dependency:tree` on a maven project.
4143

@@ -45,23 +47,23 @@ Example: Execute command `mvn dependency:tree` on a maven project.
4547
[INFO] | \- org.apache.logging.log4j:log4j-core:jar:2.14.1:compile
4648
```
4749

48-
This check however, is only a first indication and does not suffices due to the following reasons.
50+
This check, however, is only a first indication and does not suffice due to the following reasons:
4951

5052
Java programs are frequently:
5153
* packaged as fatjar or uberjar: All class files (including direct and transitive dependencies) are shipped into a single jar file. (as we do for this software artifact)
5254
* re-packaged or rebundled: the originaly package names are changed to avoid naming conflicts (some compilers and package mechanism apply code transformations)
53-
* re-compiled: The source code is compiled with a different compiler and packaged anew, this leads to modified bytecode
55+
* re-compiled: The source code is compiled with a different compiler and packaged as new, which leads to modified bytecode
5456

55-
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.
57+
Consequently, _*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.
5658

57-
## How the script works
59+
## 📕 The script
5860
1. Extract pom.xml files from .jar
5961
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
6062
3. Extract .class files from .jar
61-
6. Compute SHA hashes of the class file
62-
7. Match SHAs against a [pre-computed list](src/main/resources/VulnerableClassSHAs.csv)
63+
4. Compute SHA hashes of the class file
64+
5. Match SHAs against a [pre-computed list](src/main/resources/VulnerableClassSHAs.csv)
6365

64-
## Build Instructions
66+
## 🛠 Build Instructions
6567

6668
To build this tool run
6769

@@ -71,37 +73,47 @@ For assembling a runnable `jar` use
7173

7274
`mvn clean compile assembly:single`
7375

74-
## Precomputed Hashes of Vulnerable Classes
76+
## 💡 Precomputed Hashes of Vulnerable Classes
7577

76-
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.
78+
The set of vulnerable hashes for classes has been pre-computed on entire [Maven Central](https://mvnrepository.com/repos/central) repository. The hashes of the classes contain all hashes that we identified as bytecode-similar using the Fingerprinting technology.
7779

7880
The pre-computed information contains:
7981

80-
* all aritfacts that directly include log4j in any of the vulnerable version
82+
* all artifacts that directly include log4j in any of the vulnerable version
8183
* all artifacts that ship a class that contains a vulnerable hash of log4j in the affected version range
8284
* all artifacts that rebundle a vulnerable class of log4j
8385
* all artifacts that have a re-compiled class of a class of log4j in the affected version range
8486

8587
As affected version range we considered [2.0-beta9, 2.15) [Reference](https://logging.apache.org/log4j/2.x/security.html).
8688

87-
## Fingerprinting Technology
89+
## 💻 Fingerprinting Technology
8890
This tool uses a new bytecode fingerprinting technology for Java that has been invented by Andreas Dann. The basic flow is as follows.
8991
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.
9092
2. Compute bytecode "Fingerprints" of vulnerable classes.
9193
3. Search for other classes on MavenCentral with same "Fingerprint".
9294

9395
*Note: For a simpler roll out, this repository does ship SHA hashes of the vulnerable classes, the information has been computed using Fingerprinting*
9496

95-
## Disclaimers
97+
## 📌 Disclaimer
9698

9799
The list of hashes and maven artifacts is not complete. We will regularly update the lists.
98100

99-
## Authors
101+
## 📯 Contributors
102+
103+
This tool was co-created by the CodeShield co-founders
100104

101105
* Andreas Dann <andreas.dann@codeshield.io>
102106
* Johannes Spaeth <johannes.spaeth@codeshield.io>
103107

104-
## If you want to learn more about the technology, reach out to us!
108+
Feedback is welcome!
109+
110+
We are working on extending on the the list of affected artifacts and are always looking to improve our offering. `contribution welcome`
111+
112+
Also, ⭐️ this repository if our scanner helped you!
113+
114+
## ✍️ Contact
115+
116+
If you need support, or want to hear about our technology contact us at info@codeshield.io.
105117

106-
https://codeshield.io/
118+
Your CodeShield Team 💚
107119

logo.png

-390 KB
Loading

0 commit comments

Comments
 (0)