渗透测试---SQL注入~mysql数据库注入基础

SQL Server的内置数据库master与MySQL的内置数据库information_schema相似。

通过Navicat远程连接MySQL数据库后,我们可以看到:

MySQL内置数据库information_schema中:

schemata表存储了所有库名。

tables表存储了所有表名对应库名。

columns表存储了所有字段名对应表名对应库名。

所以

查库:

select schema_name from information_schema.schemata;

查表:

select table_name from information_schema.tables where table_schema='security';

查字段:

select column_name from information_schema.columns where table_schema='security' and table_name='users';

查内容:

知道库名,表名和字段名之后,我们就可以直接查内容了。

select username,password from security.users;

查询服务器主机信息:

主机名称@@hostname

数据库路径@@datadir

操作系统版本@@version_compile_os

select @@hostname,@@datadir,version_compile_os;

查看当前数据库:

select database();

 

查看数据库版本:

select version();

select @@version;

select @@global.version;

 查询数据库用户信息:

系统用户和登录主机名user()

当前登录用户和登录主机名current_user()

select user(),current_user();

 

 

order by按第几列进行排序:

union select联合查询:

查询列数需要和前面匹配。

Access数据库需要在union select 后加from表,MySQL数据库不用加。

输入一个不存在的id或者and 1=2可使其回显。

concat和concat_ws:

当注入点很少时,可以将查询加过合并到一处进行显示。

没有分隔符串联多列结果concat

含有分隔符串联多列结果concat_ws

0x3a          :

0x7e          ~

concat和group_concat:

没有分隔符串联多列结果concat

用逗号串联多行结果为一行,每行结果用逗号串联group_concat

posted @ 2020-04-23 11:08  强霸卓奇霸  阅读(313)  评论(0)    收藏  举报
https://blog-static.cnblogs.com/files/xiaokang01/js.js 这是添加的文件的链接 color="240,230,140" 粒子的颜色设置 opacity="1" 粒子的透明度 count="75" 粒子的个数