The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant / FPA - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Several 2.5 sites hacked
PostPosted: Sun May 06, 2012 9:53 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun May 06, 2012 9:28 pm
Posts: 7
Two of the sites I run have just been disabled by my web host with their reasons being that the sites were compromised.

I have no access to either account right now, and I haven't worked on either site in a little while, so specific details are going to have to be a bit sketchy. Obviously due to the lack of access I can't run the forum help tool.

Both sites were running Joomla 2.5. I believe this was the latest version (2.5.4) as I updated all my Joomla run sites a few weeks ago to the latest version.

I've checked the list of vulnerable extensions and don't have anything installed on the latest list (January 2012 onwards).

I've attached the relevant segments from messages from my web host below, with my domain name omitted. They say they can clean the site and restore it, however before I give them the okay I'd really appreciate some advice on how this could have happened so I can stop it just happening again.

Code:
Your account has been compromised. I suspect this was via the Joomla
upload feature. The attacker replaced your homepage with a
"Hacked" page and uploaded malicious content to your account.

Your account was suspended automatically to protect our servers and to
prevent malicious content being spread or uploaded.


Code:
I have suspended your account, so you cannot login to it. If you would
like me to purge the site so that you can upload it again, please
confirm this.

The attack seems to have been started by uploading a PHP shell script
via FTP from the localhost using a username and password that are stored
in the Joomla configuration.php script. Here is the extract from the FTP
log:

Sun Apr 29 03:03:06 2012 0 81.94.198.98 87627
/home/[domain]/public_html/tmp/sa.php b _ i r site@[domain] ftp 1 * c

I'm not familiar with Joomla, so I'm not sure what this is for or why it
is needed, but there may be a vulnerability in this area.


I'm not sure if this will show up, but this is what the page was replaced with:


I appreciate I'm not giving you much to go on here... but I'd really appreciate some help.

Thanks,

Tom


Last edited by mandville on Sun May 06, 2012 10:53 pm, edited 1 time in total.
removed hacker kudos, removed images,


Top
 Profile  
 
PostPosted: Sun May 06, 2012 10:55 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Mon Mar 20, 2006 1:56 am
Posts: 11644
Location: The Girly Side of Joomla in Sussex
[ ] Run the Forum Post Assistant / FPA Instructions available here and are also included in the download package.

[ ] Ensure you have the latest version of Joomla. Delete all files in your Joomla installation. Replace the deleted files with fresh copies of a current full version of Joomla, and fresh copies of extensions and templates used. Only by replacing all files in the installation (including extensions and templates) can you be sure to remove the backdoors inserted and hidden in files and directories

[ ] Review Vulnerable Extensions List

[ ] Review and action Security Checklist checklist 7 to make sure you've gone through all of the steps.

[ ] Scan all machines with FTP, Joomla super admin, and Joomla admin access for malware, virus, trojans, spyware, etc.

[ ] Change all passwords and if possible user names for the website host control panel and your Joomla site.

[ ] Use proper permissions on files and directories. They should never be 777, but ideal is 644 and 755

[ ] Check your htaccess for for any odd code (i.e. code which is not in the standard htaccess supplied as part of the Joomla installation).

[ ] Check the crontab or Task Scheduler for unexpected jobs/tasks.

[ ] Ensure you do not have anonymous ftp enabled

_________________
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be added to the foe list and possibly just deleted
{Community.Connect Administrator }{ Showcase & Security Moderator}


Top
 Profile  
 
PostPosted: Sun May 06, 2012 11:31 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun May 06, 2012 9:28 pm
Posts: 7
Quote:
[ ] Run the Forum Post Assistant / FPA Instructions available here and are also included in the download package.

[ ] Ensure you have the latest version of Joomla. Delete all files in your Joomla installation. Replace the deleted files with fresh copies of a current full version of Joomla, and fresh copies of extensions and templates used. Only by replacing all files in the installation (including extensions and templates) can you be sure to remove the backdoors inserted and hidden in files and directories


I currently do not have any access to the server. Account (FTP/cPanel/etc) disabled by web host until I give them the ok to either wipe the site, or clean it. Due to this I'm unable to do the above.


Quote:

I've looked through the list and don't have any of the extensions installed that are listed under the heading 'January 2012 and onwards Reported Vulnerable Extensions'. As for the other extensions below that, I've listed some possibilities below. As I haven't worked on the sites in a long while, apart from updating them recently, and not currently having access to the sites, it's hard to say for certain.

FCKeditor - This may be installed. I'm fairly certain it's not, but I have installed a 3rd party editor whose name I can't recall, so I wouldn't want to rule this out as a possibility.

Akeeba - All my sites are running the latest version of Akeeba Backup Free. I've checked the vulnerability, and I believe it's both resolved and not a major threat in itself anyway.

