Skip to content

Commit eb86dbc

Browse files
authored
Merge pull request #1096 from HackTricks-wiki/research_update_src_network-services-pentesting_pentesting-telnet_20250711_082533
Research Update Enhanced src/network-services-pentesting/pen...
2 parents 4cafe04 + ac6b6c1 commit eb86dbc

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

src/network-services-pentesting/pentesting-telnet.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,66 @@ Entry_4:
7777
7878
```
7979

80+
### Recent Vulnerabilities (2022-2025)
81+
82+
* **CVE-2024-45698 – D-Link Wi-Fi 6 routers (DIR-X4860)**: The built-in Telnet service accepted hard-coded credentials and failed to sanitise input, allowing unauthenticated remote RCE as root via crafted commands on port 23. Fixed in firmware ≥ 1.04B05.
83+
* **CVE-2023-40478 – NETGEAR RAX30**: Stack-based buffer overflow in the Telnet CLI `passwd` command lets an adjacent attacker bypass authentication and execute arbitrary code as root.
84+
* **CVE-2022-39028 – GNU inetutils telnetd**: A two-byte sequence (`0xff 0xf7` / `0xff 0xf8`) triggers a NULL-pointer dereference that can crash `telnetd`, resulting in a persistent DoS after several crashes.
85+
86+
Keep these CVEs in mind during vulnerability triage—if the target is running an un-patched firmware or legacy inetutils Telnet daemon you may have a straight-forward path to code-execution or a disruptive DoS.
87+
88+
### Sniffing Credentials & Man-in-the-Middle
89+
90+
Telnet transmits everything, including credentials, in **clear-text**. Two quick ways to capture them:
91+
92+
```bash
93+
# Live capture with tcpdump (print ASCII)
94+
sudo tcpdump -i eth0 -A 'tcp port 23 and not src host $(hostname -I | cut -d" " -f1)'
95+
96+
# Wireshark display filter
97+
tcp.port == 23 && (telnet.data || telnet.option)
98+
```
99+
For active MITM, combine ARP spoofing (e.g. `arpspoof`/`ettercap`) with the same sniffing filters to harvest passwords on switched networks.
100+
101+
### Automated Brute-force / Password Spraying
102+
103+
```bash
104+
# Hydra (stop at first valid login)
105+
hydra -L users.txt -P rockyou.txt -t 4 -f telnet://<IP>
106+
107+
# Ncrack (drop to interactive session on success)
108+
ncrack -p 23 --user admin -P common-pass.txt --connection-limit 4 <IP>
109+
110+
# Medusa (parallel hosts)
111+
medusa -M telnet -h targets.txt -U users.txt -P passwords.txt -t 6 -f
112+
```
113+
Most IoT botnets (Mirai variants) still scan port 23 with small default-credential dictionaries—mirroring that logic can quickly identify weak devices.
114+
115+
### Exploitation & Post-Exploitation
116+
117+
Metasploit has several useful modules:
118+
119+
* `auxiliary/scanner/telnet/telnet_version` – banner & option enumeration.
120+
* `auxiliary/scanner/telnet/brute_telnet` – multithreaded bruteforce.
121+
* `auxiliary/scanner/telnet/telnet_encrypt_overflow` – RCE against vulnerable Solaris 9/10 Telnet (option ENCRYPT handling).
122+
* `exploit/linux/mips/netgear_telnetenable` – enables telnet service with a crafted packet on many NETGEAR routers.
123+
124+
After a shell is obtained remember that **TTYs are usually dumb**; upgrade with `python -c 'import pty;pty.spawn("/bin/bash")'` or use the [HackTricks TTY tricks](/generic-hacking/reverse-shells/full-ttys.md).
125+
126+
### Hardening & Detection (Blue team corner)
127+
128+
1. Prefer SSH and disable Telnet service completely.
129+
2. If Telnet is required, bind it to management VLANs only, enforce ACLs and wrap the daemon with TCP wrappers (`/etc/hosts.allow`).
130+
3. Replace legacy `telnetd` implementations with `ssl-telnet` or `telnetd-ssl` to add transport encryption, but **this only protects data-in-transit—password-guessing remains trivial**.
131+
4. Monitor for outbound traffic to port 23; compromises often spawn reverse shells over Telnet to bypass strict-HTTP egress filters.
132+
133+
## References
134+
135+
* D-Link Advisory – CVE-2024-45698 Critical Telnet RCE.
136+
* NVD – CVE-2022-39028 inetutils `telnetd` DoS.
137+
80138

81-
{{#include ../banners/hacktricks-training.md}}
82139

83140

84141

142+
{{#include /banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)