Unpacking Dirty Frag: How the Copy Fail Exploit Elevates Privileges in Linux (CVE-2026-31431)

Introduction

CVE-2026-31431 is a Linux kernel local privilege escalation vulnerability known widely as Dirty Frag or Copy Fail. This vulnerability allows attackers to gain root access, posing a significant risk to Linux systems. Knowing how CVE-2026-31431 works helps in defense.

This post covers the flaw's technical details, its observed exploitation, and methods for detection and mitigation. The public disclosure of Dirty Frag in early May 2026 led to a swift response, yet malicious samples were already in circulation days before the embargo break. The early activity shows proactive breach detection and advanced threat intelligence are needed.

PurpleOps continuously monitors such critical vulnerabilities, providing insights into evolving threats. Our analysis of CVE-2026-31431 provides a full overview, using research that documents its exploitation and spread.

What is CVE-2026-31431 and why is it critical?

CVE-2026-31431 is a Linux kernel privilege escalation vulnerability that permits an unprivileged local attacker to gain root access on affected systems. This vulnerability is critical because it bypasses standard access controls, granting full control over the compromised machine.

The vulnerability resembles Dirty Pipe flaws (CVE-2022-0847), which manipulate the kernel's page-cache to write data into read-only memory regions without proper authorization. Attackers can use this mechanism to inject malicious code and alter sensitive files, which can lead to a complete system compromise. CVE-2026-31431 is the official designation. It is also known as Dirty Frag, from the V4bel/dirtyfrag GitHub reference implementation, and Copy Fail, an earlier press nickname. For more context on similar Linux kernel issues, see our blog post on the Dirty Frag Linux privilege escalation vulnerability.

Vulnerability Details

CVE-2026-31431 facilitates local privilege escalation within the Linux kernel. The vulnerability lies in how the kernel handles certain memory operations, especially regarding the page-cache. Attackers can create a sequence of operations to write arbitrary data to read-only pages, circumventing permission checks.

The reference exploits for CVE-2026-31431 use page-cache abuse, like Dirty Pipe. Attackers use this flaw to raise their privileges from a standard user to root. This process typically involves exploiting a kernel component that improperly handles memory to write to restricted areas, then injecting and executing shellcode into a privileged process or critical system file to achieve root access.

Affected products include all major Linux distributions. Ubuntu issued fixes shortly after public disclosure. The severity of the vulnerability is significant due to the direct path to root access it offers. While a CVSS score was not universally available at the time of initial reporting, privilege escalation vulnerabilities of this nature commonly receive high severity ratings. PurpleOps regularly tracks critical vulnerabilities, including those affecting the Linux kernel, for updates to its cyber threat intelligence platform. Our analysis also covers other recent Linux kernel privilege escalation exploits, such as CVE-2026-31431.

Exploitation and Impact

CVE-2026-31431 has been actively exploited in the wild, with malicious samples found prior to public disclosure. The earliest classified malicious sample, identified as Linux.Exploit.CVE-2026-31431, was first seen on April 29, 2026, at 21:19 UTC. This indicates threat actors were using the vulnerability before the public knew about it.

A surge in samples occurred on May 1, 2026, with over 50 distinct samples submitted overnight. This activity continued steadily through May 8, when the V4bel/dirtyfrag reference implementation was published on GitHub, coinciding with widespread press coverage of the broken embargo. As of May 8, 2026, 163 unique samples linked to CVE-2026-31431 were identified. These samples fall under two primary threat-name conventions:

  • exploit:CVE-2026-31431: 148 samples, with names like Linux.Exploit.CVE-2026-31431, Linux.Exploit.CopyFail, and Linux.Trojan.Multiverze.
  • Linux.Exploit.DirtyFrag and Linux.Trojan.DirtyFrag: 15 samples, derived from the V4bel/dirtyfrag GitHub reference.

Variants include ELF binaries and Python scripts. A malicious PyPI wheel was also observed. This diversity in exploit types suggests a broad range of threat actors adopting the vulnerability for various purposes. The presence of Linux.Trojan.Multiverze indicates active malware family adoption, integrating the exploit into larger malware frameworks. This activity shows the importance of real-time ransomware intelligence and advanced breach detection mechanisms to identify and counter such threats promptly. PurpleOps' dark web monitoring service and underground forum intelligence play a role in tracking the distribution and discussion of these exploits.

The shellcode employed in the V4bel reference implementation typically performs privilege normalization, clearing supplementary groups and setting both user and group IDs to root (0). This is achieved through specific syscalls:

  • setgid(0): Sets the group ID to root.
  • setuid(0): Sets the user ID to root.
  • setgroups(0, NULL): Clears supplementary groups.
  • execve("/bin/sh", ...): Spawns a root shell, often with the TERM=xterm environment variable for a functional interactive terminal.

This functionality indicates the objective is to gain and maintain persistent root access for further malicious activities. The MITRE ATT&CK framework maps the exploitation of CVE-2026-31431 to several techniques:

  • T1068: Exploitation for Privilege Escalation: The core mechanism of the vulnerability.
  • T1548.001: Abuse Elevation Control Mechanism: Setuid and Setgid: Relates to the shellcode's use of setuid(0) and setgid(0).
  • T1059.004: Command and Scripting Interpreter: Unix Shell, T1059.006: Python: Reflects the execution of /bin/sh and the presence of Python-script variants.
  • T1195.002: Supply Chain Compromise: Compromise Software Supply Chain: Evidenced by the malicious PyPI wheel (copyfail-0.1.0-py3-none-any.whl) carrying exploit code. This shows the risk to software development pipelines and requires supply-chain risk monitoring.

The discovery of the malicious PyPI wheel shows the need for supply-chain risk monitoring as a key defense. Organizations should implement strong scanning for inbound packages and their transitive dependencies to prevent kernel exploits from entering development environments.

How can organizations detect and mitigate Dirty Frag exploitation?

Detecting and mitigating CVE-2026-31431 exploitation involves patching, proactive hunting, and continuous monitoring. Organizations must implement immediate actions to reduce their exposure to this Linux kernel privilege escalation vulnerability.

Patching and Vendor Advisories:

  • Apply vendor kernel updates immediately. Ubuntu has released fixes for CVE-2026-31431. All major Linux distributions are reported to be affected. Organizations should consult vendor advisories for Red Hat, Debian, SUSE, and other distributions. Rebooting to load the patched kernel is essential.

Threat Hunting and Detection with YARA Rules:

  • Deploy YARA rules for shellcode detection. The V4bel reference implementation's shellcode contains stable patterns that can be detected with high specificity. The provided YARA rule, DirtyFrag_Reference_Shellcode_1, targets specific opcode patterns (e.g., mov al, 0x6a; syscall for setgid(0)) and plaintext strings (/bin/sh, TERM=xterm).
  • Example YARA rule:
    rule DirtyFrag_Reference_Shellcode_1

{

meta:

author = "Malware Utkonos"

date = "2026-05-08"

description = "Detects shellcode from reference implementation of DirtyFrag"

reference = "

strings:

$op1 = { b06a 0f05 }

$op2 = { b069 0f05 }

$op3 = { b074 0f05 }

$op4 = { 6a3b 58 0f05 }

$a1 = "/bin/sh"

$a2 = "TERM=xterm"

condition:

all of them

}

  • This YARA rule targets the V4bel reference implementation and its derivative compilations. Python-script variants, which require text-based detection patterns, are not covered by this opcode-based rule. Integrating these YARA rules into a cyber threat intelligence platform like PurpleOps enables continuous local matching and cloud retro hunting, identifying files submitted from April 29, 2026, onward.

Spectra Intelligence Hunting Queries:

  • Utilize specific queries for full corpus coverage. The CVE-2026-31431 corpus is categorized under two threat-name conventions. To achieve full visibility, run all relevant hunting queries:
  • exploit:CVE-2026-31431: This primary query covers 148 samples carrying the CVE-tagged exploit field.
  • threatname:DirtyFrag: Targets V4bel-specific threat names.
  • threatname:Linux.Trojan.Multiverze AND exploit:CVE-2026-31431: Hunts for active trojan family adoption.
  • threatname:Script-Python.Exploit.CVE-2026-31431
  • threatname:Package.Exploit.CopyFail
  • threatname:Linux.Exploit.CopyFail: These queries cover Python-script and supply chain variants.

Indicators of Compromise (IOCs):

A representative subset of SHA-256 hashes for samples related to CVE-2026-31431 includes:

SHA-256TypeThreat nameAVFirst seen (UTC)
e7fb35c16fbe6285d4f36764fe5f6f81b0ff51c047f5716bbb8ae60b8318d82eELF64/SOLinux.Exploit.DirtyFrag22026-05-08 13:27:52
133a79e9094c14c0f41378c712fd9a3f7687e5ab6f781bd5fb94774e64f4b48dELF64/SOLinux.Exploit.DirtyFrag22026-05-07 23:37:10
381755b623dd7a4c2b5d80aaf40d7083eea727dd1f473545539029656ca81817ELF64/SOLinux.Trojan.DirtyFrag42026-05-08 11:01:45
a02ea2ba8108a9b7a997faa8808cfc55bb69af54e6911f0fec0451da1673d6f0ELF64/ExeLinux.Trojan.DirtyFrag, Linux.Exploit.DirtyFrag42026-05-08 11:09:07
d99c480661fde92c3c7d1790c2e1d695fd72f4b82d47adb6e10093fd096c0708Script/PythonLinux.Exploit.CVE-2026-31431172026-05-05 09:13:05
48c0bb0760a08a70fa6cf96c0102c968cb1bc62d319cba0a605247be1e2e4180ELF64Linux.Exploit.CVE-2026-31431152026-05-05 10:43:12
76ad71ac3cf6d50bf4038048b9832df5e9aa63b85865c02ad1dd91cb2fdaef4bELF64Linux.Exploit.CVE-2026-31431132026-05-05 16:46:10
ea21dbc2c11ee666cb9e2b4d2cd1e6a4776b3ea6bff6d57f80a6cf31624791e9ELF64Linux.Exploit.CVE-2026-31431132026-05-01 06:33:38
bd855eb0a90c8cb6618662c48cc93d3a16cf9a7e4d945b70e3be3500f60042f9Script/PythonLinux.Exploit.CVE-2026-31431122026-05-01 17:57:55
26865ea1744e00664a13b1a65f2e670def8d3bb84b10533f18f2e0ac43548fe0ELF64Linux.Exploit.CVE-2026-31431122026-05-07 03:12:51
912714027c9ea12b8aac55d71ccfa4a0592e058a4d07cf578e67f4bfdab63c4aELF64Linux.Trojan.Multiverze72026-05-05 19:46:28
b090751120d4814744c24253a820a67db5c3b2957c0334cf7d52e7847d6af409ELF64Linux.Trojan.Multiverze102026-05-02 21:20:03
d658fd3b2fe203180e6a3ef6863a3ef6863a3ef6863a5eb3cdd92cfecbaa68de5b8f550702762eabELF64Linux.Trojan.Multiverze92026-05-01 20:33:31
5bd7df1c89cf9f69e6003d73a8e3b9eab9cf6025e6911f0fec0451da1673d6f0ELF64Linux.Trojan.Multiverze92026-05-01 20:37:11
c60c5527e49c3bb502b672b7fffc3eb5b8c6ff9d4e30eae5d559b54d2ce03a01Script/PythonScript-Python.Exploit.CVE-2026-3143182026-05-07 12:42:18
c935a349a974ef605b5a12141934d966315c0da5fe2343750815927a39f92881Script/PythonScript-Python.Exploit.CVE-2026-3143192026-05-06 08:33:56
affde15382361e2fb87a7d32a5260ab72cc5d2d734fd7de6d21a1c94d0f58d22Script/PythonScript-Python.Exploit.CVE-2026-31431112026-05-05 16:07:12
424d306e8cba73ce83af5faf051a169d957a10213509d7132b620f427b4159bbELF64Linux.Exploit.CopyFail112026-05-05 09:27:01
1507e6e6945bfdf652ef7ed2fe10e01245074fd54d29d8eca98f265a91c88e63ELF64Linux.Exploit.CopyFail102026-05-03 10:42:00
7bd2a8093d38e2694199490642e91965bdc666121070330c76ae155b6581ce75PyPI WheelPackage.Exploit.CopyFail72026-05-01 07:52:00
26a75e5ef8d30ae678596fafe56e1f191d17fd9a438c463cd7dcefb765c2fb94Archive/ZIPLinux.Exploit.CVE-2026-3143122026-05-08 10:56:03
a567d09b15f6e4440e70c9f2aa8edec8ed59f53301952df05c719aa3911687f9ELF64Linux.Exploit.CVE-2026-3143192026-04-29 21:19:51
3c5ec61632d0699e048d8428461c4d65f89988a370396db2f070f63ebbf9dbaeELF64Linux.Exploit.CVE-2026-31431112026-04-30 03:09:57
d401e7d1c00605749d6c617ace73ab20a762b72e41c2e1590331596e38219a61ELF64Linux.Exploit.CVE-2026-31431102026-04-30 09:52:21
ee2d150a2f73a561983088a6b1a6a2b1c452777aaf03181387708c6907ac6dcdText/CCPP(goodware - source code)02026-05-07 23:30:56

