CMS gehackt

Deutschsprachiger Support für CMS Made Simple
Post Reply
urmel5
New Member
New Member
Posts: 2
Joined: Mon Oct 06, 2008 2:49 pm

CMS gehackt

Post by urmel5 »

Hallo,

bei mir im CMS war jemand drin. Ich habe jetzt erstmal alle Passwörter geändert.
Die Templates waren völlig verwüstet, habe ich auch wieder gereinigt.

Aber im Quelltext ist immer noch eine Liste mit einem I-Frame mit sexuellen Inhalten.

Code: Select all

<div style="display: none;">
<a href="***">***</a>
[...]
</div>
<__iframe src="***" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></__iframe><__iframe src="***" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></__iframe>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <__html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>Seitentitel</title>
Da das aber über den dem head bereich ist, muss der irgendwo das ja noch eingefügt haben. Irgendwo in den Templates auf dem Server? Ich kanns nur net finden... :(

BITTE HELFT MIR...
NaN

Re: CMS gehackt

Post by NaN »

Schau mal in die index.php.

Welche CMS Version hast Du benutzt?
Hattest Du die Tipps zum Thema Sicherheit umgesetzt?
Wenn die Index.php tatsächlich verändert wurde, dann liegt nahe, dass jemand zugriff auf Deinen Webspace hatte.
Es ist also gut möglich, dass noch weitere Scripte auf dem Server sind, die da nichts zu suchen haben und evtl. Türen öffnen.

Bei solchen Vorfällen:

- Backup von Deinen Dateien, die du zusätzlich hochgeladen hast (Bilder, Texte, Dokumente - in der Regel im Uploads-Ordner zu finden)
- Backup der Datenbank
- Webspace (bzw. den Ordner in dem sich Dein CMS befindet) komplett löschen
- CMS neu installieren
- Dateien wieder raufkopieren (ACHTUNG: wirklich nur Deine Dateien!)
- Und dann Stück für Stück die Inhalte in die DB importieren (aber wirklich nur Deine Inhalte)

oder den Webspace durchforsten und mit dem Inhalt des hier heruntergeladenen Pakets vergleichen.

Eventuell noch die Serverlogs prüfen, wann welche Dateien wie auf den Server geladen wurden.
Last edited by NaN on Mon Oct 06, 2008 5:09 pm, edited 1 time in total.
LeisureLarry

Re: CMS gehackt

Post by LeisureLarry »

Also, wenn das Zeugs über dem Doctype eingebunden wurde, würde ich auch auf eine veränderte index.php tippen.

Für die Community ist in solchen Fällen aber immer wichtig zu wissen, welche CMSms Version Du einsetzt, wie es auch schon NaN geschrieben hat. Sollte es etwas anderes als die 1.4.1 sein, so solltest Du ein Backup aller relevanten Daten machen. Alles löschen und das System mit der aktuellsten Version neu aufsetzen.

Grüße aus Nürnberg
LeisureLarry (interiete.net)
urmel5
New Member
New Member
Posts: 2
Joined: Mon Oct 06, 2008 2:49 pm

Re: CMS gehackt

Post by urmel5 »

Hallo,

danke für die Tipps.

Könntet ihr mal bitte meine index.php durchschauen. Ich kann da nichts entdecken:

Code: Select all

<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#$Id: index.php 4217 2007-10-07 15:13:13Z wishy $

$dirname = dirname(__FILE__);
require_once($dirname.'/fileloc.php');

/**
 * Entry point for all non-admin pages
 *
 * @package CMS
 */	
#echo '<code style="align: left;">';
#var_dump($_SERVER);
#echo '</code>';

$starttime = microtime();

@ob_start();

clearstatcache();

if (!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['QUERY_STRING']))
{
	$_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
}

if (!file_exists(CONFIG_FILE_LOCATION) || filesize(CONFIG_FILE_LOCATION) < 800)
{
    require_once($dirname.'/lib/misc.functions.php');
    if (FALSE == is_file($dirname.'/install/index.php')) {
        die ('There is no config.php file or install/index.php please correct one these errors!');
    } else {
        redirect('install/');
    }
}
else if (file_exists(TMP_CACHE_LOCATION.'/SITEDOWN'))
{
	echo "<__html><head><title>Maintenance</title></head></__body><p>Site down for maintenance.</p><__body></__html>";
	exit;
}

if (!is_writable(TMP_TEMPLATES_C_LOCATION) || !is_writable(TMP_CACHE_LOCATION))
{
	echo '<__html><title>Error</title></head></__body>';
	echo '<p>The following directories must be writable by the web server:<br />';
	echo 'tmp/cache<br />';
	echo 'tmp/templates_c<br /></p>';
	echo '<p>Please correct by executing:<br /><em>chmod 777 tmp/cache<br />chmod 777 tmp/templates_c</em><br />or the equivilent for your platform before continuing.</p>';
	echo '<__body></__html>';
	exit;
}

require_once($dirname.'/include.php'); #Makes gCms object

