当前位置:网站首页>hackmyvm-hopper walkthrough
hackmyvm-hopper walkthrough
2022-08-02 03:25:00 【xdeclearn】
hackmyvm: hopper
信息收集到获取第一个shell
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
全端口扫描,先访问一下web服务。
利用gobuster扫描目录找到目录advanced-search,这里存在ssrf。

虚拟机有三个用户可以bash登录,root,edward,henry。
经过简单测试,不能进行远程文件包含,估计是调用的curl_exec,关于php的ssrf利用一般情况下可以参看SSRF in PHP[1]进行利用。但是这里有点特别,没有redis,没有mysql,于是对主机端口进行了探测。
#!/usr/bin/python3
import requests
for port in range(1,65535):
res = requests.get('http://192.168.143.191/advanced-search/path.php?path=http://127.0.0.1:%d' % port)
if len(res.text) == 0:
continue
else:
print('-----------------------')
print('port %d\n' % port)
print(res.text)
print('-----------------------')
扫描得到新的端口为2222。
紧接着是目录发现,爆破目录,发现存在目录backup。
发现是一个passpharse的sshkey,于是使用john进行解密,参看JTR(John The Ripper)的ssh密钥破解记录[2],得到passpharse为barcelona。
利用id_rsa登录ssh成功登录用户edward获取用户flag。
切换用户
往/var/www/html目录中写入一个反弹shell的php木马,成功获取用户www-data。
查看该用户具有sudo权限。
参考GTFOBins[3],切换至用户henry(需要注意的运行程序前需要先设置环境变量export TERM=xterm)。
提权至root
查看用户henry的sudo权限。
这个就比较简单了,改/etc/passwd。
将passwd复制到tmp目录中,将root用户中的x替换为已知加密密码。
然后使用命令[email protected]:/tmp$ sudo /usr/bin/ascii-xfr -rv /etc/passwd < passwd将修改后的passwd写入/etc/passwd。使用su,成功切换至root获取flag。
参考
[1] https://blog.csdn.net/bylfsj/article/details/105083164
[2] https://blog.csdn.net/qq_40490088/article/details/97812715
[3] https://gtfobins.github.io/
边栏推荐
猜你喜欢
随机推荐
New usage of string variable parsing in PHP8.2
js预编译 GO 和AO
[trendsoft/capital]金额转中文大写库
面试总结 22/7/25 面试中的重点
3. PHP data types, constants, strings and operators
关于tp的apache 的.htaccess文件
Function hoisting and variable hoisting
如何计算地球上两点的距离(附公式推导)
每日五道面试题总结 22/7/23
About the apache .htaccess file of tp
js scope and closure
--fs module--
12.什么是JS
Xiaoyao multi-open emulator ADB driver connection
IO streams, byte stream and byte stream buffer
微信小程序开发视频加载:[渲染层网络层错误] Failed to load media
uniapp | 官方提供的map组件使用问题
TCP communications program
[symfony/mailer] An elegant and easy-to-use mail library
(3) Thinkphp6 database









