# 23 - Pentesting Telnet {{#include ../banners/hacktricks-training.md}} ## **Informazioni di base** Telnet è un protocollo di rete che offre agli utenti un modo NON sicuro per accedere a un computer tramite una rete. **Porta predefinita:** 23 ``` 23/tcp open telnet ``` ## **Enumerazione** ### **Acquisizione del Banner** ```bash nc -vn 23 ``` Tutta l'enumerazione interessante può essere eseguita da **nmap**: ```bash nmap -n -sV -Pn --script "*telnet* and safe" -p 23 ``` Lo script `telnet-ntlm-info.nse` otterrà informazioni NTLM (versioni di Windows). Dalla [telnet RFC](https://datatracker.ietf.org/doc/html/rfc854): Nel Protocollo TELNET ci sono varie "**opzioni**" che saranno sanzionate e possono essere utilizzate con la struttura "**DO, DON'T, WILL, WON'T**" per consentire a un utente e a un server di concordare l'uso di un insieme più elaborato (o forse semplicemente diverso) di convenzioni per la loro connessione TELNET. Tali opzioni potrebbero includere la modifica del set di caratteri, la modalità di eco, ecc. **So che è possibile enumerare queste opzioni, ma non so come, quindi fammi sapere se sai come.** ### [Brute force](../generic-hacking/brute-force.md#telnet) ## Config file ```bash /etc/inetd.conf /etc/xinetd.d/telnet /etc/xinetd.d/stelnet ``` ## HackTricks Comandi Automatici ``` 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' ``` {{#include ../banners/hacktricks-training.md}}