if ($config["debug"] == true)
  {
    @ini_set('display_errors',1);
    @error_reporting(E_ALL);
  }

$params = array_merge($_GET, $_POST);

$smarty = &$gCms->smarty;
$smarty->params = $params;

$page = '';

if (isset($params['mact']))
{
  $ary = explode(',', cms_htmlentities($params['mact']), 4);
  $smarty->id = (isset($ary[1])?$ary[1]:'');
}
else
{
  $smarty->id = (isset($params['id'])?intval($params['id']):'');
}

if (isset($smarty->id) && isset($params[$smarty->id . 'returnid']))
{
	$page = $params[$smarty->id . 'returnid'];
}
else if (isset($config["query_var"]) && $config["query_var"] != '' && isset($_GET[$config["query_var"]]))
{
	$page = $_GET[$config["query_var"]];

    //trim off the extension, if there is one set
    if ($config['page_extension'] != '' && endswith($page, $config['page_extension']))
    {   
        $page = substr($page, 0, strlen($page) - strlen($config['page_extension']));
    }
}
else
{
	$calced = cms_calculate_url();
	if ($calced != '')
		$page = $calced;
}

//See if our page matches any predefined routes
$page = rtrim($page, '/');
if (strpos($page, '/') !== FALSE)
{
	$routes =& $gCms->variables['routes'];
	
	$matched = false;
	foreach ($routes as $route)
	{
		$matches = array();
		if (preg_match($route->regex, $page, $matches))
		{
			//Now setup some assumptions
			if (!isset($matches['id']))
				$matches['id'] = 'cntnt01';
			if (!isset($matches['action']))
				$matches['action'] = 'defaulturl';
			if (!isset($matches['inline']))
				$matches['inline'] = 0;
			if (!isset($matches['returnid']))
				$matches['returnid'] = ''; #Look for default page
			if (!isset($matches['module']))
				$matches['module'] = $route->module;

			//Get rid of numeric matches
			foreach ($matches as $key=>$val)
			{
				if (is_int($key))
				{
					unset($matches[$key]);
				}
				else
				{
					if ($key != 'id')
						$_REQUEST[$matches['id'] . $key] = $val;
				}
			}

			//Now set any defaults that might not have been in the url
			if (isset($route->defaults) && count($route->defaults) > 0)
			{
				foreach ($route->defaults as $key=>$val)
				{
					$_REQUEST[$matches['id'] . $key] = $val;
					if (array_key_exists($key, $matches))
					{ 
						$matches[$key] = $val;
					}
				}
			}

			//Get a decent returnid
			if ($matches['returnid'] == '') {
				global $gCms;
				$contentops =& $gCms->GetContentOperations();
				$matches['returnid'] = $contentops->GetDefaultPageID();
			}

			$_REQUEST['mact'] = $matches['module'] . ',' . $matches['id'] . ',' . $matches['action'] . ',' . $matches['inline'];
			$page = $matches['returnid'];
			$smarty->id = $matches['id'];

			$matched = true;
		}
	}

	if (!$matched)
	{
		$page = substr($page, strrpos($page, '/') + 1);
	}
}

if ($page == '')
{
	global $gCms;
	$contentops =& $gCms->GetContentOperations();
	$page =& $contentops->GetDefaultContent();
}
else
{
    $page = preg_replace('/\</','',$page);
}

$pageinfo = PageInfoOperations::LoadPageInfoByContentAlias($page);

if (isset($pageinfo) && $pageinfo !== FALSE)
{
	$gCms->variables['pageinfo'] =& $pageinfo;

	if( isset($pageinfo->template_encoding) && 
	    $pageinfo->template_encoding != '' )
	{
	  set_encoding($pageinfo->template_encoding);
	}

	$gCms->variables['content_id'] = $pageinfo->content_id;
	$gCms->variables['page'] = $page;
	$gCms->variables['page_id'] = $page;

	$gCms->variables['page_name'] = $pageinfo->content_alias;
	$gCms->variables['position'] = $pageinfo->content_hierarchy;
	global $gCms;
	$contentops =& $gCms->GetContentOperations();
	$gCms->variables['friendly_position'] = $contentops->CreateFriendlyHierarchyPosition($pageinfo->content_hierarchy);
	
	$smarty->assign('content_id', $pageinfo->content_id);
	$smarty->assign('page', $page);
	$smarty->assign('page_id', $page);
	$smarty->assign('page_name', $pageinfo->content_alias);
	$smarty->assign('page_alias', $pageinfo->content_alias);
	$smarty->assign('position', $pageinfo->content_hierarchy);
	$smarty->assign('friendly_position', $gCms->variables['friendly_position']);
}
else if (get_site_preference('enablecustom404') == '' || get_site_preference('enablecustom404') == "0")
{
	ErrorHandler404();
	exit;
}

$html = '';
$cached = '';

if (isset($_GET["print"]))
{
	($smarty->is_cached('print:'.$page, '', $pageinfo->template_id)?$cached="":$cached="not ");
	$html = $smarty->fetch('print:'.$page, '', $pageinfo->template_id) . "\n";
}
else
{
	#If this is a case where a module doesn't want a template to be shown, just disable caching
	if (isset($smarty->id) && $smarty->id != '' && isset($_REQUEST[$smarty->id.'showtemplate']) && $_REQUEST[$smarty->id.'showtemplate'] == 'false')
	{
		$html = $smarty->fetch('template:notemplate') . "\n";
	}
	else
	{
		$smarty->caching = false;
		$smarty->compile_check = true;
		($smarty->is_cached('template:'.$pageinfo->template_id)?$cached="":$cached="not ");
		$html = $smarty->fetch('template:'.$pageinfo->template_id) . "\n";
	}
}

#if ((get_site_preference('enablecustom404') == '' || get_site_preference('enablecustom404') == "0") && (!$config['debug']))
#{
#	set_error_handler($old_error_handler);
#}

if (!$cached)
{
	#Perform the content postrendernoncached callback
	reset($gCms->modules);
	while (list($key) = each($gCms->modules))
	{
		$value =& $gCms->modules[$key];
		if ($gCms->modules[$key]['installed'] == true &&
			$gCms->modules[$key]['active'] == true)
		{
			$gCms->modules[$key]['object']->ContentPostRenderNonCached($html);
		}
	}
	//Events::SendEvent('Core', 'ContentPostRenderNonCached', array(&$html));
}

#Perform the content postrender callback
reset($gCms->modules);
while (list($key) = each($gCms->modules))
{
	$value =& $gCms->modules[$key];
	if ($gCms->modules[$key]['installed'] == true &&
		$gCms->modules[$key]['active'] == true)
	{
		$gCms->modules[$key]['object']->ContentPostRender($html);
	}
}

Events::SendEvent('Core', 'ContentPostRender', array('content' => &$html));

header("Content-Type: " . $gCms->variables['content-type'] . "; charset=" . (isset($pageinfo->template_encoding) && $pageinfo->template_encoding != ''?$pageinfo->template_encoding:get_encoding()));

echo $html;





@ob_flush();

$endtime = microtime();

$db =& $gCms->GetDb();

if ($config["debug"] == true)
{
	echo "<p>Generated in ".microtime_diff($starttime,$endtime)." seconds by CMS Made Simple using ".(isset($db->query_count)?$db->query_count:'')." SQL queries and ".(function_exists('memory_get_usage')?memory_get_usage():'n/a')." bytes of memory</p>";
}




echo "<!-- Generated in ".microtime_diff($starttime,$endtime)." seconds by CMS Made Simple using ".(isset($db->query_count)?$db->query_count:'')." SQL queries -->\n";
#echo "<p>Generated in ".microtime_diff($starttime,$endtime)." seconds by CMS Made Simple (".$cached."cached) using ".(isset($db->query_count)?$db->query_count:'')." SQL queries and ".(function_exists('memory_get_usage')?memory_get_usage():'n/a')." bytes of memory</p>";
echo "<!-- CMS Made Simple - Released under the GPL - http://cmsmadesimple.org -->\n";


if (get_site_preference('enablesitedownmessage') == "1" || $config['debug'] == true)
{
	$smarty->clear_compiled_tpl();
	#$smarty->clear_all_cache();
}

if ($config["debug"] == true)
{
	#$db->LogSQL(false); // turn off logging
	
	# output summary of SQL logging results
	#$perf = NewPerfMonitor($db);
	#echo $perf->SuspiciousSQL();
	#echo $perf->ExpensiveSQL();

	#echo $sql_queries;
	foreach ($gCms->errors as $error)
	{
		echo $error;
	}
}

# vim:ts=4 sw=4 noet
?>
LeisureLarry

Re: CMS gehackt

Post by LeisureLarry »

Ich sehe so direkt auch nix, aber wie gesagt die einzige sinnvolle Variante ist sowieso Backup, alles löschen und mit aktuellster Version neu aufsetzen (inkl. Beitrag Sicherheit hier im Forum). Es kann nämlich durchaus sein, daß jemand schon Dateien für zukünftige Aktionen verändert hat, sie derzeit aber nicht aktiv ausnutzt und Du somit nichts bemerkst.

Grüße aus Nürnberg
LeisureLarry (interiete.net)
NaN

Re: CMS gehackt

Post by NaN »

Schau mal in alle Dateien, die mittels require oder include eingebunden werden.
Und notfalls auch in die, die wiederum dort eingebunden werden.
Eventuell wird auch einfach nur irgendwo (vielleicht sogar in Deinem Template) ein Javascript eingebunden, das dieses iFrame dann dynamisch erzeugt.
In dem Falle könntest Du Dich dumm und dämlich suchen.
Das wird eine ziemliche Fitzelei.

Mich würde trotzdem noch interessieren welche CMS Version du verwendest.
Es wäre hilfreich zu wissen, ob es Sicherheitslücken in der aktuellesten Version gibt.
Post Reply

Return to “German - Deutsch”