Nuclei 进阶—深入理解 Workflows、Matchers 和 Extractors

Nuclei 进阶—深入理解 Workflows、Matchers 和 Extractors插图亿华云

前面的文章中介绍了nuclei的基础使用方法,可以参考文章:

​​POC模拟攻击利器——Nuclei入门(一)​​

接下来我重点讲解一下nuclei中的三个概念,Workflows、Mathcer和Extractors。这些内容将有助于帮助大家编写更为复杂和高效的检测脚本!

Nuclei 进阶—深入理解 Workflows、Matchers 和 Extractors插图1亿华云

workflows

Workflows允许用户自定义模板的执行顺序,这是使用nuclei最高效的方式,官方推荐用户使用自定义Workflows进而缩短扫描时间,提升扫描效率!

基础工作流

例如,定义workflow 扫描files目录下如下yaml:

workflows:- template: files/git-config.yaml- template: files/svn-config.yaml- template: files/env-file.yaml- template: files/backup-files.yaml- tags: xss,ssrf,cve,lfi条件工作流

首先确认springboot-detect.yaml是否正确执行,如果OK,则运行subtemplates下的template,实例如下:

id: springboot-workflowinfo:name: Springboot Security Checksauthor: dwisiswant0workflows:- template: security-misconfiguration/springboot-detect.yamlsubtemplates:- template: cves/CVE-2018-1271.yaml- template: cves/CVE-2018-1271.yaml- template: cves/CVE-2020-5410.yaml- template: vulnerabilities/springboot-actuators-jolokia-xxe.yaml- template: vulnerabilities/springboot-h2-db-rce.yaml

运行workflows。

nuclei -list http_urls.txt -w workflows/my-workflow.yaml。

Matchers

Mathcer顾明思议,就是提供了一些规则,来对响应结果进行比较匹配!常用有六种类型的。

mathcer,如下所示:

status Integer Comparisons of Partsize Content Length of Partword Part for a protocolregex Part for a protocolbinary Part for a protocoldsl Part for a protocol

例如想对响应码进行比较匹配,写法如下:

matchers:# Match the status codes- type: status# Some status codes we want to matchstatus:- 200

想对响应码进行复杂的匹配时,可以使用dsl。

matchers:- type: dsldsl:- "len(body)

THE END
Copyright © 2024 亿华云