在练习靶场前我们需要了解以下 MySQL 数据库结构
MySQL5.0 以及 5.0 以上的版本都存在一个系统自带的系统数据库,叫做:information_schema
MySQL5.0 以下没有 information_schema
库,只能通过暴力猜解的方式来获取数据
information_schema
库里面包含了很多表
其中这几张表:schemata
、tables
、columns
这三张表依次分别存放着字段:
schemata
:(schema_name-库名)
tables
:(table_name-表名、table_schema-库名)
columns
:(table_schema-库名、table_name-表名、column_name-字段名)
flowchart TD
information_schema --> schemata
information_schema --> tables
information_schema --> columns
schemata --> schema_name
tables --> table_name-表名
tables --> table_schema-库名
columns --> table_schema-库名
columns --> table_name-表名
columns --> column_name-字段名
其次就是5.0以上都是多用户多操作,5.0以下是多用户单操作。
mysql5.7可以一句话搞定:
SQLgrant all privileges on *.* 'user'@'%' identified by '123456';
mysql5.8必须分开做:
SQL create user 'user'@'%' identified by '123456';
grant all privileges on *.* to 'user'@'%';
table
函数为 MySQL5.8 版本中新增的函数,其作用与 select
类似。
table users;
等同于 select * from users;
但是 table
查询时,显示的始终是表的所有列,而且不可以用 where
字句来限定某个特定的行。
select * from user union VALUES ROW(2,3);
等同于 select * from user union select 2,3;
-
和 -+
疑问:-- 在 SQL 语句中起到注释的作用,按理说 --
和 --+
作用是一样才对
看法:PHP 在接收接收参数时,会对参数进行一次 urldecode
如我们在浏览器地址栏输入网址时,会调用类似 strip
的函数去除首尾的空格
所以,如果后面如果原本接着字符,以这个举例子是 --'
那么这就是三个字符,后面没有字符 就不是 -- '
这样,MySQL 是不会把它解析为注释符号的。 但 URL 里 不能 --
因为会被浏览器之类的替换为空,所以把空格编码一下就是 +
啦!
当然这是 get
请求的情况,如果是 post
请求(且 Content-Type
不为 x-www-form-urlencoded
或与这个 Content-Type
类似效果),加 +
就有问题了, +
还是 +
,而不是空格的 URL 编码,此时应把 +
替换为 %20
,urldecode
后就是空格啦。经测试,一般出现在 HTTP头里的 +
会被 urldecode
为空格
本文作者:@Rrx
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!