Table of Contents
Summary of repair methods for PHP websites with Trojans, summary of PHP Trojans
My website today Trojan horse
The website has a Trojan horse, and it cannot be opened as long as it is indexphp
Home Backend Development PHP Tutorial Summary of repair methods for Trojans hanging on PHP websites, summary of Trojans hanging on PHP_PHP tutorial

Summary of repair methods for Trojans hanging on PHP websites, summary of Trojans hanging on PHP_PHP tutorial

Jul 13, 2016 am 10:15 AM
linux php repair Can exist Summarize us method website

Summary of repair methods for PHP websites with Trojans, summary of PHP Trojans

In Linux, we can use commands to search for Trojan files, go to the code installation directory and execute the following command

The code is as follows Copy the code
find ./ -iname "*.php" | xargs grep -H -n "eval(base64_decode"

Nearly 100 results were found. This list of results is very important. Trojans are all in it. You need to open the files one by one to verify whether they are Trojans. If so, delete them immediately

Finally, 10 Trojan files were found, stored in various directories, all of which are PHP webshells with complete functions and encoded in base64

If you are looking for a directory in Windows, just use Windows file search. You can search for eval or recently modified files. Then if it is dedecms, we need to check the latest dedecms vulnerability and then patch it.


Here is a PHP Trojan search tool, which can be placed directly in the root directory of your site

The code is as follows Copy the code

/**************PHP Web Trojan Scanner***********************/

/* [+] Author: alibaba */

/* [+] QQ: 1499281192 * www.111cn.net/

/* [+] MSN: weeming21@hotmail.com */

/* [+] First published: t00ls.net, please indicate t00ls when reprinting */

/* [+] Version: v1.0 */

/* [+] Function: web version php Trojan scanning tool*/

/* [+] Note: The scanned files are not necessarily backdoors, */

/* Please judge, review and compare the original documents by yourself. */

/* If you are not sure whether the scanned file is a backdoor, */

/* You are welcome to send this file to me for analysis. */

/*******************************************************/

ob_start();

set_time_limit(0);

$username = "t00ls"; //Set username

$password = "t00ls"; //Set password

$md5 = md5(md5($username).md5($password));

$version = "PHP Web Trojan Scanner v1.0";

PHP Web Trojan Scanner

$realpath = realpath('./');

$selfpath = $_SERVER['PHP_SELF'];

$selfpath = substr($selfpath, 0, strrpos($selfpath,'/'));

define('REALPATH', str_replace('//','/',str_replace('','/',substr($realpath, 0, strlen($realpath) - strlen($selfpath)))) );

define('MYFILE', basename(__FILE__));

define('MYPATH', str_replace('', '/', dirname(__FILE__)).'/');

define('MYFULLPATH', str_replace('', '/', (__FILE__)));

define('HOST', "http://".$_SERVER['HTTP_HOST']);

?>

<?php echo $version?>

if(!(isset($_COOKIE['t00ls']) && $_COOKIE['t00ls'] == $md5) && !(isset($_POST['username']) && isset($_POST[' password']) && (md5(md5($_POST['username']).md5($_POST['password']))==$md5)))

{

echo '

Username: Password:
';

}

elseif(isset($_POST['username']) && isset($_POST['password']) && (md5(md5($_POST['username']).md5($_POST['password'] ))==$md5))

{

setcookie("t00ls", $md5, time()+60*60*24*365,"/");

echo "Login successful!";

header( 'refresh: 1; url='.MYFILE.'?action=scan' );

exit();

}

else

{

setcookie("t00ls", $md5, time()+60*60*24*365,"/");

$setting = getSetting();

$action = isset($_GET['action'])?$_GET['action']:"";

if($action=="logout")

{

setcookie ("t00ls", "", time() - 3600);

Header("Location: ".MYFILE);

exit();

}

if($action=="download" && isset($_GET['file']) && trim($_GET['file'])!="")

{

$file = $_GET['file'];

ob_clean();

if (@file_exists($file)) {

header("Content-type: application/octet-stream");

header("Content-Disposition: filename="".basename($file).""");

echo file_get_contents($file);

}

exit();

}

?>

$version"?>

扫描 |

设定 |

登出


if($action=="setting")

{

if(isset($_POST['btnsetting']))

{

$Ssetting = array();

$Ssetting['user']=isset($_POST['checkuser'])?$_POST['checkuser']:"php | php? | phtml";

$Ssetting['all']=isset($_POST['checkall'])&&$_POST['checkall']=="on"?1:0;

$Ssetting['hta']=isset($_POST['checkhta'])&&$_POST['checkhta']=="on"?1:0;

setcookie("t00ls_s", base64_encode(serialize($Ssetting)), time()+60*60*24*365,"/");

echo "设置完成!";

header( 'refresh: 1; url='.MYFILE.'?action=setting' );

exit();

}

?>

扫描设定

文件后缀:
>
>
 

}

else

{

$dir = isset($_POST['path'])?$_POST['path']:MYPATH;

$dir = substr($dir,-1)!="/"?$dir."/":$dir;

?>

if(isset($_POST['btnScan']))

{

$start=mktime();

$is_user = array();

$is_ext = "";

$list = "";

 

if(trim($setting['user'])!="")

{

$is_user = explode("|",$setting['user']);

if(count($is_user)>0)

{

foreach($is_user as $key=>$value)

$is_user[$key]=trim(str_replace("?","(.)",$value));

$is_ext = "(.".implode("($|.))|(.",$is_user)."($|.))";

}

}

if($setting['hta']==1)

{

$is_hta=1;

$is_ext = strlen($is_ext)>0?$is_ext."|":$is_ext;

$is_ext.="(^.htaccess$)";

}

if($setting['all']==1 || (strlen($is_ext)==0 && $setting['hta']==0))

{

$is_ext="(.+)";

}

 

$php_code = getCode();

if(!is_readable($dir))

$dir = MYPATH;

$count=$scanned=0;

scan($dir,$is_ext);

$end=mktime();

$spent = ($end - $start);

?>

扫描: 文件| 发现: 可疑文件| 耗时:

扫描路径:

  

No. 文件 更新时间 原因 特征 动作

}

}

}

