CVE-2026-31431 (Copy Fail - Linux kernel bug)
Windows Version
Microsoft Windows [versão 10.0.26200.8246]
WSL Version
2.6.3.0
Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
Kernel Version
6.6.87.2-1
Distro Version
Ubuntu 24.04
Other Software
None needed.
Repro Steps
Fully updated WSL2 is affected by the Copy Fail (CVE-2026-31431) bug.
1 - Download the Copy Fail python script poc - https://copy.fail/ 2 - Run the poc as a normal user 3 - Become root (Local Privilege Escalation)
$ whoami
tiago
$ uname -r
6.6.87.2-microsoft-standard-WSL2
$ ./copy_fail_exp.py
# whoami
root
#
Expected Behavior
After step 3, not become root.
Actual Behavior
Local Privilege Escalation
Diagnostic Logs
No response
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1
The script will output the path of the log file once done.
If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.
Diagnostic information
Detected appx version: 2.6.3.0
Found no WSL traces in the logs
I've reproduced the issue while the log collection was running and submitted the generated WslLogs-2026-04-30_01-01-04.tar.gz file.
This is a bug in the Linux kernel. Since Microsoft compiles its own version of the kernel, an action of Microsoft is required to fix the bug. See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a664bf3d603dc3bdcf9ae47cc21e0daec706d7a5
/emailed-logs
Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'
@chessturo , could you please help update / patch the kernel? Thanks.
@chessturo, Please take a look, the kernel really requires an urgent patch, since it depends on the WSL platform itself and not on the distribution inside it, since updating both distributions will not affect the error and even disabling the algif_aead kernel module according to the manual from: cve.org-CVE-2026-31431 Fix, on ask Ubuntu It does not have an effect within the framework of WSL distributions, in general, the CVE is of a fairly high level based on the status assigned to it on cve.org what is the problem with patching the kernel explicitly? It is not entirely clear what exactly you want to see in the logs of the WSL itself, please specify which log is needed, the kernel? I'll provide it, but for now I'm attaching a screenshot of my reproduced case.
The exploit itself is literally now publicly available to everyone! copy-fail-CVE-2026-31431
In my case: WSL2 Ubuntu 24.04 and 26.04 fully affected.
Thank you! 😉
@chemwolf6922 @tiago304 @RageGen Since I don’t see any rush from Microsoft, probably this instruction can be helpful. It’s basically gonna compile a new kernel with the vulnerable module disabled.
Before compiling a kernel, make sure you have installed all dependencies. I built a kernel in Ubuntu WSL, and I’m not sure if it’s all you need in Arch WSL (though the kernel does work in both of my distros installed). Debian’s deps probably do not differ from Ubuntu’s.
Ubuntu:
sudo apt update
sudo apt install -y build-essential flex bison libssl-dev libelf-dev \
bc dwarves cpio kmod rsync git
Arch:
sudo pacman -S --needed base-devel bc libelf pahole cpio perl tar xz git
Get sources from Microsoft’s official kernel repo. I picked the 6.6 kernel branch since it was my currently used one. Maybe there are other branches with a patch or faulty module disabled, but I don’t know for sure. As far as I know, 6.6 is an LTS release, but CVE is fixed only since 6.6.137.
git clone --depth=1 -b linux-msft-wsl-6.6.y \
https://github.com/microsoft/WSL2-Linux-Kernel.git
cd WSL2-Linux-Kernel
This will copy the default config that is usually used with WSL and disable CRYPTO_USER_API_AEAD flag.
cp Microsoft/config-wsl .config
scripts/config --disable CRYPTO_USER_API_AEAD
make olddefconfig
make -j$(nproc)
Built kernel can be found at arch/x86/boot/bzImage.
UPD: Don't forget to install kernel modules, I completely forgot this part for some reason:
sudo make modules_install
Next thing you do: put it somewhere Windows can find it during a WSL startup. I put it at the default kernel location without changing the filename: C:\Program Files\WSL\tools\bzImage. Then specify this kernel in your HOME directory .wslconfig at C:\Users\<USER>\.wslconfig:
[wsl2]
kernel=C:\\Program Files\\WSL\\tools\\bzImage
Then you just shut down WSL2 and start it again:
wsl --shutdown
wsl
To verify that the correct kernel is used, just check what uname -r says. Expect a trailing + on the version string.
uname -r
# Should be something like this: 6.6.123.2-microsoft-standard-WSL2+
To check that vulnerability is mitigated, you can try to bind a socket with a faulty module:
python3 -c 'import socket; s=socket.socket(38,5); s.bind(("aead","gcm(aes)"))'
You probably will get something like that:
Traceback (most recent call last):
File "<string>", line 1, in <module>
import socket; s=socket.socket(38,5); s.bind(("aead","gcm(aes)"))
~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.14/socket.py", line 236, in __init__
_socket.socket.__init__(self, family, type, proto, fileno)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 97] Address family not supported by protocol
Btw, it is also possible to apply a patch from Linus. Just do this instead of changing kernel config.
git remote add upstream https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch upstream a664bf3d603d --depth=1
git cherry-pick a664bf3d603d
There’s probably gonna be a merge conflict, but the patch is rather small, so backport can be done in no time ;)
UPD2: Just found out that default config (at Microsoft/config-wsl release tag 6.6.123) already has CONFIG_CRYPTO_USER_API_AEAD=m, so it also can be mitigated with a widely proposed solution while being built cleanly (only if kernel modules are installed properly, otherwise there will be none available :trollface:, which is also some form of mitigation probably).
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif.conf
rmmod algif_aead
Though I believe that disabling it is still the best option.
UPD3: Just add to .wslconfig what @pztrick suggested:
[wsl2]
kernelCommandLine=module_blacklist=algif_aead
@ce7er2s Thank you, it works!
@RageGen, I'm happy to help. This whole story about having a socket family only to use hardware crypto acceleration is just mind-boggling (there are usecases, but so niche, almost non-existent). I'm somewhat a poweruser myself and I've never heard of AF_ALG before. Still can't understand why is it enabled by default, since it's nothing new to find severe CVEs using this surface (CVE-2019-8912 and a bunch of smaller ones).
Same on OS: Arch Linux x86_64 Host: Windows Subsystem for Linux - archlinux (2.6.3.0) Kernel: Linux 6.6.87.2-microsoft-standard-WSL2
The mitigation:
echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif.conf
rmmod algif_aead
Also does not work
@fluentmoheshwar
Yes, disable the module by hand don't make any effect, but instructions from @ce7er2s help to me, try it.
The biggest problem is that everything in WSL runs on a single kernel, meaning that all distributions—both current and future—are tied to a vulnerable kernel version. And that’s the most troubling aspect of this situation, because no matter which distribution you install, it will still be vulnerable to this python code.
This is similar to the architecture of LXC containers, since there, too, the host kernel is used for all containers running within Proxmox or any other system. The situation here is the same: we have a host—WSL (the hypervisor)—and all your systems are, in essence, just like LXC containers.
You can try changing the kernel command-line arguments from .wslconfig in the Windows Users folder to disable the problematic algif_read module, e.g. C:\Users\patrick\.wslconfig -- create this file if not already existing (in your own username folder).
[wsl2]
kernelCommandLine=module_blacklist=algif_aead
After updating this config and restarting wsl I was not able to invoke the exploit any longer.
wsl --shutdown
patrick@wsl2:/tmp$ python test_cve_2026_31431.py
[*] CVE-2026-31431 detector kernel=6.6.87.2-microsoft-standard-WSL2 arch=x86_64
[i] Kernel 6.6.87.2-microsoft-standard-WSL2 predates the affected 6.12/6.17/6.18 lines; trigger may not apply even if prerequisites match.
[+] Precondition not met ('authencesn(hmac(sha256),cbc(aes))' cannot be instantiated (No such file or directory)). NOT vulnerable.
This is a work-around until Microsoft can release a new wsl2 kernel. Please verify for yourself that the CVE is mitigated since my machine might differ from yours.
You can learn more about the kernelCommandLine option here:
https://learn.microsoft.com/en-us/windows/wsl/wsl-config
@pztrick Thanks, for another alternative solution🥸
Still, waiting for Microsoft comment..
You can try changing the kernel command-line arguments from
.wslconfigin the Windows Users folder to disable the problematicalgif_readmodule, e.g.C:\Users\patrick\.wslconfig-- create this file if not already existing (in your own username folder).[wsl2] kernelCommandLine=module_blacklist=algif_aeadAfter updating this config and restarting
wslI was not able to invoke the exploit any longer.wsl --shutdownpatrick@wsl2:/tmp$ python test_cve_2026_31431.py [*] CVE-2026-31431 detector kernel=6.6.87.2-microsoft-standard-WSL2 arch=x86_64 [i] Kernel 6.6.87.2-microsoft-standard-WSL2 predates the affected 6.12/6.17/6.18 lines; trigger may not apply even if prerequisites match. [+] Precondition not met ('authencesn(hmac(sha256),cbc(aes))' cannot be instantiated (No such file or directory)). NOT vulnerable.This is a work-around until Microsoft can release a new wsl2 kernel. Please verify for yourself that the CVE is mitigated since my machine might differ from yours.
You can learn more about the
kernelCommandLineoption here: learn.microsoft.com/en-us/windows/wsl/wsl-config
much better than compiling kernel by hand! thanks
@pztrick
I'm not really sure why this work, module_blacklist should only work for loadable modules. In my case algif_aead was embedded into the kernel. If possible, can you tell me what distro you use (Ubuntu for example already blacklisted algif_aead with kmod package update some time ago) and what modules do you have with:
modprobe -l
@pztrick I'm not really sure why this work, module_blacklist should only work for loadable modules. In my case
algif_aeadwas embedded into the kernel. If possible, can you tell me what distro you use (Ubuntu for example already blacklistedalgif_aeadwithkmodpackage update some time ago) and what modules do you have with:modprobe -l
It works for me in Arch Linux
@pztrick I'm not really sure why this work, module_blacklist should only work for loadable modules. In my case
algif_aeadwas embedded into the kernel. If possible, can you tell me what distro you use (Ubuntu for example already blacklistedalgif_aeadwithkmodpackage update some time ago) and what modules do you have with:modprobe -l
@ce7er2s my kernel and distribution are below:
❯ uname -a
Linux wsl2 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
That kernel 6.6.87.2-microsoft-standard-WSL2 matches original report in this thread. My wsl2 guest also reports that this module is loadable (not built in). Maybe your kernel is different than this build from June 2025? The relevant kconfig is CONFIG_CRYPTO_USER_API_AEAD=m in my guest.
❯ zgrep CONFIG_CRYPTO_USER_API_AEAD /proc/config.gz 2>/dev/null || grep CONFIG_CRYPTO_USER_API_AEAD /boot/config-$(uname -r) 2>/dev/null
CONFIG_CRYPTO_USER_API_AEAD=m
@pztrick, it's me who wrong. It is a loadable module in my installation too.
Damn, I should've check locally before rushing to recompile a kernel. I've just looked up a default config at 6.6.87.2 release tag and it has CONFIG_CRYPTO_USER_API_AEAD=y. Combining it with the fact that blacklisting via modprobe.d didn't work, I assumed that algif_aead is in kernel.
It can be because of /init in WSL is Microsoft-provided shim binary and it is not concerned with modprobe -- too early for any userspace blacklist to kick in, yet itself it can insmod whatever is needed to start WSL. Kernel argument here is obviously more capable.
Well, maybe a proper virtual machine is better than WSL. At least you're having a real distro, without some implicit things going on.
I really like your version more, though the exploit fails a bit differently.