DecoyMini 技术交流社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5307|回复: 0

[工具] 小巧的 ASP.NET 的 webshell 混淆工具 —— SharPyShell

[复制链接]

172

主题

34

回帖

30

荣誉

Rank: 9Rank: 9Rank: 9

UID
2
积分
339
精华
1
沃币
2 枚
注册时间
2021-6-24

论坛管理

发表于 2022-5-19 10:33:35 | 显示全部楼层 |阅读模式

SharPyShell 是一个小巧的 ASP.NET webshell 混淆工具,执行由加密通道接收的命令,在运行时在内存中编译它们。

SharPyShell 仅支持在 .NET Framework >= 2.0 上运行的 C# Web 应用程序,VB 不支持 atm。



使用


  1. python3 SharPyShell.py generate -p somepassword
  2. python3 SharPyShell.py interact -u http://target.url/sharpyshell.aspx -p somepassword
复制代码

依赖


Python version >= 3.6 并且
  1. pip3 install -r requirements.txt
复制代码

描述


SharPyShell 是一个用 Python 编写的后开发框架,能够:

  • 生成混淆的 webshell
  • 模拟一个 windows 终端作为 webshell 的交互 (interact)

该框架的主要目的是为渗透测试人员提供一系列工具,以在对 IIS 网络服务器成功利用后简化后期利用阶段。

此工具并非旨在替代 C2 服务器的框架 (即 Meterpreter、Empire、ecc ...),但当登陆到入站和出站连接非常有限的完全受限服务器时,应该使用此工具。

在这个框架中,当你在目标服务器的 cmd 后面键入时,你将拥有 privesc、netdiscovery 和横向移动所需的所有工具。

此外,该框架旨在尽可能隐蔽地在 c# 代码和 powershell 模块的内存执行中实现。

SharPyShell 中实现的混淆旨在规避文件签名和网络签名 ID。对于网络签名规避,已经开发了一个完全加密的通道,用于发送命令和接收输出。文件签名的规避是在负责运行时编译 c# 代码的预编译 dll 上使用反射实现的。

技术图


  1. +-------------------------------------------+                      +--------------------------------------------+
  2. | SharPyShell Client (Local)                |                      | Target Server (Remote)                     |
  3. +-------------------------------------------+   +--------------+   +--------------------------------------------+
  4. |                                           |   |  Encrypted   |   |                                            |
  5. |   +--------+-----------------^-----------<---->     HTTP     <---->-----------+-----------------^--------+    |
  6. |            |                 |            |   |   Channel    |   |            |                 |             |
  7. |            |4-Receive        |1-Send      |   +--------------+   |            |2-Receive        |3-Send       |
  8. |            |                 |            |                      |            |                 |             |
  9. |   +--------v-----------------+--------+   |                      |   +--------v-----------------+--------+    |
  10. |   |              Module               |   |                      |   |           Webshell URL            |    |
  11. |   +--------+-----------------^--------+   |                      |   +--------+-----------------^--------+    |
  12. |   |        |Parse            |Generate|   |                      |   |        |Parse            |Generate|    |
  13. |   | +------v------+   +------+------+ |   |                      |   | +------v------+   +------+------+ |    |
  14. |   | |Base64 Resp  |   |Base64 Req   | |   |                      |   | |Base64 Req   |   |Base64 Resp  | |    |
  15. |   | +------+------+   +------^------+ |   |                      |   | +------+------+   +------^------+ |    |
  16. |   |        |Decode           |Encode  |   |                      |   |        |Decode           |Encode  |    |
  17. |   | +------v------+   +------+------+ |   |                      |   | +------v------+   +------+------+ |    |
  18. |   | |Xor/Aes Data |   |Xor/Aes Data | |   |                      |   | |Xor/Aes Data |   |Xor/Aes Data | |    |
  19. |   | +------+------+   +------^------+ |   |                      |   | +------+------+   +------^------+ |    |
  20. |   |        |Decrypt          |Encrypt |   |                      |   |        |Decrypt          |Encrypt |    |
  21. |   | +------v------+   +------+------+ |   |                      |   | +------v------+   +------+------+ |    |
  22. |   | |Response     |   |C# Code      | |   |                      |   | |C# Code      |   |Output       | |    |
  23. |   | +------+------+   +------+------+ |   |                      |   | +------+------+   +------+------+ |    |
  24. |   |        |                 ^        |   |                      |   |        |                 ^        |    |
  25. |   |        v                 |        |   |                      |   |        v                 |        |    |
  26. |   |        +--------+--------+        |   |                      |   |        +--------+--------+        |    |
  27. |   |                 |                 |   |                      |   |                 |                 |    |
  28. |   +---------------- ^ ----------------+   |                      |   +---------------- ^ ----------------+    |
  29. |                     |                     |                      |                     |                      |
  30. |                     |Run&Parse            |                      |                     |Compile&Run           |
  31. |                     |                     |                      |                     |                      |
  32. |             +------ v ------+             |                      |             +------ v ------+              |
  33. |             |Terminal       |             |                      |             |csc.exe        |              |
  34. |             +---------------+             |                      |             +---------------+              |
  35. |             |Modules:       |             |                      |             |System.dll     |              |
  36. |             |#exec_cmd      |             |                      |             |Compile in Mem |              |
  37. |             |#exec_ps       |             |                      |             |No exe output  |              |
  38. |             |#runas         |             |                      |             |               |              |
  39. |             |.....          |             |                      |             |               |              |
  40. |             |               |             |                      |             |               |              |
  41. |             +---------------+             |                      |             +---------------+              |
  42. |                                           |                      |                                            |
  43. +-------------------------------------------+                      +--------------------------------------------+
复制代码

模块


  1. #download               Download a file from the server                                            
  2. #exec_cmd               Run a cmd.exe /c command on the server                                    
  3. #exec_ps                Run a powershell.exe -nop -noni -enc 'base64command' on the server         
  4. #inject_dll_reflective  Inject a reflective DLL in a new (or existing) process                     
  5. #inject_dll_srdi        Inject a generic DLL in a new (or existing) process                        
  6. #inject_shellcode       Inject shellcode in a new (or existing) process                           
  7. #invoke_ps_module       Run a ps1 script on the target server                                      
  8. #invoke_ps_module_as    Run a ps1 script on the target server as a specific user                  
  9. #lateral_psexec         Run psexec binary to move laterally                                       
  10. #lateral_wmi            Run builtin WMI command to move laterally                                 
  11. #mimikatz               Run an offline version of mimikatz directly in memory                     
  12. #net_portscan           Run a port scan using regular sockets, based (pretty) loosely on nmap      
  13. #privesc_juicy_potato   Launch InMem Juicy Potato attack trying to impersonate NT AUTHORITY\SYSTEM
  14. #privesc_powerup        Run Powerup module to assess all misconfiguration for privesc              
  15. #runas                  Run a cmd.exe /c command spawning a new process as a specific user         
  16. #runas_ps               Run a powershell.exe -enc spawning a new process as a specific user        
  17. #upload                 Upload a file to the server
复制代码

已在 Windows Server >= 2008 Standard x64 上进行测试

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|DecoyMini 技术交流社区 ( 京ICP备2021005070号 )

GMT+8, 2024-5-18 12:35 , Processed in 0.060491 second(s), 27 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表