flexicontent - This was installed on one of the sites a while ago. It wasn't used on the live site (I was trying out a few different content creation components) but was left installed from testing phases in error. However, it was uninstalled shortly after the site launched several months ago, so not likely an issue.

xmap 1.2.10 - Both affected sites were running a version of xmap. It may not have been the latest version, it was several months ago when the extension was installed, however I don't believe I updated the component. Could be a possibility...

They're the only extensions I recognise from that list.


[
Quote:
] Review and action Security Checklist checklist 7 to make sure you've gone through all of the steps.

As per first point, most of the steps in this check list require access to the account, which I don't have.

Quote:
[ ] Scan all machines with FTP, Joomla super admin, and Joomla admin access for malware, virus, trojans, spyware, etc.

Working on a Mac with anti virus. Not bomb proof by any means but unlikely infected...

Quote:
[ ] Change all passwords and if possible user names for the website host control panel and your Joomla site.

See first point...

Quote:
[ ] Use proper permissions on files and directories. They should never be 777, but ideal is 644 and 755

I'm unable to say for certainty due to lack of access. However, looking at other (un-compromised) Joomla sites I run and were set up the same way, the permissions were set correctly. Files 644 and directories 755.

Quote:
[ ] Check your htaccess for for any odd code (i.e. code which is not in the standard htaccess supplied as part of the Joomla installation).

I can't access the .htaccess of the live sites, due to above reasons. However, my local version adds the following code to redirect all http://* requests to http://www.*.
Code:
# Rerdirect http://site to http://www
RewriteCond %{HTTP_HOST} ^domain.net
RewriteRule (.*) http://www.domain.net/$1 [R=301,L]


There's also a section required for components using suhosin, and a further section which I'm not entirely sure of. I'm using custom fonts and this appears to relate to that. I'm not sure exactly what it does, though.
Code:
<IfModule mod_php.c>
    php_value suhosin.executor.include.whitelist tmpl://, file://
</IfModule>

<FilesMatch "\.(ttf|otf|woff)$">
<IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>


Quote:
[ ] Check the crontab or Task Scheduler for unexpected jobs/tasks.

Unable to access.

Quote:
[ ] Ensure you do not have anonymous ftp enabled

Although unable to access now to confirm, by default anonymous FTP is disabled by my host. Whilst I think I can enable it, I have never done so and would assume that it is turned off.


Top
 Profile  
 
PostPosted: Sun May 06, 2012 11:37 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
Quote:
The attack seems to have been started by uploading a PHP shell script
via FTP from the localhost using a username and password that are stored
in the Joomla configuration.php script.

Suggest one of two things to me
  1. The server is badly configured and you set files 777 to install extensions.
    or
  2. The host may just be making assumption because they found the ftp details in the configuration.php. It could be your computer is compromised and that is how the ftp was obtained.

Would you like to PM me the url and the name of your host ? I could do some digging.

Addendum

Was typing when you posted about the Mac.

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Sun May 06, 2012 11:45 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun May 06, 2012 9:28 pm
Posts: 7
Thanks Webdongle. I've only just registered and apparently I am unable to send messages yet.

Is there any reason why I shouldn't just post the details here? I removed the affected domain name/s in previous posts as I was unsure.


Top
 Profile  
 
PostPosted: Mon May 07, 2012 12:04 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
Best not to name and shame when we don't know if they are one of the known hosts who get hacked frequently.

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Mon May 07, 2012 12:37 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
@TomSel

I got your email and searched your Host. Couldn't find anything about their servers being victims of mass hacking.

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Mon May 07, 2012 12:47 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun May 06, 2012 9:28 pm
Posts: 7
Thanks for looking. Referring to your earlier post, it may well be that my host has made the assumption regarding the config file.

I'm still very wary of putting the site back online, though. Is there anything information I could ask my host for that could shed some more light on this?


Top
 Profile  
 
PostPosted: Mon May 07, 2012 8:49 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jun 02, 2008 1:38 pm
Posts: 5
Quote:
The attack seems to have been started by uploading a PHP shell script
via FTP from the localhost using a username and password that are stored
in the Joomla configuration.php script.


appending a "?-s" will show the actual php content instead of excuting it in certain php/cgi combinations.

for more details you might want to check this http://www.h-online.com/security/news/item/PHP-patch-quick-but-inadequate-1568454.html


Top
 Profile  
 
PostPosted: Mon May 07, 2012 11:31 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
Perhaps that's why my host puts a file called hide_config_files.php in the folder when they auto install Joomla ?
Code:
<?php

// Hides specified config files from the world

// Put a list of the config file(s) to be hidden from world readable below

$hidden_config_files = array(
                             "hide_config_files.php",
                             "configuration.php"
                            );

foreach ($hidden_config_files as $x) {
    if (@is_file($x)) {
        chmod($x, 0600);
    }
}
?>

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Mon May 07, 2012 12:15 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Mon Aug 29, 2005 10:17 am
Posts: 11987
Location: Netherlands/ UK/ S'pore/Jakarta/ North America
Arrakis wrote:
appending a "?-s" will show the actual php content instead of excuting it in certain php/cgi combinations. for more details just go
viewtopic.php?f=621&t=716490

Cheers
Leo 8)

_________________
--- Joomla Professional Support Services :: http://gws-desk.com ---
--- Joomla Professional and Specialized Hosting :: http://gws-host.com ---
--- Ready to Roll Joomla! Web Sites : 1 - 7 days only! :: @ gws-market.com ---


Top
 Profile  
 
PostPosted: Mon May 07, 2012 2:48 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun May 06, 2012 9:28 pm
Posts: 7
Arrakis / leolam:
I've checked a site running on the same server as the downed sites, and the server configuration for PHP is listed as:
Quote:
Server API: CGI/FastCGI


I've tried going to a live site and using /index.php?-s and it did not show the PHP, just the normal, rendered website. I also tried it for /configuration.php?-s and just got a blank page.

Webdongle:
Would a file such as that only be relevant if the vulnerability pointed out by Arrakis was present on the server? By the looks of it my host isn't effected by it, so not sure if that file is needed.

Edit to add:
The PHP version is 5.3.10, not the current version. Not sure if this is relevant...


Top
 Profile  
 
PostPosted: Mon May 07, 2012 3:45 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
I tried without that file and my configuration.php did not show. All I know is they put that on when Joomla is installed from their CP.

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Mon May 07, 2012 7:52 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun May 06, 2012 9:28 pm
Posts: 7
Does anyone have any ideas about what I can do to try to find out how this attack occurred? I've asked my host to not restore the site for the time being, as I'm concerned the same will just happen again.

I have other sites running presumably near identical setups though so I am obviously extremely concerned the same could happen to those.


Top
 Profile  
 
PostPosted: Fri May 11, 2012 4:23 pm 
User avatar
Joomla! Hero
Joomla! Hero

Joined: Sat Oct 21, 2006 10:20 pm
Posts: 2694
Location: Wisconsin USA
The vulnerability affects servers that are running PHP in CGI mode; FastCGI for PHP installations are not affected. Reportedly, the vulnerability can be exploited in combination with components such as the lighttpd web server. so those sites hosted on a server that uses the lighttpd server may also be at risk. Appending a "?-s to the url may or may not mean anything at this point. Any exploit will surely try the easy way first, but among exploits taking advantage of the hole in php-cgi, there are Apache configuration directives that would put a server in a vulnerable state and these could possibly be applied to a hacked htaccess file. There are a number of attack vectors attempting to take advantage of the hole which I will not list. One of the major goals of these attacks are to try and download/install root webshells and backdoors in order to access the server and all site on it at will.

For your part Tom, follow what I post below to properly clean and repair your website. If you host refuses to allow you access to your site after you show them the plan to fix your site as outlined below, then change hosts. How can you fix something you can not access? Common ways of Initial hacking have been through an insecure or out of date extension or Joomla install, a permissions issue or possibly from another site on the host. These are not the only ways, just some common ones. The important thing now is to properly clean the website. Follow what is below:

PhilD wrote:

It is suggested to do all of the following. Failure to follow the suggestions below may leave your site vulnerable to being hacked again in the future.


You must state what version of Joomla you were using when when the site first became hacked. This can make a difference as to how we approach your individual situation.

[ ] Download and RUN the Forum Post Assistant / FPA Instructions available here and are also included in the download package. Post the generated results in your security/been hacked topic.

[ ] Ensure you have the latest version of Joomla. Delete all files in your Joomla installation, saving a copy of the configuration.php file. Replace the deleted files with fresh copies of a current full version of Joomla (minus the installation directory), and fresh copies of extensions and templates used. Upload the copy of your configuration file. Only by replacing all files in the installation (including extensions and templates) can you be sure to remove the backdoors inserted and hidden in files and directories More detail can be found in the security Checklist 7 link below.

[ ] Review Vulnerable Extensions List

[ ] Review and action Security Checklist 7 to make sure you've gone through all of the steps.

[ ] Scan all machines with FTP, Joomla super admin, and Joomla admin access for malware, virus, trojans, spyware, etc.

[ ] Change all passwords and if possible user names for the website host control panel and your Joomla site.

[ ] Use proper permissions on files and directories. They should never be 777, ideal is 644 and 755 and 444 for the configuration.php file.

[ ] Check your htaccess for for any odd code (i.e. code which is not in the standard htaccess supplied as part of the Joomla installation).

[ ] Check the crontab or Task Scheduler for unexpected jobs/tasks.

[ ] Ensure you do not have anonymous ftp enabled

Note: The forum post tool will work with all versions of Joomla.

_________________
PhilD -- Unrequested PM's and/or emails may not get a response.
Security Moderator


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 



Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group