These IOCs are critical for proactive breach detection and incident response. Organizations can integrate these hashes into their security tools for immediate scanning.

Mitigation and Patches

Mitigation for CVE-2026-31431 focuses on patching affected systems and proactive security measures. Addressing this privilege escalation vulnerability promptly is essential to maintain system integrity.

  • Apply all available vendor kernel updates: Ubuntu has released fixes for CVE-2026-31431. All major Linux distributions are reported to be affected. Organizations should consult their respective vendor advisories (e.g., Red Hat, Debian, SUSE) for specific patch versions and instructions. A system reboot to load the patched kernel is necessary after applying updates.
  • Audit setuid and setgid binaries on production Linux hosts: Any binary configured with the setuid or setgid bit is a potential target for post-exploitation. Organizations should review the list of such binaries, understand their purpose, and remove these permissions where they are not strictly required for system function.
  • Monitor for ELF binary execution from writable paths: Configure security monitoring systems to alert on the execution of ELF binaries located in commonly writable directories such as /tmp, /dev/shm, or other world-writable locations. These paths are frequently used by attackers to stage and execute locally compiled exploit code.
  • Implement privilege escalation process chain monitoring: Establish alerts for process events where a low-privilege parent process spawns a child process that suddenly operates with UID 0 (root privileges). This is particularly relevant when the parent binary is an unsigned ELF file or a Python interpreter executing a script not part of the organization's verified software inventory. This capability can be enhanced using a strong cyber threat intelligence platform that provides real-time ransomware intelligence for suspicious process activity.
  • Scan software supply chains for malicious packages: The identification of a malicious PyPI wheel (copyfail-0.1.0-py3-none-any.whl) demonstrates the threat of compromised software supply chains. Organizations should utilize supply-chain risk monitoring solutions to scan all inbound packages and their transitive dependencies within their build pipelines. This helps prevent kernel exploits from entering development or production environments. For more on detecting kernel vulnerabilities, see Linux kernel vulnerabilities and breach detection.