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
copyfail-mitigation — Ansible playbooks to audit and mitigate CVE-2026-31431 ("Copy Fail"), a local privilege escalation vulnerability in the Linux kernel's `algif_aead` module affecting all major distributions since 2017. | Kitploit
Tools/GitHubGitHub/mahradbt/copyfail-mitigation
Cloud Infrastructure SecurityVulnerability AnalysisConfiguration AuditingDevSecOpsIncident Response
GitHubmahradbt/copyfail-mitigation

copyfail-mitigation

Ansible playbooks to audit and mitigate CVE-2026-31431 ("Copy Fail"), a local privilege escalation vulnerability in the Linux kernel's `algif_aead` module affecting all major distributions since 2017.

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
View Repository
23 months agoNot yet reviewed
Share

CVE-2026-31431 — Copy Fail

Linux Kernel algif_aead Privilege Escalation / Memory Corruption
Ansible-based audit and mitigation playbooks — ready to run in production


Overview

Copy Fail (CVE-2026-31431) is a vulnerability in the Linux kernel's algif_aead module — the userspace-facing AEAD interface of the AF_ALG crypto socket family.
A flaw in the kernel's copy_*user path inside the AEAD request handler allows a local unprivileged user to corrupt kernel memory or escalate privileges by crafting a malformed socket request.

FieldDetail
CVE IDCVE-2026-31431
NicknameCopy Fail
ComponentLinux kernel — algif_aead (net/socket.c, crypto/algif_aead.c)
Attack vectorLocal
Privileges requiredLow (unprivileged user)
ImpactKernel memory corruption / local privilege escalation
PatchedUpstream kernel patch in progress — check your distro vendor

Affected Systems

DistributionAffected versionsStatus
Ubuntu 22.04 / 24.04kernels < patched releasePatch pending — see Ubuntu USN
Debian 12 (Bookworm)kernels < patched releasePatch pending
RHEL / AlmaLinux / Rocky 8 & 9kernels < patched releasePatch pending
Amazon Linux 2 / 2023kernels < patched releasePatch pending
Generic upstreamalgif_aead compiled in or auto-loadedVulnerable if module present

A system is not at immediate risk if algif_aead is not loaded and no userspace tooling loads it on demand (see Audit step 1).


Impact at a Glance

SubsystemAffected by this CVE?Affected by mitigation?
dm-crypt / LUKSNoNo
kTLSNoNo
IPsec / StrongSwanNoNo
OpenSSL (default build)NoNo
GnuTLS / NSSNoNo
OpenSSHNoNo
OpenSSL afalg enginePotentially yesYes — review before applying
kcapi-enc / kcapi-dgst toolsYesYes

Repository Layout

root@kitploit:~
.
├── audit_algif_aead.yml      # Step 1 — audit: detect exposure per host
├── mitigate_copyfail.yml     # Step 2 — mitigation: unload + blacklist module
└── README.md                 # This document

Prerequisites

  • Ansible ≥ 2.14 on the control node
  • community.general collection (ansible-galaxy collection install community.general)
  • SSH access + become: true (sudo) on target hosts
  • lsof installed on targets (usually present by default)

Inventory Setup

inventory.ini is gitignored — it stays local and never reaches the repository. inventory.ini.example is the committed template everyone starts from.

root@kitploit:~
# Clone and prepare
git clone https://github.com/your-org/copy-fail-CVE-2026-31431.git
cd copy-fail-CVE-2026-31431
cp inventory.ini.example inventory.ini

# Edit inventory.ini with your real hosts, then run:
ansible-playbook -i inventory.ini audit_algif_aead.yml

The following paths are gitignored to prevent leaking infrastructure data:

Gitignored pathWhy
inventory.iniReal hostnames / IPs
inventories/Any local inventory directory
copyfail_reports/Audit output contains kernel versions, process lists
.vault_passAnsible Vault password file
*.retryAnsible retry artefacts

Step 1 — Audit

Run the audit playbook before touching anything. It collects per-host evidence and writes a report both locally and on each target.

root@kitploit:~
ansible-playbook -i inventory.ini audit_algif_aead.yml

Reports are fetched to ./copyfail_reports/<hostname>_audit.txt.

What the audit checks

CheckCommandVerdict
Kernel versionuname -rInformational
Module loaded?lsmod | grep algif_aeadLoaded = exposure risk
Active AF_ALG socketslsof | grep AF_ALGUsers found = must review
OpenSSL afalg engineopenssl engine | grep afalgActive = review impact
kcapi tools presentwhich kcapi-*Present = potential users
Mitigation already appliedstat /etc/modprobe.d/disable-algif.confPresent = already mitigated

Interpreting the verdict

ConditionRecommended action
Module NOT loadedLow immediate risk — monitor for kernel patch
Module loaded, no AF_ALG socket usersSafe to apply mitigation
Module loaded and AF_ALG users activeReview processes before applying mitigation
Mitigation file already presentMitigation was previously applied — verify

Step 2 — Mitigation

Run the audit first. The mitigation playbook is safe to run idempotently but the audit gives you the evidence trail.

root@kitploit:~
ansible-playbook -i inventory.ini mitigate_copyfail.yml

To skip specific hosts (e.g. hosts with confirmed kcapi dependency):

root@kitploit:~
ansible-playbook -i inventory.ini mitigate_copyfail.yml \
  -e '{"skip_hosts": ["db-prod-01", "hsm-node-02"]}'

What the mitigation does

  1. Creates /etc/modprobe.d/disable-algif.conf with install algif_aead /bin/false
  2. Unloads the algif_aead module from the running kernel (no reboot required for initial protection)
  3. Updates initramfs so the blacklist survives a reboot (update-initramfs on Debian/Ubuntu, dracut --force on RHEL)
  4. Writes a timestamped log to /var/backup/copyfail_mitigation/mitigation.log

No reboot is required to remove the module from memory.
A reboot is still recommended to confirm the blacklist takes effect and to establish a clean post-mitigation state.


Verification

After the playbook completes, verify on any target host:

root@kitploit:~
# Module must NOT appear
lsmod | grep algif_aead

# Blacklist file must exist and contain the install line
cat /etc/modprobe.d/disable-algif.conf

# Manual load must be rejected
sudo modprobe algif_aead   # Expected: FATAL: Module algif_aead not found or refused

Reverting (after kernel patch)

Once your vendor releases a patched kernel and you have applied it:

root@kitploit:~
# On each host — remove the blacklist
sudo rm /etc/modprobe.d/disable-algif.conf

# Rebuild initramfs
sudo update-initramfs -u        # Debian / Ubuntu
sudo dracut --force              # RHEL / CentOS / Amazon Linux

# Reboot into the patched kernel
sudo reboot

References

  • CERT Europa Advisory 2026-005
  • Ubuntu Security Notice — Copy Fail
  • xint.io — Copy Fail across Linux distributions
  • Linux kernel algif_aead source

License

Released under the MIT License.
Use at your own risk. Always validate in a staging environment before applying to production systems.


Maintained by the community. PRs and issue reports welcome.

Download Tool