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
Tools/GitHubGitHub/axisops/cve-2021-44228
Vulnerability ScannersVulnerability AnalysisScripting & AutomationConfiguration AuditingDevSecOpsMisconfiguration
GitHubaxisops/cve-2021-44228

CVE-2021-44228

log4j mitigation work

View Repository
2619 days agoNot yet reviewed

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.

    546
  • 2

    ghostlock-app

    yukonga/ghostlock-app

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

    477
  • 3

    ARTEX

    baarai/artex

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

    377
  • 4

    redforge

    cybersecurity91/redforge

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

    324
  • 5

    estorides

    grisuno/estorides

    Aggregates 99+ free OSINT sources in parallel, resolves entities into a knowledge graph, and exports STIX 2.1, MISP, or GraphML with LLM-assisted analysis.

    269
  • 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.

    252

Explore all tools

Browse our collection of tools

View all tools →
Share

Log4Shell CVE-2021-44228 Mitigation Ansible Role

This Ansible role deploys a Python-based script to programmatically mitigate the Log4Shell vulnerability (CVE-2021-44228) by removing the vulnerable JndiLookup class from affected Log4j JAR files.

It is designed to be run via Ansible, but you can also execute the script manually if you wish.

Read more about the Log4Shell vulnerability here:

  • Wikipedia
  • NVD CVE-2021-44228
  • Our Twitter Thread

Features

  • Searches for .jar, .war and .ear files in specified application directories
  • Verifies if JndiLookup.class is present
  • Backs up the original archive before modification, mirroring its full path under the backup directory so that identically-named JARs in different services do not overwrite one another
  • Removes JndiLookup.class using Python's zipfile
  • Reports nested archives it cannot patch (a JAR inside a WAR or EAR, or a Spring Boot fat JAR) by name, rather than skipping them silently
  • Dry run by default. Without --apply the script opens every archive read-only and reports the ones still carrying JndiLookup.class; nothing is backed up or rewritten. The role passes --apply unless log4shell_apply: false
  • Writes all actions to a log file and prints a summary to stdout
  • Configurable via a YAML file, resolved relative to the script
  • Packaged as an Ansible role for automated deployment across multiple systems

Requirements

  • Python 3.9+
  • PyYAML, only for a run that reads a YAML config file (the installed apply). The role installs it from the distribution (python3-yaml, py3-yaml or python3-pyyaml), never from PyPI. The detection entry needs only the standard library: its config goes in as JSON on stdin

No zip or zipinfo needed: archives are read and rewritten with the standard library's zipfile, which matters on minimal container base images where neither is installed.

Configuration

The script is configured via a YAML file, templated automatically by the role.

Example config.yaml:

app_directories:
  - /opt/apps
backup_directory: /opt/backups
log_file: /var/log/log4j_mitigation.log
  • app_directories: list of directories to scan for JAR files
  • backup_directory: where to store the original JAR backups
  • log_file: path to a log file for operation tracking

Usage as an Ansible Role

Add this role to your playbook:

- name: Mitigate Log4Shell CVE-2021-44228
  hosts: all
  become: true
  roles:
    - log4shell_mitigation

Usage Directly

If you wish to run the script manually, you can do so:

  1. Copy the script and the shared library beside it to your target machine:

    files/log4shell_mitigator.py
    files/samp_common.py
    
  2. Create your own config.yaml in the same directory.

  3. Run it:

    python3 log4shell_mitigator.py                  # dry run, config.yaml beside the script
    python3 log4shell_mitigator.py --config /path/to/config.yaml
    sudo python3 log4shell_mitigator.py --apply     # back up and rewrite
    

Validation

  • The script prints scanned=N vulnerable=N patched=N already_stripped=N unreadable=N failed=N nested_needing_review=N dry_run=N to stdout. vulnerable counts archives still carrying JndiLookup.class; already_stripped counts log4j-core archives without it. If nested_needing_review or unreadable is non-zero, those archives were not judged and need handling by hand; the log names each one.
  • Exit codes: 0 nothing left carrying the class, 2 an archive still carries it or could not be judged, 1 a backup or rewrite failed, 130 interrupted
  • Check the configured log file (default: /var/log/log4j_mitigation.log) to see which JARs were patched
  • Confirm your applications still start correctly after the class removal
  • Restore from the backup directory if an application breaks: the backup mirrors the original path, so the file you need is where you left it
  • Ideally, test in a staging environment before production rollout

Notes

  • This approach does not upgrade Log4j but removes the vulnerable class to block the exploit path
  • You should still upgrade Log4j as a long-term fix
  • Nested archives are not patched. Rewriting a JAR inside a WAR inside an EAR is a recursive repack, and getting it wrong leaves an application that will not start. The script names them so you can deal with them deliberately.
  • Always test thoroughly before rolling out widely

Substrate Ansible Mitigation Pack (SAMP)

This repository is a SAMP: the Microcelium Substrate imports it from this exact URL, pins it by commit, verifies the release tag's signature, scans it, and has a human approve it before it runs anywhere.

  • Manifest. samp.yaml declares the CVEs, which hosts it applies to, the detection and apply entry points, whether each needs root, the options with their defaults, every path an apply writes (touches), every program it runs (commands) and the units it may restart. A reviewer reads it first; the substrate checks the code against it.

  • Detection writes nothing. tasks/detect.yml stages the script and samp_common.py in a private temporary directory, runs it with the config as JSON on stdin and the log on stdout, and removes the directory. No script is installed, no config templated, no backup directory made, no log file written and no package installed. It runs under ansible-playbook --check too, because it only reads.

  • Apply. tasks/main.yml with log4shell_apply: true. Options:

    • none

    Nothing is restarted or reloaded unless the option says so, and nothing is ever reverted: a downgrade reinstates the vulnerability.

  • Result. The script's last line on stdout is SAMP-RESULT {"format":1,"verdict":…,"counters":{…},"backups":[…],…}, after the human key=N summary line. The verdict is one of vulnerable, no_fix, unknown, fixed (with "workaround":true when a workaround, not a fixed package, is what is in effect), not_affected, or failed.

  • Exit codes. 0 clean (fixed, not_affected), 2 vulnerable or undecided (vulnerable, no_fix, unknown: never clean), 1 the run itself failed, 130 interrupted.

  • Shared code. log4shell_mitigation/files/samp_common.py is a byte-for-byte copy of samp-common 1.0.3 (the dpkg, rpm and apk version comparisons, the result line, config loading). Its sha256 is in samp.yaml, and tests/test_samp_pack.py fails if the copy differs. Never edit it here; re-vendor it with samp-common's scripts/vendor.py.

  • Releases are SSH-signed annotated tags, samp/v<version> (this one: samp/v1.0.3), signed with a hardware-backed key. The substrate imports a signed tag, never a branch.

License

MIT

Contributing

PRs and improvements welcome -> please fork and submit a merge request.


Disclaimer

This software and accompanying Ansible role are provided “as is” and without warranties of any kind, express or implied. You are solely responsible for evaluating and testing the suitability, safety, and effectiveness of this code before applying it to any environment. AxisOps Ltd (GB08681761) expressly disclaims any liability for damages, data loss, service interruption, or other harm resulting from the use or misuse of this code.

Use at your own risk. Always audit, test, and validate the code in a controlled environment before deployment to production.


SysOps Team @ AxisOps

Download Tool