HTB walkthrough – Passage

信息收集

Ports

  • 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)
  • 22/tcp open ssh OpenSSH 7.2p2 Ubuntu 4 (Ubuntu Linux; protocol 2.0)

Domains

  • passage.htb

dir
F12查看页面的源代码,看到很多路径(dirb一扫描就挂……只能纯看了)
以及在footer的位置,找到了这是一个CuteNews的cms

URL Vuls Notes
/index.php?id=1
/index.php?do=archives
/index.php?do=rss
/CuteNews/rss.php
index.php(leave a comment ) csrf
/CuteNews/ admin login Version 2.1.2

信息收集到这里就找到了关于CuteNews 这个cms版本的漏洞了
利用方式可参考这篇文章:https://musyokaian.medium.com/cutenews-2-1-2-remote-code-execution-vulnerability-450f29673194

getshell

首先注册一个用户
HTB walkthrough -- Passage

参考文章,执行exp:https://github.com/musyoka101/CuteNews_2.1.2_RCE_exploit
HTB walkthrough -- Passage

exp中的shell不能访问其他目录,以及命令执行有限制
写一个php反弹shell,上传到目标机中
kali开启监听,然后访问这个shell.php
HTB walkthrough -- Passage

其实也可以直接上传php反弹shell
在shell代码中加上GIF89;,改变文件的类型
HTB walkthrough -- Passage
可以看到现在PHP文件已经变成一个gif文件
HTB walkthrough -- Passage
然后在avatar处,上传文件,用bp抓包查看
HTB walkthrough -- Passage
发现不用修改php文件的后缀也可以成功上传,说明程序只是识别了文件头
HTB walkthrough -- Passage
在kali监听端口,浏览器访问shell的路径
HTB walkthrough -- Passage
反弹成功
HTB walkthrough -- Passage

www-data --> paul

在/var/www/html目录下寻找可用的信息,发现cdata中有个users文件夹,其中全是用户登录的信息,不过都base64编码过
直接在lines中寻找paul的信息
HTB walkthrough -- Passage
HTB walkthrough -- Passage

用在线工具解码得到密码
HTB walkthrough -- Passage
得到第一个user
HTB walkthrough -- Passage

paul --> nadav

paul和nadav用户用的是同一个ssh登录公私钥对
HTB walkthrough -- Passage
所以可以直接用paul的私钥来登录nadav
将id_rsa中的内容拷贝到kali中,然后尝试ssh**登录
HTB walkthrough -- Passage

nadav --> root

这一步我是在网上找到walkthrough才知道的,原来是dbus的一个提权漏洞,可以利用系统总线无条件复制文件到最高权限的用户的目录中

这样的话,就可以利用无条件复制文件这个特点,将一个ssh的**拷贝到ssh目录中,就可以达到**对登录的效果
实现步骤如下面的图片中所示。
HTB walkthrough -- Passage
HTB walkthrough -- Passage

gdbus call --system --dest com.ubuntu.USBCreator --object-path /com/ubuntu/USBCreator --method com.ubuntu.USBCreator.Image /home/nadav/authorized_keys /root/.ssh/authorized_keys true

HTB walkthrough -- Passage

总结

  1. CuteNews 2.1.2 avatar任意文件上传漏洞
  2. ssh**对登录
  3. Ubuntu桌面版USBCreator D-Bus权限提升漏洞分析

参考链接

  1. https://musyokaian.medium.com/cutenews-2-1-2-remote-code-execution-vulnerability-450f29673194
  2. https://github.com/musyoka101/CuteNews_2.1.2_RCE_exploit
  3. https://github.com/pentestmonkey/php-reverse-shell/blob/master/php-reverse-shell.php
  4. https://www.anquanke.com/post/id/181937#h2-2
  5. https://www.youtube.com/watch?v=x5y_YRIZMSk

相关文章:

  • 2021-09-14
  • 2021-11-02
  • 2021-05-30
  • 2021-12-11
  • 2022-01-21
  • 2022-12-23
  • 2021-11-16
  • 2021-12-04
猜你喜欢
  • 2021-11-04
  • 2021-12-13
  • 2021-12-04
  • 2021-10-17
  • 2021-05-25
  • 2022-02-20
  • 2021-10-18
相关资源
相似解决方案