获得这个box的user很容易,root.txt也其实不难,但是如何获得root shell还有待研究。总之,先记录下过程。

  • 用Nmap + Nikto对目标机进行扫描。Hack The Box - Curling WriteupHack The Box - Curling Writeup
  • 系统用的是Joomla! 3.8.8,且发现了admin登陆页面/administrator/index.php。不需要exploit这个界面,因为80端口上的网页源代码中提示了有secret.txt。Hack The Box - Curling Writeup
  • Base64解码后得到Curling2018!,看起来是个密码,但不知道username是什么。
  • 浏览一下网页,发现这段话written by super user,并且后面署名Floris,看起来Floris就是我要的username。Hack The Box - Curling Writeup
  • 在admin页面用Floris + Curling2018!成功登录,可以浏览并修改Joomla!的配置。在Extensions - Templates - Templates下,选择一个template,我选择了Beez3。然后可以修改比如index.php的内容,把它改成reverse shell的php。这样访问/beez3/index.php可以得到一个shell。Hack The Box - Curling Writeup
  • 这个shell的user是www-data,权限很少,无法访问user.txt。不过可以下载另一个叫password_backup的文件。Hack The Box - Curling Writeup
  • 它是一个hex dump,用xxd -r 逆向成binary,结果是一个bzip文件。再用bzip2进行解压,得到password。
  • 得到的password属于用户floris,用ssh登录远程主机。
  • /home/floris下还有一个admin-area的目录,里面有两个文件input和report。floris对这两个文件都有读写权限。于是可以联想到这是获取root的突破口。事实上我做了很多enumeration,都没什么发现,才转回来研究这两个文件。
  • input是一个文本,内容为url = "http://127.0.0.1"。report内容和网站的首页是一样的。尝试修改input,比如改成url = "http://127.0.0.1/secret.txt",访问目标机80端口后,发现report变成了secret.txt的内容。此时有理由怀疑report会返回input中所指的url的内容。
  • 于是修改input为url = "file:///root/root.txt",访问目标机80端口,在report中看到了root.txt的内容。

相关文章: