Stop applying AEAD runtime blacklist

This commit is contained in:
byjoey
2026-06-09 19:34:25 +08:00
parent facb856ebf
commit 0a9305da3f
3 changed files with 21 additions and 17 deletions
+9 -3
View File
@@ -120,7 +120,6 @@ arm64-7.0.11
- `tcp_bbr` 模块版本是否为 `3` - `tcp_bbr` 模块版本是否为 `3`
- 当前 TCP 拥塞控制算法是否为 `bbr` - 当前 TCP 拥塞控制算法是否为 `bbr`
- CVE-2026-31431 缓解是否写入。
- Dirty Frag 相关模块黑名单是否写入。 - Dirty Frag 相关模块黑名单是否写入。
也可以手动检查: 也可以手动检查:
@@ -157,7 +156,7 @@ modinfo tcp_bbr 2>/dev/null | grep '^version:'
## 安全缓解 ## 安全缓解
脚本启动时会写入安全缓解规则: 脚本启动时会写入 Dirty Frag 风险面收敛规则:
```text ```text
/etc/modprobe.d/99-joeyblog-security.conf /etc/modprobe.d/99-joeyblog-security.conf
@@ -165,11 +164,18 @@ modinfo tcp_bbr 2>/dev/null | grep '^version:'
包含: 包含:
- `algif_aead` 黑名单,用于收敛 CVE-2026-31431 风险面。
- `esp4` / `esp6` / `rxrpc` 黑名单,用于收敛 Dirty Frag 相关风险面。 - `esp4` / `esp6` / `rxrpc` 黑名单,用于收敛 Dirty Frag 相关风险面。
如果模块当前已加载,脚本会尝试卸载;如果模块被占用,则黑名单会在重启后生效。 如果模块当前已加载,脚本会尝试卸载;如果模块被占用,则黑名单会在重启后生效。
CVE-2026-31431 对应的 AEAD userspace 接口在新构建内核中由内核配置侧收敛:
```text
# CONFIG_CRYPTO_USER_API_AEAD is not set
```
因此安装脚本不再额外写入 `algif_aead` 黑名单。
## CVE-2026-31431 检测 ## CVE-2026-31431 检测
仅检测,不利用: 仅检测,不利用:
+1 -1
View File
@@ -167,7 +167,7 @@ def main() -> None:
if high_risk_surface: if high_risk_surface:
print("[!] 检测到高风险暴露面。") print("[!] 检测到高风险暴露面。")
print("[!] 若内核未包含上游修复补丁,系统可能受 CVE-2026-31431 影响。") print("[!] 若内核未包含上游修复补丁,系统可能受 CVE-2026-31431 影响。")
print("[!] 建议:升级内核,禁用 CRYPTO_USER_API_AEAD,或屏蔽 algif_aead。") print("[!] 建议:升级到新构建内核,禁用 CRYPTO_USER_API_AEAD;旧内核可临时屏蔽 algif_aead。")
elif reduced_surface: elif reduced_surface:
print("[+] 风险面已收敛/已缓解。") print("[+] 风险面已收敛/已缓解。")
else: else:
+11 -13
View File
@@ -40,7 +40,7 @@ CURRENT_QDISC=$(sysctl net.core.default_qdisc | awk '{print $3}')
SYSCTL_CONF="/etc/sysctl.d/99-joeyblog.conf" SYSCTL_CONF="/etc/sysctl.d/99-joeyblog.conf"
# 模块自动加载配置文件路径 # 模块自动加载配置文件路径
MODULES_CONF="/etc/modules-load.d/joeyblog-qdisc.conf" MODULES_CONF="/etc/modules-load.d/joeyblog-qdisc.conf"
# 安全加固配置(缓解 CVE-2026-31431 # 安全加固配置(Dirty Frag 风险面收敛
SECURITY_MODPROBE_CONF="/etc/modprobe.d/99-joeyblog-security.conf" SECURITY_MODPROBE_CONF="/etc/modprobe.d/99-joeyblog-security.conf"
# 可选:提升 GitHub API 限额(支持 GITHUB_TOKEN / GH_TOKEN # 可选:提升 GitHub API 限额(支持 GITHUB_TOKEN / GH_TOKEN
GITHUB_API_TOKEN="${GITHUB_TOKEN:-${GH_TOKEN:-}}" GITHUB_API_TOKEN="${GITHUB_TOKEN:-${GH_TOKEN:-}}"
@@ -122,7 +122,7 @@ ensure_security_rule() {
fi fi
} }
# 函数:应用安全缓解(CVE-2026-31431 + Dirty Frag # 函数:应用安全缓解(Dirty Frag)
apply_security_mitigations() { apply_security_mitigations() {
local changed=0 local changed=0
@@ -132,9 +132,14 @@ apply_security_mitigations() {
changed=1 changed=1
fi fi
# CVE-2026-31431 mitigation # The latest kernel builds disable CONFIG_CRYPTO_USER_API_AEAD, so remove
ensure_security_rule "blacklist algif_aead" changed # legacy algif_aead runtime blacklists written by older script versions.
ensure_security_rule "install algif_aead /bin/false" changed if grep -Eq '^(blacklist algif_aead|install algif_aead /bin/false)$' "$SECURITY_MODPROBE_CONF" 2>/dev/null; then
sudo sed -i '/^blacklist algif_aead$/d' "$SECURITY_MODPROBE_CONF"
sudo sed -i '/^install algif_aead \/bin\/false$/d' "$SECURITY_MODPROBE_CONF"
changed=1
echo -e "\033[1;32m✔ 已移除旧的 algif_aead 黑名单;CVE-2026-31431 风险由新内核配置侧收敛\033[0m"
fi
# Dirty Frag mitigation # Dirty Frag mitigation
ensure_security_rule "blacklist esp4" changed ensure_security_rule "blacklist esp4" changed
@@ -144,7 +149,7 @@ apply_security_mitigations() {
ensure_security_rule "blacklist rxrpc" changed ensure_security_rule "blacklist rxrpc" changed
ensure_security_rule "install rxrpc /bin/false" changed ensure_security_rule "install rxrpc /bin/false" changed
for mod in algif_aead esp4 esp6 rxrpc; do for mod in esp4 esp6 rxrpc; do
if lsmod | grep -q "^$mod"; then if lsmod | grep -q "^$mod"; then
if sudo modprobe -r "$mod" 2>/dev/null; then if sudo modprobe -r "$mod" 2>/dev/null; then
echo -e "\033[1;32m✔ 已卸载 $mod 模块,当前会话已完成缓解\033[0m" echo -e "\033[1;32m✔ 已卸载 $mod 模块,当前会话已完成缓解\033[0m"
@@ -447,13 +452,6 @@ case "$ACTION" in
echo -e "\033[33mBBR v3 未完全生效。请确保已安装内核并重启,然后使用选项 4-7 启用。\033[0m" echo -e "\033[33mBBR v3 未完全生效。请确保已安装内核并重启,然后使用选项 4-7 启用。\033[0m"
fi fi
if grep -Eq '^\s*blacklist\s+algif_aead' "$SECURITY_MODPROBE_CONF" 2>/dev/null; then
echo -e "\033[1;32m✔ CVE-2026-31431 缓解状态:已启用(algif_aead 已黑名单)\033[0m"
else
echo -e "\033[31m✘ CVE-2026-31431 缓解状态:未启用\033[0m"
echo -e "\033[33m 建议重新运行脚本,或手动写入 $SECURITY_MODPROBE_CONF\033[0m"
fi
if grep -Eq '^\s*blacklist\s+esp4' "$SECURITY_MODPROBE_CONF" 2>/dev/null \ if grep -Eq '^\s*blacklist\s+esp4' "$SECURITY_MODPROBE_CONF" 2>/dev/null \
&& grep -Eq '^\s*blacklist\s+esp6' "$SECURITY_MODPROBE_CONF" 2>/dev/null \ && grep -Eq '^\s*blacklist\s+esp6' "$SECURITY_MODPROBE_CONF" 2>/dev/null \
&& grep -Eq '^\s*blacklist\s+rxrpc' "$SECURITY_MODPROBE_CONF" 2>/dev/null; then && grep -Eq '^\s*blacklist\s+rxrpc' "$SECURITY_MODPROBE_CONF" 2>/dev/null; then