All Projects → Contrast-Security-OSS → safelog4j

Contrast-Security-OSS / safelog4j

Licence: Apache-2.0 license
Safelog4j is an instrumentation-based security tool to help teams discover, verify, and solve log4shell vulnerabilities without scanning or upgrading

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to safelog4j

cloudrasp-log4j2
一个针对防御 log4j2 CVE-2021-44228 漏洞的 RASP 工具。 A Runtime Application Self-Protection module specifically designed for log4j2 RCE (CVE-2021-44228) defense.
Stars: ✭ 105 (+176.32%)
Mutual labels:  log4j, vulnerability, rasp
awesome-log4shell
An Awesome List of Log4Shell resources to help you stay informed and secure! 🔒
Stars: ✭ 194 (+410.53%)
Mutual labels:  log4j, vulnerability, log4shell
log4shell-finder
Fastest filesystem scanner for log4shell (CVE-2021-44228, CVE-2021-45046) and other vulnerable (CVE-2017-5645, CVE-2019-17571, CVE-2022-23305, CVE-2022-23307 ... ) instances of log4j library. Excellent performance and low memory footprint.
Stars: ✭ 22 (-42.11%)
Mutual labels:  log4j, vulnerability, log4shell
nmap-log4shell
Nmap Log4Shell NSE script for discovery Apache Log4j RCE (CVE-2021-44228)
Stars: ✭ 54 (+42.11%)
Mutual labels:  log4j, vulnerability, log4shell
log4jscanwin
Log4j Vulnerability Scanner for Windows
Stars: ✭ 142 (+273.68%)
Mutual labels:  log4j, vulnerability, log4shell
log4j-detector
Log4J scanner that detects vulnerable Log4J versions (CVE-2021-44228, CVE-2021-45046, etc) on your file-system within any application. It is able to even find Log4J instances that are hidden several layers deep. Works on Linux, Windows, and Mac, and everywhere else Java runs, too!
Stars: ✭ 622 (+1536.84%)
Mutual labels:  log4j, vulnerability-scanner, log4shell
log4jpwn
log4j rce test environment and poc
Stars: ✭ 306 (+705.26%)
Mutual labels:  log4j, log4shell
Command Injection Payload List
🎯 Command Injection Payload List
Stars: ✭ 658 (+1631.58%)
Mutual labels:  vulnerability, security-testing
Log4jPatcher
A mitigation for CVE-2021-44228 (log4shell) that works by patching the vulnerability at runtime. (Works with any vulnerable java software, tested with java 6 and newer)
Stars: ✭ 43 (+13.16%)
Mutual labels:  log4j, log4shell
Xray
一款完善的安全评估工具,支持常见 web 安全问题扫描和自定义 poc | 使用之前务必先阅读文档
Stars: ✭ 6,218 (+16263.16%)
Mutual labels:  vulnerability, vulnerability-scanner
HackLog4j
《HackLog4j-永恒之恶龙》致敬全宇宙最无敌的Java日志库!Tribute to the most invincible Java logging library in the universe!
Stars: ✭ 161 (+323.68%)
Mutual labels:  log4j, log4shell
log4jshield
Log4j Shield - fast ⚡, scalable and easy to use Log4j vulnerability CVE-2021-44228 finder and patcher
Stars: ✭ 13 (-65.79%)
Mutual labels:  log4j, log4shell
Killshot
A Penetration Testing Framework, Information gathering tool & Website Vulnerability Scanner
Stars: ✭ 237 (+523.68%)
Mutual labels:  vulnerability, vulnerability-scanner
Arissploit
Arissploit Framework is a simple framework designed to master penetration testing tools. Arissploit Framework offers simple structure, basic CLI, and useful features for learning and developing penetration testing tools.
Stars: ✭ 114 (+200%)
Mutual labels:  vulnerability, vulnerability-scanner
log4j-cve-2021-44228
Ansible detector scanner playbook to verify target Linux hosts using the official Red Hat Log4j detector script RHSB-2021-009 Remote Code Execution - log4j (CVE-2021-44228)
Stars: ✭ 58 (+52.63%)
Mutual labels:  log4j, log4shell
Log4j-RCE-Scanner
Remote command execution vulnerability scanner for Log4j.
Stars: ✭ 200 (+426.32%)
Mutual labels:  log4j, log4shell
Gopoc
用cel-go重现了长亭xray的poc检测功能的轮子
Stars: ✭ 124 (+226.32%)
Mutual labels:  vulnerability-scanner, security-testing
log4shell-tools
Tool that runs a test to check whether one of your applications is affected by the recent vulnerabilities in log4j: CVE-2021-44228 and CVE-2021-45046
Stars: ✭ 55 (+44.74%)
Mutual labels:  log4j, log4shell
log4shelldetect
Rapidly scan filesystems for Java programs potentially vulnerable to Log4Shell (CVE-2021-44228) or "that Log4j JNDI exploit" by inspecting the class paths inside files
Stars: ✭ 40 (+5.26%)
Mutual labels:  log4j, log4shell
L4sh
Log4Shell RCE Exploit - fully independent exploit does not require any 3rd party binaries.
Stars: ✭ 260 (+584.21%)
Mutual labels:  log4j, log4shell