ob_flush();

?>

function scan($path = '.',$is_ext){

global $php_code,$count,$scanned,$list;

$ignore = array('.', '..' );

$replace=array(" ","n","r","t");

$dh = @opendir( $path );

 

 

while(false!==($file=readdir($dh))){

if( !in_array( $file, $ignore ) ){

if( is_dir( "$path$file" ) ){

scan("$path$file/",$is_ext);

} else {

$current = $path.$file;

if(MYFULLPATH==$current) continue;

if(!preg_match("/$is_ext/i",$file)) continue;

if(is_readable($current))

{

$scanned++;

$content=file_get_contents($current);

$content= str_replace($replace,"",$content);

foreach($php_code as $key => $value)

{

if(preg_match("/$value/i",$content))

{

$count++;

$j = $count % 2 + 1;

$filetime = date('Y-m-d H:i:s',filemtime($current));

$reason = explode("->",$key);

$url = str_replace(REALPATH,HOST,$current);

preg_match("/$value/i",$content,$arr);

$list.="

$count

$current

$filetime

$reason[0]

$reason[1]

下载

";

//echo $key . "-" . $path . $file ."(" . $arr[0] . ")" ."
";

//echo $path . $file ."
";

break;

}

}

}

}

}

}

closedir( $dh );

}

function getSetting()

{

$Ssetting = array();

if(isset($_COOKIE['t00ls_s']))

{

$Ssetting = unserialize(base64_decode($_COOKIE['t00ls_s']));

$Ssetting['user']=isset($Ssetting['user'])?$Ssetting['user']:"php | php? | phtml | shtml";

$Ssetting['all']=isset($Ssetting['all'])?intval($Ssetting['all']):0;

$Ssetting['hta']=isset($Ssetting['hta'])?intval($Ssetting['hta']):1;

}

else

{

$Ssetting['user']="php | php? | phtml | shtml";

$Ssetting['all']=0;

$Ssetting['hta']=1;

setcookie("t00ls_s", base64_encode(serialize($Ssetting)), time()+60*60*24*365,"/");

}

return $Ssetting;

}

function getCode()

{

return array(

'后门特征->cha88.cn'=>'cha88.cn',

'后门特征->c99shell'=>'c99shell',

'后门特征->phpspy'=>'phpspy',

'后门特征->Scanners'=>'Scanners',

'后门特征->cmd.php'=>'cmd.php',

'后门特征->str_rot13'=>'str_rot13',

'后门特征->webshell'=>'webshell',

'后门特征->EgY_SpIdEr'=>'EgY_SpIdEr',

'后门特征->tools88.com'=>'tools88.com',

'后门特征->SECFORCE'=>'SECFORCE',

'后门特征->eval("?>'=>'eval(('|")?>',

'可疑代码特征->system('=>'system(',

'可疑代码特征->passthru('=>'passthru(',

'可疑代码特征->shell_exec('=>'shell_exec(',

'可疑代码特征->exec('=>'exec(',

'可疑代码特征->popen('=>'popen(',

'可疑代码特征->proc_open'=>'proc_open',

'可疑代码特征->eval($'=>'eval(('|"|s*)$',

'可疑代码特征->assert($'=>'assert(('|"|s*)$',

'危险MYSQL代码->returns string soname'=>'returnsstringsoname',

'危险MYSQL代码->into outfile'=>'intooutfile',

'危险MYSQL代码->load_file'=>'select(s+)(.*)load_file',

'Encryption backdoor characteristics->eval(gzinflate('=>'eval(gzinflate(',

'Encryption backdoor characteristics->eval(base64_decode('=>'eval(base64_decode(',

'Encryption backdoor characteristics->eval(gzuncompress('=>'eval(gzuncompress(',

'Encryption backdoor characteristics->eval(gzdecode('=>'eval(gzdecode(',

'Encryption backdoor characteristics->eval(str_rot13('=>'eval(str_rot13(',

'Encryption backdoor characteristics->gzuncompress(base64_decode('=>'gzuncompress(base64_decode(',

'Encryption backdoor characteristics->base64_decode(gzuncompress('=>'base64_decode(gzuncompress(',

'One sentence backdoor characteristics->eval($_'=>'eval(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->assert($_'=>'assert(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->require($_'=>'require(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->require_once($_'=>'require_once(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->include($_'=>'include(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->include_once($_'=>'include_once(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->call_user_func("assert"'=>'call_user_func(("|')assert("|')',

'One sentence backdoor characteristics->call_user_func($_'=>'call_user_func(('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'One sentence backdoor characteristics->$_POST/GET/REQUEST/COOKIE[?]($_POST/GET/REQUEST/COOKIE[?]'=>'$_(POST|GET|REQUEST|COOKIE) [([^]]+)](('|"|s*)$_(POST|GET|REQUEST|COOKIE)[',

'One sentence backdoor characteristics->echo(file_get_contents($_POST/GET/REQUEST/COOKIE'=>'echo(file_get_contents(('|"|s*)$_(POST|GET|REQUEST|COOKIE )',

'Upload backdoor characteristics->file_put_contents($_POST/GET/REQUEST/COOKIE,$_POST/GET/REQUEST/COOKIE'=>'file_put_contents(('|"|s*)$_(POST|GET |REQUEST|COOKIE)[([^]]+)],('|"|s*)$_(POST|GET|REQUEST|COOKIE)',

'Upload backdoor features->fputs(fopen("?","w"),$_POST/GET/REQUEST/COOKIE['=>'fputs(fopen((.+),('|" )w('|")),('|"|s*)$_(POST|GET|REQUEST|COOKIE)[',

'.htaccess plug-in feature->SetHandler application/x-httpd-php'=>'SetHandlerapplication/x-httpd-php',

'.htaccess plug-in feature->php_value auto_prepend_file'=>'php_valueauto_prepend_file',

'.htaccess plug-in feature->php_value auto_append_file'=>'php_valueauto_append_file'

);

}

?>

from:http://www.111cn.net/phper/phpanqn/52711.htm

My website today Trojan horse

It was a false alarm caused by Kaspersky, and it has been solved. It was the same for me. I entered safe mode for a long time but still couldn’t fix it. Later, I manually updated Kaspersky’s virus database and it was fine.
The following is a notice about this matter:
At 15:20 pm on May 19, CNZZ received the latest virus database update notification from Kaspersky China. The other party has solved the problem of false positives in CNZZ statistics. , CNZZ statistical services have returned to normal as soon as possible. If some users still report viruses, please update the Kaspersky virus database manually.

The website has a Trojan horse, and it cannot be opened as long as it is indexphp

Under normal circumstances, after the computer is poisoned or infected with Trojans or viruses, the Trojan viruses will destroy the system. General anti-virus software cannot solve these problems. It is recommended that you use system repair tools such as Kingsoft Network Shield or Kingsoft First Aid Kit to repair the system. Fix, that's how I solved the problem.
Suggest you the best solution

Step 1: Download Kingsoft Antivirus 2011 [Search Kingsoft Antivirus on Baidu] Select the official download

Step 2: After installation, open Kingsoft Antivirus and click "Comprehensive search and killing"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/905902.htmlTechArticleSummary of repair methods for php websites with Trojans hanging, summary of php Trojans hanging In Linux, we can use commands to search for Trojan files , go to the code installation directory and execute the following command code. Copy the code as follows...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP: An Introduction to the Server-Side Scripting Language PHP: An Introduction to the Server-Side Scripting Language Apr 16, 2025 am 12:18 AM

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

Why Use PHP? Advantages and Benefits Explained Why Use PHP? Advantages and Benefits Explained Apr 16, 2025 am 12:16 AM

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

PHP and the Web: Exploring its Long-Term Impact PHP and the Web: Exploring its Long-Term Impact Apr 16, 2025 am 12:17 AM

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

PHP vs. Python: Use Cases and Applications PHP vs. Python: Use Cases and Applications Apr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

What is vscode What is vscode for? What is vscode What is vscode for? Apr 15, 2025 pm 06:45 PM

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages ​​and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

How to switch Chinese mode with vscode How to switch Chinese mode with vscode Apr 15, 2025 pm 11:39 PM

VS Code To switch Chinese mode: Open the settings interface (Windows/Linux: Ctrl, macOS: Cmd,) Search for "Editor: Language" settings Select "Chinese" in the drop-down menu Save settings and restart VS Code

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

See all articles