You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a template that has multiple protocols (the example from https://docs.projectdiscovery.io/templates/protocols/multi-protocol works here), where only one of its protocols clusters other templates (e.g. ones without the second protocol), under certain circumstances a panic will occur when it tries to execute the "mismatched" protocol. In the case where there is successful clustering, it won't execute the "mismatched" portion of the cluster.
Expected Behavior:
Clustering should not lead to panic (:)), additionally if templates are clustered, all aspects of the template should execute.
a-template.yaml - same contents, with the dns protocol section removed and id changed to a-http-template
b-template.yaml - same contents, with the dns protocol section removed and id changed to b-http-template
e-template.yaml - same for above, but using e-http-template
For example for a-template.yaml
id: a-http-templateinfo:
name: a http templateauthor: pdteamseverity: infohttp:
- method: GET # http requestpath:
- "{{BaseURL}}"matchers:
- type: dsldsl:
- contains(http_body,'Domain not found') # check for string from http response
- contains(dns_cname, 'github.io') # check for cname from dns responsecondition: and
Now run: ./nuclei -vv -t dns-http-template.yaml -t a-template.yaml -target http://localhost
Template load output
[a-http-template] a http template (@pdteam) [info]
[dns-http-template] dns + http takeover template (@pdteam) [info]
So it seems to be the case that if the DNS template is loaded first the "cluster" will get treated as having DNS protocol requests, even though the actual clustering occurred on the http protocol. However if it clusters/executes against the "http" ones first, the dns protocol isn't seen.
Anything else:
I suspect that multi-protocol templates simply just didn't get factored into clustering (perhaps didn't exist at the time, I'm fairly new to nuclei usage).
I think the simplest fix is likely to treat "multi-protocol" the same as "multiple requests" and not cluster or if there is a way to only cluster when all protocols match (and have 1 request each?).
The text was updated successfully, but these errors were encountered:
jdewald
added
the
Type: Bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
label
Mar 29, 2024
jdewald
changed the title
Clustering of Multi-Protocol Templates panics
Clustering of Multi-Protocol Templates can panic
Mar 29, 2024
jdewald
changed the title
Clustering of Multi-Protocol Templates can panic
Clustering of Multi-Protocol Templates can panic or not execute correctly
Apr 1, 2024
Nuclei version: v3.2.2
Current Behavior:
If you have a template that has multiple protocols (the example from https://docs.projectdiscovery.io/templates/protocols/multi-protocol works here), where only one of its protocols clusters other templates (e.g. ones without the second protocol), under certain circumstances a panic will occur when it tries to execute the "mismatched" protocol. In the case where there is successful clustering, it won't execute the "mismatched" portion of the cluster.
Expected Behavior:
Clustering should not lead to panic (:)), additionally if templates are clustered, all aspects of the template should execute.
Steps To Reproduce:
dns-http-template.yaml - simply the contents from the multi-protocol example
a-template.yaml - same contents, with the
dns
protocol section removed andid
changed toa-http-template
b-template.yaml - same contents, with the
dns
protocol section removed andid
changed tob-http-template
e-template.yaml - same for above, but using
e-http-template
For example for
a-template.yaml
Now run:
./nuclei -vv -t dns-http-template.yaml -t a-template.yaml -target http://localhost
Template load output
You'll receive this panic:
However, if you do this instead, you will not get a crash:
./nuclei -vv -t dns-http-template.yaml -t e-template.yaml -target http://localhost
Template load output:
There's no indication of clustering in this case and everything is executed:
Finally if you execute:
./nuclei -vv -t dns-http-template.yaml -t a-template.yaml -t b-template.yaml -target http://localhost
Clustering occurs, but the DNS
QUERY
is not executed, only the clustered HTTP GET:So it seems to be the case that if the DNS template is loaded first the "cluster" will get treated as having DNS protocol requests, even though the actual clustering occurred on the
http
protocol. However if it clusters/executes against the "http" ones first, thedns
protocol isn't seen.Anything else:
I suspect that multi-protocol templates simply just didn't get factored into clustering (perhaps didn't exist at the time, I'm fairly new to
nuclei
usage).I think the simplest fix is likely to treat "multi-protocol" the same as "multiple requests" and not cluster or if there is a way to only cluster when all protocols match (and have 1 request each?).
The text was updated successfully, but these errors were encountered: