Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2024-3094 PoC — Xz: malicious code in distributed source

Source
Associated Vulnerability
Title: Xz: malicious code in distributed source (CVE-2024-3094)
Description:Malicious code was discovered in the upstream tarballs of xz, starting with version 5.6.0. Through a series of complex obfuscations, the liblzma build process extracts a prebuilt object file from a disguised test file existing in the source code, which is then used to modify specific functions in the liblzma code. This results in a modified liblzma library that can be used by any software linked against this library, intercepting and modifying the data interaction with this library.
Description
Ansible playbook for patching CVE-2024-3094
Readme
# Ansible Playbook for Patching xz-Utils Vulnerability (CVE-2024-3094)

- This document details an Ansible playbook designed to address the critical vulnerability (CVE-2024-3094) identified in xz-Utils versions 5.6.0 and 5.6.1. This vulnerability, classified as a backdoor, grants attackers unauthorized access to affected systems by bypassing SSH authentication.

## Context: xz-Utils Vulnerability (CVE-2024-3094)

- A critical backdoor vulnerability was discovered in xz-Utils versions 5.6.0 and 5.6.1 on March 29, 2024. This vulnerability allows attackers to bypass SSH authentication and gain unauthorized access to affected systems. It is crucial to patch vulnerable systems immediately to mitigate potential security risks.

## Ansible Playbook for Patching

- The provided Ansible playbook addresses this vulnerability by:

    1. Gathering Package Facts: The package_facts module gathers information about installed packages, including their versions.
    2. Version Check: A debug module extracts the base version of the xz-utils package from the gathered facts.
    3. Patching Vulnerable Systems: The package module installs a known-safe version (safe_version) of xz-utils if the system's current version matches the vulnerable versions (5.6.0 or 5.6.1).

## Playbook Structure:

- The playbook consists of three main YAML files:

1. tasks/main.yaml: This file defines the core tasks of the playbook.
    - It gathers package facts using package_facts.
    - It checks the extracted base version using a debug module.
    - It conditionally installs a safe version (safe_version) using package if the system has a vulnerable version.

    ```yaml
        ---
        - name: Gather package facts
          ansible.builtin.package_facts:
            manager: auto
          register: package_facts

        - name: Print the current version of {{ package_name }}
          ansible.builtin.debug:
            var: package_facts.ansible_facts.packages['{{ package_name }}'][0].version.split('-')[0]
          register: version_check

        - name: Install safe version of {{ package_name }}
          ansible.builtin.package:
            name: '{{ package_name }}={{ safe_version }}'
            state: present
          when: version_check=={{non_safe_version1}} or version_check=={{non_safe_version2}}
    ```

2. defaults/main.yaml: This file defines default variables used throughout the playbook.
    - package_name: Name of the package to be patched (set to xz-utils).
    - non_safe_version1: First vulnerable version (set to 5.6.0).
    - non_safe_version2: Second vulnerable version (set to 5.6.1).
    - safe_version: Known-safe version to install (set to 5.4.6).

    ```yaml
        ---
        package_name: xz-utils
        non_safe_version1: 5.6.0
        non_safe_version2: 5.6.1
        safe_version: 5.4.6
    ```

3. playbook.yaml: This file defines the overall execution flow.
    - It targets a host group named machines.
    - It includes the xz-utils_checkout role, which likely contains tasks specific to handling the xz-utils package update (not provided here).

    ```yaml
        ---
        - name: patch xz-utils
          hosts: machines
          roles:
            - xz_utils_patch
    ```

- By following these steps and deploying this playbook, you can effectively patch the critical xz-Utils vulnerability and secure your systems from potential unauthorized access.
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →