Database Errors? SQL Injection?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bi11i
    Senior Member
    • Sep 2004
    • 135
    • 3.0.7

    Database Errors? SQL Injection?

    Since I moved to bluehost, I've been having various mySQL errors that appear to be strictly from server disconnects. Bluehost denies this and says it's malicious code. Either way, I don't have enough knowledge to bring to the table in order to resolve. Can someone tell me what these errors could be caused from?

    Thanks...

    Code:
    [SIZE=2]
    Database error in vBulletin 3.5.4:
    Invalid SQL:
    INSERT IGNORE INTO opio_session
    (sessionhash, userid, host, idhash, lastactivity, location, styleid, languageid, loggedin, inforum, inthread, incalendar, badlocation, useragent, bypass)
    VALUES
    ('bb4c94418d3944db30d0ea92c1b8b2a2', 1500, '75.4.32.97', '873091acb8f90848df3e32ea1ee9c1d1', 1145296447, '/', 0, 0, 0, 0, 0, 0, 0, 'Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.8 (KHTML, like Gecko) Safari/312.6', 0);
    MySQL Error : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) Error Number : 2002
    Date : Monday, April 17th 2006 @ 11:54:27 AM
    Script : [/SIZE][URL="http://forum.opiophile.org/"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
    [SIZE=2]Referrer : [/SIZE][URL="http://opiophile.org/"][U][SIZE=2][COLOR=#0000ff]http://opiophile.org/[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
    [SIZE=2]Classname : vB_Database
    [/SIZE]
    Code:
    [SIZE=2]
    Database error in vBulletin 3.5.4:
    Invalid SQL:
    SELECT
    post.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,
    user.*, userfield.*, usertextfield.*,
    icon.title as icontitle, icon.iconpath,
    avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,
    level,
    
    editlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,
    editlog.reason AS edit_reason,
    post_parsed.pagetext_html, post_parsed.hasimages,
    IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
    , '' AS field7, '' AS field14, '' AS field17
    
    FROM opio_post AS post
    LEFT JOIN opio_user AS user ON(user.userid = post.userid)
    LEFT JOIN opio_userfield AS userfield ON(userfield.userid = user.userid)
    LEFT JOIN opio_usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
    LEFT JOIN opio_icon AS icon ON(icon.iconid = post.iconid)
    LEFT JOIN opio_avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN opio_customavatar AS customavatar ON(customavatar.userid = user.userid) LEFT JOIN opio_reputationlevel AS reputationlevel ON(user.reputationlevelid = reputationlevel.reputationlevelid)
    
    LEFT JOIN opio_editlog AS editlog ON(editlog.postid = post.postid)
    LEFT JOIN opio_post_parsed AS post_parsed ON(post_parsed.postid = post.postid AND post_parsed.styleid_code = -1 AND post_parsed.styleid_html = -1 AND post_parsed.styleid_php = -1 AND post_parsed.styleid_quote = -1)
    
    WHERE post.postid IN (0,14712,14714,14720,14733,14741,14743,14754,14855,14862,15757,16882,16899,17034,17061,17084,17092,17102,17123,17146,17173)
    ORDER BY post.dateline;
    MySQL Error : Lost connection to MySQL server during query Error Number : 2013
    Date : Friday, April 14th 2006 @ 06:09:15 AM
    Script : [/SIZE][URL="http://forum.opiophile.org/showthread.php?t=1674"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/showthread.php?t=1674[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
    [SIZE=2]Referrer : [/SIZE][URL="http://forum.opiophile.org/forumdisplay.php?f=36"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/forumdisplay.php?f=36[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
    [SIZE=2]Username : Unregistered
    Classname : vB_Database
    [/SIZE]
  • Scott MacVicar
    Former vBulletin Developer
    • Dec 2000
    • 13286

    #2
    I think you have a misinformed host, my condolences.

    The first error means the server has crashed, been killed, died.

    The second indicates the server died or closed the connection before all results could be returned.
    Scott MacVicar

    My Blog | Twitter

    Comment

    • bi11i
      Senior Member
      • Sep 2004
      • 135
      • 3.0.7

      #3
      Thank you. I spent about an hour trying to explain this. They don't wanna hear it - gave me this in response:
      Hello,
      We have checked and the errors are not caused by the MySQL going down. It looks like it as caused by a quarry getting stuck in memory and the MySQL service drooping the quarry. The IP address 66.189.153.111 caused the error 21 times and 84.10.163.100 caused the error 12 You may want to ban the IP addresses causing the problem. I would also look on the vBulletin web site and check for new exploits and check to see if other are others having the same problem.




      Shawn M.
      BlueHost.com
      888-401-4678
      [email protected]

      Comment

      • Scott MacVicar
        Former vBulletin Developer
        • Dec 2000
        • 13286

        #4
        So a query getting stuck in memory is an exploit?

        Any chance we can get the query?

        The cannot connect to server is a MySQL issue. From the MySQL documentation.

        shell> mysql
        ERROR 2002: Can't connect to local MySQL server through socket
        '/tmp/mysql.sock' (111)

        It might also be that the server is running, but you are trying to connect using a TCP/IP port, named pipe, or Unix socket file different from the one on which the server is listening. To correct this when you invoke a client program, specify a --port option to indicate the proper port number, or a --socket option to indicate the proper named pipe or Unix socket file. To find out where the socket file is, you can use this command:
        The Lost Connection error could be due to table locking, can you ask them to log your Slow queries for you. They should be happy to do this since its fairly simple.
        Scott MacVicar

        My Blog | Twitter

        Comment

        • bi11i
          Senior Member
          • Sep 2004
          • 135
          • 3.0.7

          #5
          Will do - have forwarded on this thread and will be in touch with them via phone later today.

          Always appreciated, Scott. Thanks...

          Comment

          • bi11i
            Senior Member
            • Sep 2004
            • 135
            • 3.0.7

            #6
            Here's their reply to my disagreement, followed by the info they were able to provide as it pertains to vBulletin. The problem I have with this is that since moving to bluehost, I've been having dBase errors almost nightly for quite some time - all disconnects. For this guy to tell me that the problem is NOT with disconnects at all - uh, idiot?
            I am sorry you disagree, but it really is pointless to argue about this. I am sorry that I can not tell you exactly what caused the corruption, but what I can tell you is I do not show any crashes until you corruption appeared, once the corruption appear MySQL crashed and could not be restarted before clearing the corruption. I can tell you that MySQL crashing did not cause your corruption as MySQL did not crash anytime previous to the corruption.


            When a certain customers issue is causing hundreds of other customers to lose service we will do whatever necessary to restore services to those customers as soon as possible. If you prefer, if we see any further problems with your database being corrupt we will send you the latest MySQL dump, and simple drop your DB or any problem tables, then you would be free to restore from the dump yourself whenever convenient for you, however hopefully we will have your issues resolved before then and you will not see any further corruption issues.




            I am happy to try to assist you with your issue, however lets be clear here, I can tell you for a fact that MySQL is not going down and is up and running correctly. These connection issues you appear to be having have noting to do with the availability of MySQL on your server.


            Please be aware that we do limit all clients to 20 concurrent connections to MySQL, it is possible you are receiving these errors because you already have 20 connections to MySQL. This is not typically a issue with most sites that we host as most programs will open a MySQL connection, do whatever is needed, then close the connection, however you could definitely see issues with this if you are using persistent MySQL connections. Or once traffic to your sites requires more then 20 concurrent connections.
            Code:
            InnoDB: Page number (if stored to page already) 89828,
            InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0
            InnoDB: Page may be an index page where index id is 0 11979
            InnoDB: (index readtime of table junkieli_Opiophile/opio_threadread)
            InnoDB: Database page corruption on disk or a failed
            InnoDB: file read of page 89828.
            InnoDB: You may have to recover from a backup.
             
             
             
             
            Here are some of your slow queries:
             
             
            # Time: 060419 8:15:59 
            # User@Host: junkieli_bi33i[junkieli_bi33i] @ localhost []
            # Query_time: 2 Lock_time: 0 Rows_sent: 1368 Rows_examined: 2736
            use junkieli_Opiophile;
            SELECT 
            thread.threadid
            FROM opio_thread AS thread
            INNER JOIN opio_post AS post ON(thread.threadid = post.threadid )
            WHERE MATCH(post.title, post.pagetext) AGAINST ('+morphine +ar' IN BOOLEAN MODE);
             
             
            # Time: 060419 9:49:16
            # User@Host: junkieli_bi33i[junkieli_bi33i] @ localhost []
            # Query_time: 2 Lock_time: 0 Rows_sent: 20 Rows_examined: 58
            use junkieli_Opiophile;
            SELECT
            IF(votenum >= 1, votenum, 0) AS votenum,
            IF(votenum >= 1 AND votenum > 0, votetotal / votenum, 0) AS voteavg,
            post.pagetext AS preview,
            thread.threadid, thread.title AS threadtitle, thread.forumid, pollid, open, replycount, postusername, postus
            erid, thread.iconid AS threadiconid,
            thread.lastpost, lastposter, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, notes, th
            read.visible, sticky, votetotal, thread.attach,
            hiddencount
             
             
             
             
             
             
            FROM opio_thread AS thread
             
             
             
             
             
             
            LEFT JOIN opio_post AS post ON(post.postid = thread.firstpostid)
             
             
             
             
            WHERE thread.threadid IN (0,1953,1887,1815,1832,1956,1933,1929,1873,695,1890,1797,1140,1515,1884,1843,1688,1847,1901
            ,1846,1902)
            ORDER BY sticky DESC, thread.lastpost DESC;
            Interesting that since moving to Bluehost, I get emails throughout the evening with errors like this:
            Code:
            [SIZE=2]
            Database error in vBulletin 3.5.4:
            Invalid SQL:
            SELECT *
            FROM opio_session
            WHERE sessionhash = 'e14bf3c7e3f3815394ad6612ac4d4137'
            AND lastactivity > 1143623542
            AND host = '69.139.105.251'
            AND idhash = '312c81508ee0a2bf770ad153f204d341';
            MySQL Error : Server shutdown in progress Error Number : 1053
            Date : Wednesday, March 29th 2006 @ 02:42:31 AM
            Script : [/SIZE][URL="http://forum.opiophile.org/search.php?searchid=42350"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/search.php?searchid=42350[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
            [SIZE=2]Referrer : [/SIZE][URL="http://forum.opiophile.org/search.php?searchid=42346"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/search.php?searchid=42346[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
            [SIZE=2]Classname : vB_Database
            [/SIZE]
            Code:
            [SIZE=2]
            Database error in vBulletin :
            mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) /home/junkieli/public_html/forum/includes/class_core.php on line 279
            MySQL Error : 
            Error Number : 
            Date : Wednesday, March 29th 2006 @ 02:43:03 AM
            Script : [/SIZE][URL="http://forum.opiophile.org/newreply.php"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/newreply.php[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
            [SIZE=2]Referrer : [/SIZE][URL="http://forum.opiophile.org/newreply.php?do=newreply&noquote=1&p=15979"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/newreply.php?do=newreply&noquote=1&p=15979[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
            [SIZE=2]Classname : vB_Database
            [/SIZE]
            Always early in the morning... Never during the day.

            Comment

            • Scott MacVicar
              Former vBulletin Developer
              • Dec 2000
              • 13286

              #7
              So they're saying error messages like
              "Server shutdown in progress Error Number : 1053" is not the server going down but something else?
              Scott MacVicar

              My Blog | Twitter

              Comment

              • Paul M
                Former Lead Developer
                vB.Com & vB.Org
                • Sep 2004
                • 9886

                #8
                They class this as slow ??

                # Query_time: 2 Lock_time: 0
                If I were you I'd start looking for a host that actually has a clue what they are talking about, because from your posts so far, it seems your current one probably doesn't even know what SQL stands for, let alone how it works.
                Baby, I was born this way

                Comment

                • bi11i
                  Senior Member
                  • Sep 2004
                  • 135
                  • 3.0.7

                  #9
                  More problems here and I'm not sure what to do. I'm unable to make a backup and have attached a screenshot of what I'm seeing when doing so.

                  I see to be losing connection and getting this type of error:
                  Code:
                  Database error in vBulletin 3.5.4:
                  Invalid SQL:
                  SHOW CREATE TABLE opio_threadviews;
                  MySQL Error  : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
                  Error Number : 2002
                  Date         : Friday, April 28th 2006 @ 09:36:44 AM
                  Script       : [URL="http://forum.opiophile.org/admincp/backup.php"]http://forum.opiophile.org/admincp/backup.php[/URL]
                  Referrer     : [URL="http://forum.opiophile.org/admincp/backup.php?do=choose"]http://forum.opiophile.org/admincp/backup.php?do=choose[/URL]
                  IP Address   : 209.151.52.207
                  Username     : bi11i
                  Classname    : vB_Database
                  Or I've received a ton of these. Thankfully, I've been able to turn the board off, but where to go from here?
                  Code:
                  [SIZE=2]
                  Database error in vBulletin 3.5.4:
                  Invalid SQL:
                  SELECT COUNT(*) AS users FROM opio_user WHERE usergroupid = 4;
                  MySQL Error : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) Error Number : 2002
                  Date : Friday, April 28th 2006 @ 09:29:46 AM
                  Script : [/SIZE][URL="http://forum.opiophile.org/admincp/index.php?do=home"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/admincp/index.php?do=home[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
                  [SIZE=2]Referrer : [/SIZE][URL="http://forum.opiophile.org/admincp/index.php"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/admincp/index.php[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
                  [SIZE=2]IP Address : 209.151.52.207
                  Username : bi11i
                  Classname : vB_Database
                  [/SIZE]
                  Code:
                  [SIZE=2]
                  Database error in vBulletin 3.5.4:
                  Invalid SQL:
                  SELECT
                  
                  thread.threadid, thread.title, thread.replycount, postusername, postuserid, thread.dateline AS postdateline, IF(views <= thread.replycount, thread.replycount+1, views) AS views, thread.lastposter, thread.lastpost, pollid, thread.forumid
                  , thread.iconid AS threadiconid, iconpath AS threadiconpath, post.pagetext AS preview,threadread.readtime AS threadread
                  FROM opio_thread as thread
                  LEFT JOIN opio_icon AS icon ON (icon.iconid = thread.iconid) LEFT JOIN opio_post AS post ON (post.postid = thread.firstpostid)LEFT JOIN opio_threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = 1762)
                  WHERE open != 10 AND thread.visible = 1
                  AND thread.lastpost > 1145374239
                  
                  
                  AND thread.forumid NOT IN(26,101,102)
                  ORDER BY lastpost DESC
                  LIMIT 8;
                  MySQL Error : Lost connection to MySQL server during query Error Number : 2013
                  Date : Friday, April 28th 2006 @ 09:30:39 AM
                  Script : [/SIZE][URL="http://forum.opiophile.org/"][U][SIZE=2][COLOR=#0000ff]http://forum.opiophile.org/[/COLOR][/SIZE][/U][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/URL]
                  [SIZE=2]Referrer : 
                  Classname : vB_Database
                  [/SIZE]
                  Any ideas of what I can do? Logging into the admincp shows this on the control panel...
                  Code:
                  Database error in vBulletin 3.5.4:
                  Invalid SQL:
                  SELECT COUNT(*) AS users FROM opio_user WHERE usergroupid = 4;
                  MySQL Error  : Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
                  Error Number : 2002
                  Date         : Friday, April 28th 2006 @ 09:50:30 AM
                  Script       : [URL="http://forum.opiophile.org/admincp/index.php?do=home"]http://forum.opiophile.org/admincp/index.php?do=home[/URL]
                  Referrer     : [URL="http://forum.opiophile.org/admincp/index.php"]http://forum.opiophile.org/admincp/index.php[/URL]
                  IP Address   : 209.151.52.207
                  Username     : bi11i
                  Classname    : vB_Database
                  Attached Files

                  Comment

                  • bi11i
                    Senior Member
                    • Sep 2004
                    • 135
                    • 3.0.7

                    #10
                    It now appears that I'm able to backup everything except for the threadviews table. Anytime there's even an attempt at accessing this table, I lose connection and am asked to login again.... ???

                    Comment

                    • Steve Machol
                      Former Customer Support Manager
                      • Jul 2000
                      • 154488

                      #11
                      You probably have a bad table. You can run these queries to recreate that table:

                      1:
                      DROP TABLE IF EXISTS threadviews;

                      2:
                      CREATE TABLE threadviews (
                      threadid INT UNSIGNED NOT NULL DEFAULT '0',
                      KEY threadid (threadid)
                      );
                      Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                      Change CKEditor Colors to Match Style (for 4.1.4 and above)

                      Steve Machol Photography


                      Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                      Comment

                      • bi11i
                        Senior Member
                        • Sep 2004
                        • 135
                        • 3.0.7

                        #12
                        Hey, thanks! That did work just dandy. Do I need to do anything else beyond this?

                        Always appreciated...

                        Comment

                        • Steve Machol
                          Former Customer Support Manager
                          • Jul 2000
                          • 154488

                          #13
                          If you're not getting any errors than you should be set.
                          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                          Change CKEditor Colors to Match Style (for 4.1.4 and above)

                          Steve Machol Photography


                          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                          Comment

                          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                          Working...