Features
The following features enhance the power of multi-protocol execution:- Protocol-Scoped Shared Variables Across Protocols
- Data Export across Protocols using Dynamic Extractor
Protocol Scoped Variables
In the previous example, we demonstrated how to export the DNS CNAME and use it in an HTTP request. However, you might encounter a scenario where a template includes more than four protocols, and you need to export various response fields such assubject_dn
, ns
, cname
, header
, and so on. While you could achieve this by adding more dynamic extractors, this approach could clutter the template and introduce redundant logic, making it difficult to track and maintain all the variables.
To address this issue, multi-protocol execution supports template-scoped protocol responses. This means that all response fields from all protocols in a template are available in the template context with a protocol prefix.
Here’s an example to illustrate this:
Protocol | Response Field | Exported Variable |
---|---|---|
ssl | subject_cn | ssl_subject_cn |
dns | cname | dns_cname |
http | header | http_header |
code | response | code_response |
-v -svd
flag and it will print all exported response fields
Example:
Data Export across Protocols
If you are unfamiliar with dynamic extractors, we recommend reading the dynamic extractor section first. Previously, Dynamic Extractors were only supported for specific protocols or workflows. However, with multi-protocol execution, dynamically extracted values are stored in the template context and can be used across all protocols. Example:How Multi Protocol Works?
At this point we have seen how multi protocol templates look like and what are the features it brings to the table. Now let’s see how multi protocol templates work and things to keep in mind while writing them.- Multi Protocol Templates are executed in order of protocols defined in template.
- Protocols in multi protocol templates are executed in serial i.e one after another.
- Response fields of protocols are exported to template context as soon as that protocol is executed.
- Variables are scoped at template level and evaluated after each protocol execution.
- Multi protocol brings limited indirect support for preprocessing(using variables) and postprocessing(using dynamic extractors) for protocols.
FAQ
What Protocols are supported in Multi-Protocol Execution Mode?There is no restriction around any protocol and any protocol available/implemented in nuclei engine can be used in multi protocol templatesHow many protocols can be used in Multi-Protocol Execution Mode?
There is no restriction around number of protocols but currently duplicated protocols are not supported i.e dns -> http -> ssl -> http. Please open a issue if you have a vulnerabilty/usecase that requires duplicated protocolsWhat happens if a protocol fails?
Multi Protocol Execution follows exit on error policy i.e if protocol fails to execute then execution of remaining protocols is skipped and template execution is stoppedHow is multi protocol execution different from workflows?
Workflow as name suggest is a workflow that executes templates based on workflow fileTo summarize workflow is a step higher than template and manages execution of templates based on workflow file Is multi protocol execution supported in nuclei v2?
- Workflow does not contain actual logic of vulnerability but just a workflow that executes different templates
- Workflow supports conditional execution of multiple templates
- Workflow has limited supported for variables and dynamic extractors
No, Multi Protocol Execution is only supported in nuclei v3 and above