The CopyFail bug landing page shouts: "The same 732-byte Python script roots eve...
Paul Ducklin @pducklin@infosec.exchange
The CopyFail bug landing page shouts: "The same 732-byte Python script roots every Linux distribution shipped since 2017."
That's a big claim, but it's not *quite* true.
Firstly, the exploit script assumes that your distro puts the 'su' binary in /usr/bin, which not all distros do. Sure, you can easily modify the script, but then (to be fair) it's not "the same 732-byte Python script."
Secondly, by default the exploit relies on using Python's os.open() function to acquire a file descriptor that references the 'su' binary, which isn't readable by non-root users in all distros. In such cases, the attempt to open() the binary fails, and the exploit doesn't have the needed descriptor via which to abuse the CVE-2026-31431 vulnerability.
The vuln permits the exploit to overwrite the in-memory copy of the program under attack in 4-byte chunks (sneakily leaving the on-disk copy untouched and thereby sidestepping lots of behaviour-blocking EDR tools and triggers), replacing it temporarily with malware. The exploit then launches the attacked program with a regular call to os.system(), which runs the infected version directly from memory, instead of reloading the untainted version from disk.
If the on-disk program is setuid-root, which means it magically acquires root privileges even if a regular user runs it, then the injected-into-memory malware runs as root, too, making this an elevation of privilege (EoP) attack by which even the most limited intrusion could be ramped up to give cybercriminals full-on sysadmin access.
But without that file descriptor to start with, the exploit doesn't work.
At least Slackware and Alpine (in my limited experiments) install with an 'su' that isn't readable unless you are already root, so those distros seem to be safe from the widely circulating 732-byte Python script, at least.
Of course, you don't have to use 'su' when triggering the exploit - any (or almost any) world-readable setuid-root program will do, which means that even if the core utils in your distro are safe, other stuff that you have installed may not be.
So, even if you have already patched against CVE-2026-31431, why not review your setuid-root files anyway? They're generally treated as a 'necessary evil', so try to arrange your digital life so you have no more that a handful of them. Consider making them all readable by root only, if you can, given that where one now-patched exploit was discovered, others may yet lurk.
Good news is that wise minds are already arguing that the kernel code that led to this exploit (exposing the kernel's cryptographic code to userland via the socket API - and yes, you read that correctly) is a "feature" that no one ever actually needed, that very few products use, that has already led to CVE-numbered vulnerabilities, and that would best be "patched" by being removed altogether.
Because less is the new more, folks!