23 - Pentesting Telnet
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๊ธฐ๋ณธ ์ ๋ณด
Telnet์ ๋คํธ์ํฌ๋ฅผ ํตํด ์ฌ์ฉ์๊ฐ ์ปดํจํฐ์ ์ ๊ทผํ ์ ์๋๋ก ํด์ฃผ๋ ์์ ํ์ง ์์ ๋คํธ์ํฌ ํ๋กํ ์ฝ์ ๋๋ค.
๊ธฐ๋ณธ ํฌํธ: 23
23/tcp open telnet
Enumeration
Banner Grabbing
nc -vn <IP> 23
๋ชจ๋ ํฅ๋ฏธ๋ก์ด enumeration์ nmap์ผ๋ก ์ํํ ์ ์์ต๋๋ค:
nmap -n -sV -Pn --script "*telnet* and safe" -p 23 <IP>
The script telnet-ntlm-info.nse will obtain NTLM info (Windows versions).
From the telnet RFC: In the TELNET Protocol are various โ์ต์ โ that will be sanctioned and may be used with the โDO, DONโT, WILL, WONโTโ structure to allow a user and server to agree to use a more elaborate (or perhaps just different) set of conventions for their TELNET connection. Such options could include changing the character set, the echo mode, etc.
์ด ์ต์ ๋ค์ ์ด๊ฑฐํ ์ ์๋ค๋ ๊ฒ์ ์๊ณ ์์ผ๋ ๋ฐฉ๋ฒ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๋ฐฉ๋ฒ์ ์์๋ฉด ์๋ ค์ฃผ์ธ์.
Telnet ์ต์ / ๊ธฐ๋ฅ ์ด๊ฑฐ
Telnet uses IAC + DO/DONT/WILL/WONT negotiations to enable options. You can observe supported options by capturing the initial negotiation and by probing for specific features.
Nmap ์ต์ /๊ธฐ๋ฅ ํ๋ก๋ธ
# Detect support for the Telnet ENCRYPT option
nmap -p 23 --script telnet-encryption <IP>
# Enumerate Microsoft Telnet NTLM info (NetBIOS/DNS/OS build)
nmap -p 23 --script telnet-ntlm-info <IP>
# Brute-force via NSE (alternative to Hydra/Medusa)
nmap -p 23 --script telnet-brute --script-args userdb=users.txt,passdb=pass.txt <IP>
telnet-encryption ์คํฌ๋ฆฝํธ๋ ENCRYPT ์ต์
์ ์ง์ํ๋์ง ํ์ธํฉ๋๋ค; ์ผ๋ถ ๊ตฌํ์ฒด๋ ๊ณผ๊ฑฐ์ ์ด ์ต์
์ ์๋ชป ์ฒ๋ฆฌํด ์ทจ์ฝํ์ผ๋, ์ด ์คํฌ๋ฆฝํธ๋ ์ง์ ์ฌ๋ถ๋ง ํ์ธํฉ๋๋ค.
telnet-ntlm-info๋ Microsoft Telnet NTLM์ด ํ์ฑํ๋ ๊ฒฝ์ฐ NTLM ๋ฉํ๋ฐ์ดํฐ(NetBIOS/DNS/OS build)๋ฅผ ๋
ธ์ถํฉ๋๋ค.
telnet-brute๋ Telnet์ ์ํ NSE brute-force ๊ฐ์ฌ๊ธฐ์
๋๋ค.
Brute force
์ค์ ํ์ผ
/etc/inetd.conf
/etc/xinetd.d/telnet
/etc/xinetd.d/stelnet
HackTricks ์๋ ๋ช ๋ น์ด
Protocol_Name: Telnet #Protocol Abbreviation if there is one.
Port_Number: 23 #Comma separated if there is more than one.
Protocol_Description: Telnet #Protocol Abbreviation Spelled out
Entry_1:
Name: Notes
Description: Notes for t=Telnet
Note: |
wireshark to hear creds being passed
tcp.port == 23 and ip.addr != myip
https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-telnet.html
Entry_2:
Name: Banner Grab
Description: Grab Telnet Banner
Command: nc -vn {IP} 23
Entry_3:
Name: Nmap with scripts
Description: Run nmap scripts for telnet
Command: nmap -n -sV -Pn --script "*telnet*" -p 23 {IP}
Entry_4:
Name: consoleless mfs enumeration
Description: Telnet enumeration without the need to run msfconsole
Note: sourced from https://github.com/carlospolop/legion
Command: msfconsole -q -x 'use auxiliary/scanner/telnet/telnet_version; set RHOSTS {IP}; set RPORT 23; run; exit' && msfconsole -q -x 'use auxiliary/scanner/telnet/brocade_enable_login; set RHOSTS {IP}; set RPORT 23; run; exit' && msfconsole -q -x 'use auxiliary/scanner/telnet/telnet_encrypt_overflow; set RHOSTS {IP}; set RPORT 23; run; exit' && msfconsole -q -x 'use auxiliary/scanner/telnet/telnet_ruggedcom; set RHOSTS {IP}; set RPORT 23; run; exit'
Recent Vulnerabilities (2022-2026)
- CVE-2024-45698 โ D-Link Wi-Fi 6 routers (DIR-X4860): telnet ์๋น์ค์ ์ ๋ ฅ ๊ฒ์ฆ ๋ถ์ฌ๋ก ์๊ฒฉ ๊ณต๊ฒฉ์๊ฐ ํ๋์ฝ๋ฉ๋ ์๊ฒฉ์ฆ๋ช ์ ์ฌ์ฉํด ๋ก๊ทธ์ธํ๊ณ OS ๋ช ๋ น์ ์ฃผ์ ํ ์ ์์; ํ์จ์ด 1.04B05 ์ด์์ผ๋ก ์์ ๋จ.
- CVE-2023-40478 โ NETGEAR RAX30: Telnet CLI
passwd๋ช ๋ น์ ์คํ ๊ธฐ๋ฐ ๋ฒํผ ์ค๋ฒํ๋ก์ฐ๋ก ๋คํธ์ํฌ ์ธ์ ํ๊ฒฝ์์ root๋ก์์ code execution์ด ๊ฐ๋ฅํด์ง; ์ธ์ฆ์ด ํ์ํ์ง๋ง ์ฐํ๋ ์ ์์. - CVE-2022-39028 โ GNU inetutils telnetd: ๋ ๋ฐ์ดํธ ์ํ์ค (
0xff 0xf7/0xff 0xf8)๊ฐtelnetd์์ NULL-pointer dereference๋ฅผ ์ ๋ฐํ ์ ์์ผ๋ฉฐ, ๋ฐ๋ณต์ ์ธ ํฌ๋์๋ inetd๊ฐ ์๋น์ค๋ฅผ ๋นํ์ฑํํ๊ฒ ๋ง๋ค์ด DoS๋ฅผ ์ด๋ํ ์ ์์.
์ทจ์ฝ์ ๋ถ๋ฅ(vulnerability triage) ์ ์ด๋ฌํ CVE๋ค์ ์ผ๋์ ๋์ด๋ผ โ ๋์์ด ํจ์น๋์ง ์์ ํ์จ์ด๋ ๋ ๊ฑฐ์ inetutils Telnet daemon์ ์คํ ์ค์ด๋ผ๋ฉด ๋น๊ต์ ์ง์ ์ ์ธ code-execution ๊ฒฝ๋ก ๋๋ ํ๊ดด์ ์ธ DoS๋ก ์ด์ด์ง ์ ์๋ค.
CVE-2026-24061 โ GNU Inetutils telnetd auth bypass (Critical)
Summary: telnetd in GNU Inetutils through 2.7 allows remote authentication bypass via a USER environment variable value of -f root, resulting in unauthenticated root access.
Root cause: argument injection (CWE-88) because telnetd forwards the client-supplied USER environment variable to login without sanitization.
Scope: GNU Inetutils telnetd versions 1.9.3โ2.7 are affected (published January 21, 2026).
Mitigations
- Patch/upgrade affected packages immediately (e.g., Debian fixes are in
2:2.4-2+deb12u2,2:2.6-3+deb13u1, and2:2.7-2). - Disable Telnet or restrict access to trusted management networks while patching.
Sniffing Credentials & Man-in-the-Middle
Telnet์ ๋ชจ๋ ๊ฒ์, credentials๋ฅผ ํฌํจํด, clear-text๋ก ์ ์กํฉ๋๋ค. ์ด๋ค์ ์บก์ฒํ๋ ๋ ๊ฐ์ง ๋น ๋ฅธ ๋ฐฉ๋ฒ:
# Live capture with tcpdump (print ASCII)
sudo tcpdump -i eth0 -A 'tcp port 23 and not src host $(hostname -I | cut -d" " -f1)'
# Wireshark display filter
tcp.port == 23 && (telnet.data || telnet.option)
๋ฅ๋์ MITM์ ๊ฒฝ์ฐ ARP spoofing(์: arpspoof/ettercap)๊ณผ ๋์ผํ sniffing filters๋ฅผ ๊ฒฐํฉํด ์ค์์น ๊ธฐ๋ฐ ๋คํธ์ํฌ์์ passwords๋ฅผ ์์งํ์ธ์.
Automated Brute-force / Password Spraying
# Hydra (stop at first valid login)
hydra -L users.txt -P rockyou.txt -t 4 -f telnet://<IP>
# Ncrack (drop to interactive session on success)
ncrack -p 23 --user admin -P common-pass.txt --connection-limit 4 <IP>
# Medusa (parallel hosts)
medusa -M telnet -h targets.txt -U users.txt -P passwords.txt -t 6 -f
Most IoT botnets (Mirai variants) still scan port 23 with small default-credential dictionariesโmirroring that logic can quickly identify weak devices.
Exploitation & Post-Exploitation
Metasploit์๋ ๋ช ๊ฐ์ง ์ ์ฉํ ๋ชจ๋์ด ์์ต๋๋ค:
auxiliary/scanner/telnet/telnet_versionโ ๋ฐฐ๋ ๋ฐ ์ต์ ์ด๊ฑฐ.auxiliary/scanner/telnet/brute_telnetโ ๋ฉํฐ์ค๋ ๋ ๋ธ๋ฃจํธํฌ์ค.auxiliary/scanner/telnet/telnet_encrypt_overflowโ ์ทจ์ฝํ Solaris 9/10 Telnet์ ๋ํ RCE (ENCRYPT ์ต์ ์ฒ๋ฆฌ ๊ด๋ จ).exploit/linux/mips/netgear_telnetenableโ ๋ง์ NETGEAR ๋ผ์ฐํฐ์์ ์กฐ์๋ ํจํท์ผ๋ก telnet ์๋น์ค๋ฅผ ํ์ฑํํฉ๋๋ค.
์์ ์ป์ ํ์๋ TTYs are usually dumb์ ๊ธฐ์ตํ์ธ์; python -c 'import pty;pty.spawn("/bin/bash")'๋ก ์
๊ทธ๋ ์ด๋ํ๊ฑฐ๋ HackTricks TTY tricks๋ฅผ ์ฌ์ฉํ์ธ์.
Hardening & Detection (Blue team corner)
- SSH๋ฅผ ์ฐ์ ์ฌ์ฉํ๊ณ Telnet ์๋น์ค๋ฅผ ์์ ํ ๋นํ์ฑํํ์ธ์.
- Telnet์ด ํ์ํ ๊ฒฝ์ฐ ๊ด๋ฆฌ VLAN์๋ง ๋ฐ์ธ๋ฉํ๊ณ , ACL์ ์ ์ฉํ๋ฉฐ ๋ฐ๋ชฌ์ TCP wrappers(
/etc/hosts.allow)๋ก ๊ฐ์ธ์ธ์. - ๋ ๊ฑฐ์
telnetd๊ตฌํ์ssl-telnet๋๋telnetd-ssl๋ก ๊ต์ฒดํ์ฌ ์ ์ก ์ํธํ๋ฅผ ์ถ๊ฐํ์ธ์. ๊ทธ๋ฌ๋ ์ด๊ฒ์ ์ ์ก ์ค ๋ฐ์ดํฐ๋ง ๋ณดํธํ ๋ฟโ๋น๋ฐ๋ฒํธ ์ถ์ธก์ ์ฌ์ ํ ์ฝ๊ฒ ์ฑ๊ณตํฉ๋๋ค. - ํฌํธ 23์ผ๋ก์ ์์๋ฐ์ด๋ ํธ๋ํฝ์ ๋ชจ๋ํฐ๋งํ์ธ์; ์นจํด๋ ์ฅ์น๋ ์๊ฒฉํ HTTP ์ด๊ทธ๋ ์ค ํํฐ๋ฅผ ์ฐํํ๊ธฐ ์ํด ์ข ์ข Telnet์ ํตํ ๋ฆฌ๋ฒ์ค ์ ธ์ ์์ฑํฉ๋๋ค.
References
- D-Link Advisory โ CVE-2024-45698 Critical Telnet RCE.
- NVD โ CVE-2022-39028 inetutils
telnetdDoS. - NVD โ CVE-2026-24061.
- Canadian Centre for Cyber Security Alert AL26-002 (CVE-2026-24061).
- Debian Security Tracker โ CVE-2026-24061 fixed versions.
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