safelog4j



Safelog4j is an instrumentation-based security tool to help teams
discover, verify, and solve log4shell without scanning or upgrading

If you're wrestling with log4shell CVE-2021-45046, the best longterm plan is to upgrade your log4j to the latest secure version. But if you can't do that for whatever reason, you probably want to be really sure that you have a problem and an easy way to fix it.

Safelog4j:

  • accurately discovers the use of log4j
  • verifies that the log4shell vulnerability is actually present and exploitable
  • prevents the log4shell vulnerability from being exploited

Safelog4j doesn't rely on version numbers or filenames. Instead, it instruments the application to find log4j and perform an internal test to prove the app is exploitable (check). Safelog4j also uses instrumentation to disable the JNDI lookup code used by the attack (block). This is the most effective way to inoculate an otherwise vulnerable application or API.

safelog4j-screenshot

Why should you use an instrumentation-based approach to log4shell (and other security challenges)

Instrumentation has been around for decades, is widely used in performance tools, debugging and profiling, and app frameworks. Many security tools scan from the 'outside-in' and don't have the full context of the running application. This leads to false-positives, false-negatives, and long scan times.

Instrumentation allows us to do security analysis from within the running application - by watching the code run. Directly measuring security from within the running code has speed, coverage, and accuracy benefits. Using instrumentation to analyze for vulnerabilities is often called IAST (Interactive Application Security Testing). Using instrumentation to identify attacks and prevent exploit is often called RASP (Runtime Application Self-Protection).

Safelog4j provides both IAST and RASP capabilities focused on a single vulnerability: log4shell. IAST verifies that the vulnerability is present and actually exploitable. RASP prevents it from being exploited. IAST and RASP can be used for a broad range of vulnerabilities and attacks. Please reach out if you're interested in applying these techniques to new security chaallenges.

Remember, you may be getting false results from other approaches. Scanning file systems, code repos, or containers could easily fail to detect log4j accurately. Determining exploitability by attempting to test, scan, or fuzz for log4shell is even more inaccurate, requiring exactly right input with the exactly right syntax.

  • log4j could be buried in a fat jar, war, or ear
  • log4j could be shaded in another jar
  • log4j could be included in the appserver, not the code repo
  • log4j could be part of dynamically loaded code or plugin
  • log4j could be many different versions with different classloaders in a single app
  • log4j could be masked by use of slf4j or other layers
  • log4j could be renamed, recompiled, or otherwise changed

Launching a JVM with safelog4j...

Basically you just have to get the latest safelog4j-1.0.3.jar and then tell the JVM to use it with the -javaagent flag.

curl -O https://github.com/Contrast-Security-OSS/safelog4j/releases/download/v1.0.3/safelog4j-1.0.3.jar
java -javaagent:safelog4j-1.0.3.jar=[check|block|both|none] -jar yourjar.jar

-or-

curl -O https://github.com/Contrast-Security-OSS/safelog4j/releases/download/v1.0.3/safelog4j-1.0.3.jar
JAVA_TOOL_OPTIONS=-javaagent:/path/to/safelog4j-1.0.3.jar=[check|block|both|none]
java -jar yourjar.jar

Attaching to a running JVM with safelog4j...

curl -O https://github.com/Contrast-Security-OSS/safelog4j/releases/download/v1.0.3/safelog4j-1.0.3.jar
java -javaagent:safelog4j-1.0.3.jar     # will print available JVM processes with PID
java -javaagent:safelog4j-1.0.3.jar PID [check|block|both|none]

Safelog4j Options

  • CHECK means that safelog4j will actually test every log4j instance for log4shell. This is done by generating a synthetic log message and a sensor to detect it in the vulnerable JndiLookup class within log4j. This is iron clad evidence the application will be exploitable if the application ever logs untrusted data (HTTP header, cookie, parameter, form field, multipart, or any other source of untrusted data.

  • BLOCK means that safelog4j will stub out all the methods in the vulnerable log4j JndiLookup class. This is the recommended approach to ensure that log4j can't be exploited. It is harmless, except for the total prevention of this attack.

  • BOTH simply means that both CHECK and BLOCK will occur.

  • NONE disables both CHECK and BLOCK, allowing you to keep the agent in place but completely disabled.

Building and Contributing

We welcome pull requests and issues. Thanks!

git clone 
mvn clean install
java -jar target/safelog4j-x.x.x.jar

License

This software is licensed under the Apache 2 license

Copyright 2021 Contrast Security - https://contrastsecurity.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].