Sploitus

Exploit for ansible-role-log4shell

kitploit · 2026-09-04

Exploit Code

MARKDOWN107 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-LUCAB85-ANSIBLE-ROLE-LOG4SHELL
# lucab85.ansible_role_log4shell

![CI](https://github.com/lucab85/ansible-role-log4shell/actions/workflows/ci.yml/badge.svg) ![Release](https://github.com/lucab85/ansible-role-log4shell/actions/workflows/release.yml/badge.svg)

Ansible 角色,用于使用 Red Hat 官方 Log4j 检测器脚本 RHSB-2021-009 扫描目标 Linux 主机,以检测 Log4Shell (CVE-2021-44228)。

已使用 Red Hat 1.3 版检测器 2022-01-10 进行测试。

## Ansible Playbook

该代码也以 Ansible Playbook 形式提供:lucab85/log4j-cve-2021-44228

## 要求

ansible 2.9+

## 角色变量

默认变量值 - `defaults/main.yml`:

root@kitploit:~
    
    
    sh_detector: "cve-2021-44228--2022-01-10-1242.sh"
    sh_signature: 'cve-2021-44228--2022-01-10-1242.sh.asc'
    detector_baseurl: 'https://access.redhat.com/sites/default/files/'
    detector_path: "/var/"
    detector_dir: "/opt/cve-2021-44228/"
    detector_run_dir: 'tmp'
    detector_options: '-n -d --no-progress --scan {{ detector_path }}'
    gpg_keyid: '7514F77D8366B0D9'
    gpg_server: "pgp.mit.edu"
    clean_run_before: true
    delete_after: true
    verify_gpg: false
    

  * `sh_detector`:检测器 bash 脚本的文件名
  * `sh_signature`:检测器 GPG 签名文件的文件名
  * `detector_baseurl`:下载上述文件的基础 URL
  * `detector_path`:要检查的路径(默认 `/var/`)
  * `detector_dir`:检测器的下载路径(默认 `detector_dir` \- `/opt/cve-2021-44228/`)注意:卷需要执行权限!
  * `detector_run_dir`:运行前要创建的子目录(默认 `tmp`)
  * `detector_options`:检测器脚本的命令行选项(默认 `-n -d --no-progress --scan {{ detector_path }}`)
  * `gpg_keyid`:用于验证而下载的 GPG 公钥(默认 Red Hat 产品安全团队 `7514F77D8366B0D9`)



## 依赖

无。

## 下载

首先从 Ansible Galaxy 下载最新版本的 Ansible 角色 lucab85.ansible_role_log4shell:

root@kitploit:~
    
    
    ansible-galaxy install lucab85.ansible_role_log4shell
    
    

## 示例 Playbook

以下示例展示如何使用 `lucab85.ansible_role_log4shell` 角色(以参数形式传递变量):

root@kitploit:~
    
    
    ---
    - name: run detector
      hosts: all
      become: true
      roles:
        - role: lucab85.ansible_role_log4shell
          detector_path: "/var/www"
    
    

## 许可证

MIT / BSD

## 作者信息

此角色由 Luca Berton 于 2021 年创建,他是 Ansible Pilot 的作者。

## Ansible Pilot

更多信息:

  * 网站
  * Ansible Pilot YouTube 频道
  * Medium
  * Twitter



## 捐赠

感谢您的支持:

  * Patreon
  * 请我吃披萨
  * GitHub 赞助