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
cve-2026-31431-mitigation — Detection and mitigation tooling for CVE-2026-31431 (Copy Fail) on Linux kernels. Includes Phalanx-CCS and Silent4Labs scripts plus an Ansible playbook to apply temporary mitigation (block algif_aead module or boot parameter) across servers. | Kitploit
Tools/GitHubGitHub/yakovyakov/cve-2026-31431-mitigation
Vulnerability ScannersVulnerability AnalysisScripting & AutomationConfiguration AuditingCloud SecurityDevSecOps
GitHubyakovyakov/cve-2026-31431-mitigation

cve-2026-31431-mitigation

Detection and mitigation tooling for CVE-2026-31431 (Copy Fail) on Linux kernels. Includes Phalanx-CCS and Silent4Labs scripts plus an Ansible playbook to apply temporary mitigation (block algif_aead module or boot parameter) across servers.

View Repository
13 months 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

CVE-2026-31431 (Copy Fail) – Technical Mitigation Tooling

1. Overview

This package provides an automated solution to detect and mitigate the CVE-2026-31431 vulnerability (aka Copy Fail) on Linux systems running affected kernels (versions 4.14 through 6.12.84, 6.13 through 6.18.21, etc.).

The tooling consists of:

  • A unified Bash script (mitigate_copyfail.sh) that:
    • Runs Phalanx-CCS (active attack surface check) and Silent4Labs (risk assessment).
    • Detects the kernel configuration (CONFIG_CRYPTO_USER_API_AEAD=m|y).
    • Applies the appropriate mitigation:
      • Loadable module (=m): creates /etc/modprobe.d/disable-algif-aead.conf with install algif_aead /bin/false and unloads the module (rmmod).
  • Built‑in module (=y): adds the kernel boot parameter initcall_blacklist=algif_aead_init (requires reboot).
  • Verifies the final state and extracts the Silent4Labs score and risk level.
  • An Ansible playbook (mitigation.yml) that:
    • Copies the scripts to remote servers.
    • Executes the mitigation script and captures its output.
    • Strips ANSI colour codes.
    • Parses the final Phalanx status and Silent4Labs values.
    • Displays a human‑readable summary and saves a detailed log on the control machine.
  • Important note: The mitigation is temporary. The permanent fix is to upgrade the kernel to a version that includes the patch a664bf3d603d (≥6.18.22, ≥6.19.12 or ≥7.0).


    2. Requirements

    2.1. Control machine (where Ansible runs)

    • Ansible 2.9 or higher
    • Python 3.6 or higher
    • SSH access to target servers (with become: yes)

    2.2. Remote servers

    • Bash 4+
    • Python 3 (for Phalanx-CCS)
    • sudo privileges (to apply the mitigation)
    • Affected kernel (optional; if the kernel is already patched, the script will not make changes)

    The detection scripts (Phalanx-CCS and Silent4Labs) are safe and do not exploit the vulnerability; they only verify the attack surface.


    3. Repository structure

    root@kitploit:~
    cve-2026-31431-mitigation/
    ├── README.md
    ├── scripts/
    │   ├── mitigate_copyfail.sh      # Unified script (detection + mitigation)
    │   ├── check_copyfail.py         # Phalanx-CCS (reachability checker)
    │   └── check-copyfail.sh         # Silent4Labs (risk assessment)
    ├── ansible/
    │   ├── ansible.cfg               # (optional) Ansible configuration
    │   ├── inventory.ini             # Server inventory
    │   └── mitigation.yml            # Main playbook
    └── resultados_cve/               # Auto‑generated folder for logs
    

    4. Installation and configuration

    4.1. Clone the repository

    root@kitploit:~
    git clone https://github.com/your-username/cve-2026-31431-mitigation.git
    cd cve-2026-31431-mitigation/ansible
    

    4.2. Prepare the inventory (inventory.ini)

    Example for a remote server:

    root@kitploit:~
    [servers]
    server1 ansible_host=192.168.1.10 ansible_user=root
    
    [localhost]
    localhost ansible_connection=local
    
    [all:vars]
    ansible_become=yes
    # ansible_become_password=my_password  # if using password for sudo
    

    4.3. Verify script paths

    In mitigation.yml, the task Copy scripts to remote uses src: "../scripts/{{ item }}". Make sure the relative path is correct, or modify it according to your layout.


    5. Execution

    From the ansible/ directory:

    root@kitploit:~
    ansible-playbook -i inventory.ini mitigation.yml -k -K
    
    • -k asks for the SSH password.
    • -K asks for the become (sudo) password.

    When using localhost with ansible_connection=local, no SSH is needed.

    5.1. Expected output

    The playbook displays a plain‑text summary similar to:

    root@kitploit:~
    ==========================================
    MITIGATION RESULTS
    ==========================================
    Host: server1
    ------------------------------------------
      - Status: SYSTEM SECURE
      - Code: (not applicable)
    ------------------------------------------
      - Final score: 40 / 100
      - Risk level: MEDIUM
    ==========================================
    

    Additionally, a log file is saved in resultados_cve/<hostname>_mitigation.log containing the full script output (date, kernel version, detection messages, etc.).


    6. Debug mode

    If extracted values show ? or Not detected, enable the debug tasks in mitigation.yml:

    • Change when: false to when: true in the three DEBUG tasks (or set when: true to view clean_stdout and regex outputs).
    • Re‑run the playbook and observe the output to adjust search patterns if needed.

    7. Customization

    7.1. Change the log directory

    Edit the tasks Create local results directory and Save full output to local file:

    root@kitploit:~
    path: /absolute/path/resultados_cve
    dest: "/absolute/path/resultados_cve/{{ inventory_hostname }}_mitigation.log"
    

    7.2. Disable script copying (if already present)

    Comment out the copy tasks and adjust the path in the Run mitigation script task to point to the existing location.

    7.3. Automatically clean remote scripts

    Change when: false to when: true in the last task (Clean up remote scripts).


    8. Limitations and warnings

    • Mitigation via boot parameter (initcall_blacklist) requires a reboot to take effect. The playbook does not reboot automatically; a maintenance window must be planned.
    • On systems with CONFIG_CRYPTO_USER_API_AEAD=y (built‑in kernel), the module cannot be unloaded with rmmod; the only way is the boot parameter.
    • The Silent4Labs score is indicative; a medium value (e.g., 40/100) does not mean the system is exploitable if the mitigation is active.
    • Detection scripts may need privileges to read /proc/crypto and /boot/config-*; they run with become: yes.

    9. References

    • CVE-2026-31431 on NVD
    • Technical analysis and affected versions
    • Phalanx-CCS (detection tool)
    • Silent4Labs (risk assessment)

    10. License

    This project is distributed under the MIT license. Third‑party scripts (Phalanx-CCS, Silent4Labs) retain their respective licenses.

    License: MIT


    Support the project

    If you find this tool useful, please consider giving it a star on GitHub!

    GitHub stars


    Download Tool