Debian Codegraph @

mitigations/CVE-2026-46333

raw
1 #!/bin/sh
2
3 # Linux Vulnerability Mitigation
4 # Copyright (C) 2026 Daniel Baumann <[email protected]>
5 #
6 # SPDX-License-Identifier: PD
7 #
8 # This program is free software: you have unlimited permission
9 # to copy, distribute and modify it.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15 set -e
16
17 CVE="CVE-2026-46333"
18 DATE="2026-05-15"
19 NAME="ssh-keysign-pwn"
20 URL="https://github.com/0xdeadbeefnetwork/ssh-keysign-pwn"
21
22 case "${1}" in
23 check)
24 if [ -e "/etc/sysctl.d/${CVE}.conf" ]
25 then
26 # installed
27 exit 0
28 else
29 # removed
30 exit 1
31 fi
32 ;;
33
34 status)
35 LINUX_CURRENT="$(uname -r | grep -Eo '^[0-9.]+')"
36 LINUX_FIXED="7.0.8"
37
38 if [ "$(printf '%s\n%s' "${LINUX_CURRENT}" "${LINUX_FIXED}" | sort -V | head -n1)" = "${LINUX_FIXED}" ]
39 then
40 # fixed
41 exit 0
42 fi
43
44 case "$(cat /proc/sys/kernel/yama/ptrace_scope)" in
45 2|3)
46 # mitigated
47 exit 1
48 ;;
49
50 *)
51 # vulnerable
52 exit 2
53 ;;
54 esac
55 ;;
56
57 install)
58 mkdir -p /etc/sysctl.d
59
60 cat > "/etc/sysctl.d/${CVE}.conf" << EOF
61 # /etc/sysctl.d/${CVE}.conf
62
63 # Name: ${NAME}
64 # Date: ${DATE}
65 # URL: ${URL}
66
67 kernel.yama.ptrace_scope=2
68 EOF
69
70 echo 2 > /proc/sys/kernel/yama/ptrace_scope > /dev/null 2>&1 || true
71 ;;
72
73 remove)
74 rm -f "/etc/sysctl.d/${CVE}.conf"
75 rmdir /etc/sysctl.d > /dev/null 2>&1 || true
76
77 echo 0 > /proc/sys/kernel/yama/ptrace_scope > /dev/null 2>&1 || true
78 ;;
79 esac