views:

61

answers:

2

There's an InnoDB table for storing comments for blog posts used by a custom built web application.

Recently I noticed that the auto incremented primary key values for the comments are incrementing by 2 instead of just 1.

I also noticed that in another MySQL table which is used for remembering the last few commenter's footprint signature (e.g. ip, session id, uagent string, etc) the name of the PHP session starts with "viruskinq" which is weird because I thought it should always be a hexadecimal md5-like string.

Google yields only a couple of results for "viruskinq", all in Turkish. It is interesting because approximately a year ago the website in question was defaced by Turkish villains. (I'm 100% sure that the attackers didn't succeed because of any security holes in my app, because other websites, hosted by the same company, were defaced too at that time.)

The site is on a shared host, using Linux.

Do you think it is possible that the server itself may still be under the influence of those hackers? Examining the comment's id values revealed that this doubling phenomena exists since this May, but the defacing happened almost a year ago.

What other causes could there be that explain the weird behavior of the auto increment value? The application hasn't been changed and at older comments the auto incremented primary key values are in order.

Edit: Summary of the solution

The hosting company informed me that the reason of the doubled auto increment value is because they use a Master-Slave MySQL architect and according to them this phenomena is normal.

They also admitted that various hackers are constantly attacking their servers, "especially the sessions" and they cannot do anything about it.

I think I better start packing my things and move to a better webhost.

+3  A: 

I really, really doubt this is a virus. Double-check whether that really is the session ID that starts with that string (which would indeed be reason for some concern). My guess would be this is a kid who discovered how to alter the User Agent string in the browser, and you are seeing the results of that, which is entirely harmless.

In regards to the increment problem.

  • First, check the auto_increment_increment setting of your mySQL server. Maybe it was set to 2 for some reason?

  • Second, if it's not that, I would look at all DELETE operations that the comment system runs on the table. Do comments recognized as spam get deleted? Can you log deletions for a while, or switch to soft deletions?

  • Also, try to create some subsequent comments yourself. Does the same phenonmenon occur? What if you add records using mySQL manually?

  • Look through the PHP code inserting a submitted comment making really sure there is nothing that could lead to this behaviour.

  • Try moving the comment system to a different server - preferably a local one, maybe freshly set up - to see whether the behaviour persists there.

Pekka
The weird session ID was mine, and I used a Windows7 computer. I checked it with Linux, and I got a normal session name. I switched back to Windows7, and again, I received a normal session name. I haven't been able to encounter that "viruskinq" name again. Isn't the PHP session id generated by the server alone?
Wabbitseason
Thankfully this is a low profile site where comments are not that common. I have made several test comments and the auto increment value was incremented by 2 each time.
Wabbitseason
@Wabbit are you 1000% sure this is the *session ID*? No mix-ups with the user agent string?
Pekka
Yes, I'm sure. I have a table for anti-flood purposes which stores the session ID values of the commenters. It has nothing to do with the UA, and as I've mentioned I got this weird value, it wasn't generated by some wise kid. I'm telling you: it's weird! :D
Wabbitseason
+2  A: 

Could it just be that the table's auto-increment value is set to 2?

See: MySQL autoincrement column jumps by 10- why?

aib
I got a value of X, yet my test comment received a value of X+1.
Wabbitseason