try hack me Network Services 2

TASK 1:  NO ANSWER

TASK 2:

Q:What does NFS stand for? 

A:Network File System

Q:What process allows an NFS client to interact with a remote directory as though it was a physical device?

A:Mounting

Q:What does NFS use to represent files and directories on the server?

A:file handle

Q:What protocol does NFS use to communicate between the server and client?

A:RPC

Q:What two pieces of user data does the NFS server take as parameters for controlling user permissions? Format: parameter 1 / parameter 2

A:user id / group id

Q:Can a Windows NFS server share files with a Linux client? (Y/N)

A:Y

Q:Can a Linux NFS server share files with a MacOS client? (Y/N)

A:Y

Q:What is the latest version of NFS? [released in 2016, but is still up to date as of 2020] This will require external research.

A:4.2

TASK3:

Q:Conduct a thorough port scan scan of your choosing, how many ports are open?

A:7

Q:Which port contains the service we're looking to enumerate?

A:2049

Q:Now, use /usr/sbin/showmount -e [IP] to list the NFS shares, what is the name of the visible share?

A:/home

Q:Time to mount the share to our local machine!

First, use "mkdir /tmp/mount" to create a directory on your machine to mount the share to. This is in the /tmp directory- so be aware that it will be removed on restart.

Then, use the mount command we broke down earlier to mount the NFS share to your local machine. Change directory to where you mounted the share- what is the name of the folder inside?

A:cappucino

Q:Have a look inside this directory, look at the files. Looks like  we're inside a user's home directory...

A:NULL

Q:Interesting! Let's do a bit of research now, have a look through the folders. Which of these folders could contain keys that would give us remote access to the server?

A:.ssh

Q:Which of these keys is most useful to us?

A:id_rsa

Q:Copy this file to a different location your local machine, and change the permissions to "600" using "chmod 600 [file]".

Assuming we were right about what type of directory this is, we can pretty easily work out the name of the user this key corresponds to.

Can we log into the machine using ssh -i <key-file> <username>@<ip> ? (Y/N)

A:Y

TASK 4:

Q:First, change directory to the mount point on your machine, where the NFS share should still be mounted, and then into the user's home directory.

A:NULL

Q:Download the bash executable to your Downloads directory. Then use "cp ~/Downloads/bash ." to copy the bash executable to the NFS share. The copied bash shell must be owned by a root user, you can set this using "sudo chown root bash"

A:NULL

Q:Now, we're going to add the SUID bit permission to the bash executable we just copied to the share using "sudo chmod +[permission] bash". What letter do we use to set the SUID bit set using chmod?

A:S

Q:Let's do a sanity check, let's check the permissions of the "bash" executable using "ls -la bash". What does the permission set look like? Make sure that it ends with -sr-x.

A:-rwsr-sr-x  #这里注意X执行权限,按照靶机的步骤来会少一个执行权限 需要 chmod +x bash

Q:Now, SSH into the machine as the user. List the directory to make sure the bash executable is there. Now, the moment of truth. Lets run it with "./bash -p". The -p persists the permissions, so that it can run as root with SUID- as otherwise bash will sometimes drop the permissions.

A:NULL

Q:Great! If all's gone well you should have a shell as root! What's the root flag?

A:THM{nfs_got_pwned}

TASK 5:

Q:What does SMTP stand for?

A:Simple Mail Transfer Protocol

Q:What does SMTP handle the sending of? (answer in plural)

A:emails

Q:What is the first step in the SMTP process?

A:SMTP handshake

Q:What is the default SMTP port?:

A:25

Q:Where does the SMTP server send the email if the recipient's server is not available?

A: SMTP queue

Q:On what server does the Email ultimately end up on?

A:POP/IMAP

Q:Can a Linux machine run an SMTP server? (Y/N)

A:Y

Q:Can a Windows machine run an SMTP server? (Y/N)

A:Y

TASK 6:

Q:First, lets run a port scan against the target machine, same as last time. What port is SMTP running on?

A:25

Q:Okay, now we know what port we should be targeting, let's start up Metasploit. What command do we use to do this?

If you would like some more help, or practice using, Metasploit, Darkstar has an amazing room on Metasploit that you can check out here:

TryHackMe | Metasploit: Introduction

A:msfconsole

Q:Let's search for the module "smtp_version", what's it's full module name?

A:auxiliary/scanner/smtp/smtp_version

Q:Great, now- select the module and list the options. How do we do this?

A:options

Q:Have a look through the options, does everything seem correct? What is the option we need to set?

A:RHOSTS

Q:Set that to the correct value for your target machine. Then run the exploit. What's the system mail name?

A:polosmtp.home

Q:What Mail Transfer Agent (MTA) is running the SMTP server? This will require some external research.

A:Postfix

Q:Good! We've now got a good amount of information on the target system to move onto the next stage. Let's search for the module "smtp_enum", what's it's full module name?

A:auxiliary/scanner/smtp/smtp_enum

Q:We're going to be using the "top-usernames-shortlist.txt" wordlist from the Usernames subsection of seclists (/usr/share/wordlists/SecLists/Usernames if you have it installed).

Seclists is an amazing collection of wordlists. If you're running Kali or Parrot you can install seclists with: "sudo apt install seclists" Alternatively, you can download the repository from here.

What option do we need to set to the wordlist's path?

A:USER_FILE

Q:Once we've set this option, what is the other essential paramater we need to set?

A:RHOSTS

Q:Now, run the exploit, this may take a few minutes, so grab a cup of tea, coffee, water. Keep yourself hydrated!

A:NULL

Q:Okay! Now that's finished, what username is returned?

A:administrator

TASK 7:

Q:What is the password of the user we found during our enumeration stage?

A:alejandro

Q:Great! Now, let's SSH into the server as the user, what is contents of smtp.txt

A:THM{who_knew_email_servers_were_c00l?}

TASK 8:

Q:What type of software is MySQL?

A:relational database management system

Q:What language is MySQL based on?

A:SQL

Q:What communication model does MySQL use?

A:client-server

Q:What is a common application of MySQL?

A: back end database

Q:What major social network uses MySQL as their back-end database? This will require further research.

A:Facebook

TASK 9:

Q:As always, let's start out with a port scan, so we know what port the service we're trying to attack is running on. What port is MySQL using?

A:3306

Q:Good, now- we think we have a set of credentials. Let's double check that by manually connecting to the MySQL server. We can do this using the command "mysql -h [IP] -u [username] -p"

A:NULL

Q:Okay, we know that our login credentials work. Lets quit out of this session with "exit" and launch up Metasploit.

A:NULL

Q:We're going to be using the "mysql_sql" module.

Search for, select and list the options it needs. What three options do we need to set? (in descending order).

A:PASSWORD/RHOSTS/USERNAME

Q:Run the exploit. By default it will test with the "select version()" command, what result does this give you?

A:5.7.29-0ubuntu0.18.04.1

Q:Great! We know that our exploit is landing as planned. Let's try to gain some more ambitious information. Change the "sql" option to "show databases". how many databases are returned?

A:4

TASK 10:

Q:First, let's search for and select the "mysql_schemadump" module. What's the module's full name?

A:auxiliary/scanner/mysql/mysql_schemadump

Q:Great! Now, you've done this a few times by now so I'll let you take it from here. Set the relevant options, run the exploit. What's the name of the last table that gets dumped?

A:x$waits_global_by_latency

Q:Awesome, you have now dumped the tables, and column names of the whole database. But we can do one better... search for and select the "mysql_hashdump" module. What's the module's full name?

A:auxiliary/scanner/mysql/mysql_hashdump

Q:Again, I'll let you take it from here. Set the relevant options, run the exploit. What non-default user stands out to you?

A:carl

Q:Another user! And we have their password hash. This could be very interesting. Copy the hash string in full, like: bob:*HASH to a text file on your local machine called "hash.txt".

What is the user/hash combination string?

A:carl:*EA031893AA21444B170FC2162A56978B8CEECE18

Q:Now, we need to crack the password! Let's try John the Ripper against it using: "john hash.txt" what is the password of the user we found?

A:DOGGIE

Q:Awesome. Password reuse is not only extremely dangerous, but extremely common. What are the chances that this user has reused their password for a different service?

What's the contents of MySQL.txt

A:THM{congratulations_you_got_the_mySQL_flag}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值