Skip to main content

How to Run Nuclei

Nuclei templates offer two primary execution methods:

Supported Input Formats

For automation in pipelines, see Running Nuclei in CI/CD. Nuclei supports various input formats to run template against, including urls, hosts, ips, cidrs, asn, openapi, swagger, proxify, burpsuite exported data and more. To learn more on using input specify options, you can refer nuclei input formats. These inputs can be given to nuclei using -l and -input-mode flags.
Executing nuclei against a list of inputs (urls, hosts, ips, cidrs, asn) is as simple as running the following command:
For running other input formats (burp, jsonl, yaml, openapi, swagger), you can use the -im flag to specify the input mode.
and so on.

Executing Nuclei Templates

-t/templates Default Templates Most community templates from our nuclei-template repository are executed by default, directly from the standard installation path. The typical command is as follows:
However, there are some exceptions regarding the templates that run by default: You can also run templates against a list of URLs:
Custom Templates To run a custom template directory or multiple directories, use the following command structure:
Templates from custom GitHub repositories, stored under the github directory, can be executed with this command:
You can also directly run a template from any ProjectDiscovery Cloud Platform URL like this:

Executing Template Workflows

-w/workflows Workflows can be executed using the following command:
Similarly, Workflows can be executed against a list of URLs.

Types of Templates

Template Filters

Nuclei engine supports three basic filters to customize template execution.
  1. Tags (-tags) Filter based on tags field available in the template.
  2. Severity (-severity) Filter based on severity field available in the template.
  3. Author (-author) Filter based on author field available in the template.
By default, filters apply to templates below the active template root. Use a template path to limit the scan to another location. For example, the following command runs templates from the active template root that have the cve tag.
This example limits the scan to the exposures/ directory below the active template root and selects templates with the config tag.
Multiple filters works together with AND condition, below example runs all templates with cve tags AND has critical OR high severity AND geeknik as author of template.

Advanced Filters

Multiple filters can also be combined using the template condition flag (-tc) that allows complex expressions like the following ones:
The supported fields are:
  • id string
  • name string
  • description string
  • tags slice of strings
  • authors slice of strings
  • severity string
  • protocol string
  • http_method slice of strings
  • body string (containing all request bodies if any)
  • matcher_type slice of string
  • extractor_type slice of string
  • description string
Also, every key-value pair from the template metadata section is accessible. All fields can be combined with logical operators (|| and &&) and used with DSL helper functions. Similarly, all filters are supported in workflows as well.
WorkflowsIn Workflows, Nuclei filters are applied on templates or sub-templates running via workflows, not on the workflows itself.

Public Templates

Nuclei has built-in support for automatic template download/update from nuclei templates project which provides community-contributed list of ready-to-use templates that is constantly updated. Nuclei checks for new community template releases upon each execution and automatically downloads the latest version when available. optionally, this feature can be disabled using the -duc cli flag or the configuration file.

Template storage and discovery

Nuclei selects the active public template root in this order:
  1. The final -update-template-dir value after configuration and CLI precedence are applied.
  2. NUCLEI_TEMPLATES_DIR.
  3. A previously persisted template path, including one migrated from legacy state.
  4. The XDG default selection.
If no explicit or persisted path is available, Nuclei checks the XDG locations in this order:
  1. An existing $XDG_DATA_HOME/nuclei/nuclei-templates directory.
  2. The first existing $XDG_DATA_DIRS/nuclei/nuclei-templates directory, using the listed XDG preference order.
  3. $XDG_DATA_HOME/nuclei/nuclei-templates as the installation target when no existing root is found.
A root discovered through XDG_DATA_DIRS behaves like any other active template root. Nuclei can install, update, regenerate metadata, and reset it when filesystem permissions allow. The XDG location controls discovery order only; it does not establish ownership. Template installations and updates place .nuclei-ignore in the active root. If the active file is missing, Nuclei logs a warning and continues without its default ignore exclusions. If the file exists but cannot be opened or parsed, Nuclei stops before template execution and reports the active path and underlying error. Repair or restore the file before running Nuclei again.

Custom Templates

Users can create custom templates on a personal public / private GitHub / AWS Bucket that they wish to run / update while using nuclei from any environment without manually downloading the GitHub repository everywhere. To use this feature, users need to set the following environment variables:
Environment variables can also be provided to disable download from default and custom template locations:
After setting the environment variables, run the following command to download the custom templates:
Nuclei stores downloaded provider templates below the active public template root. The directory structure of the custom templates looks as follows:
Users can then use the custom templates with the -t flag as follows:
The nuclei engine can be updated to latest version by using the -update flag.
Writing your own unique templates will always keep you one step ahead of others.

AI-Powered Template Generation

-ai Nuclei supports generating and running templates on-the-fly using AI capabilities powered by the ProjectDiscovery API. This feature allows you to perform quick, targeted scans without needing pre-written templates by describing what you want to detect in natural language. Prerequisites:
  1. A ProjectDiscovery API key (Get one at cloud.projectdiscovery.io)
  2. Configure your API key using one of these methods: Method 1: Using CLI (Recommended)
    Method 2: Environment Variable
Basic Usage:
  1. Finding Sensitive Information Leaks:
  1. Detecting Debug Information:
  1. Discovering Admin Interfaces:
  1. Identifying Exposed Secrets:
  1. Extract Page Titles
The -ai flag requires an active internet connection to communicate with the ProjectDiscovery API. Generated templates are stored both locally on your computer and in your ProjectDiscovery cloud account for future reference. For privacy, your prompts and generated templates are not used for AI training.Currently, each user is limited to 100 AI template generation queries per day. This limit is subject to change based on usage patterns and to prevent abuse.

Nuclei Flags

This will display help for the tool. Here are all the switches it supports.
From Nuclei v3.0.0 -metrics port has been removed and merged with -stats when using -stats flag metrics will be by default available at localhost:9092/metrics and metrics-port can be configured by -metrics-port flag

Rate Limits

Nuclei have multiple rate limit controls for multiple factors, including a number of templates to execute in parallel, a number of hosts to be scanned in parallel for each template, and the global number of request / per second you wanted to make/limit using nuclei, here is an example of each flag with description. Feel free to play with these flags to tune your nuclei scan speed and accuracy. For more details on tuning these flag, you can refer mass-scanning-cli
rate-limit flag takes precedence over the other two flags, the number of requests/seconds can’t go beyond the value defined for rate-limit flag regardless the value of c and bulk-size flag.

Traffic Tagging

Many bug bounty programs require you to identify your HTTP traffic. Set a custom header in $XDG_CONFIG_HOME/nuclei/config.yaml, in $NUCLEI_CONFIG_DIR/config.yaml, or with the -H / header CLI flag.
Setting custom header using config file
Setting custom header using CLI flag

Template Exclusion

Nuclei supports a variety of methods for excluding / blocking templates from execution. By default, nuclei excludes the tags/templates listed below from execution to avoid unexpected fuzz based scans and some that are not supposed to run for mass scan, and these can be easily overwritten with nuclei configuration file / flags. Nuclei engine supports two ways to manually exclude templates from scan,
  1. Exclude Templates (-exclude-templates/exclude) exclude-templates flag is used to exclude single or multiple templates and directory, multiple -exclude-templates flag can be used to provide multiple values.
  2. Exclude Tags (-exclude-tags/etags) exclude-tags flag is used to exclude templates based in defined tags, single or multiple can be used to exclude templates.
Example of excluding single template
Example of multiple template exclusion
Example of excluding templates with single tag
Example of excluding templates with multiple tags
  • The .nuclei-ignore file in the active template root lists the tags and templates excluded by default.
Do not modify the active .nuclei-ignore file. Nuclei can replace it during a template update. To override the denylist, use Nuclei configuration or the include flags.
To prioritize certain templates or tags over the .nuclei-ignore file or denylist, you must use the -include-templates or -include-tags flags. This will ensure that the specified templates or tags take precedence over any .nuclei-ignore or denylist entries.
Example of running blocked templates
Example of executing a specific template that is in the denylistSay that you have custom templates globbed (*) in the denylist on the Nuclei configuration file.
But you just want to execute a specific template.

List Template Path

-tl option in Nuclei is used to list the paths of templates, rather than executing them. This can help you inspect which templates would be used for scan given your current template filter.

Scan on internet database

Nuclei supports integration with uncover module that supports services like Shodan, Censys, Hunter, Zoomeye, many more to execute Nuclei on these databases. Here are uncover options to use -
You need to set the API key of the engine you are using as an environment variable in your shell.
Required API keys can be obtained by signing up on following platform Shodan, Censys, Fofa, Quake, Hunter and ZoomEye . Example of template execution using a search query.
It can also read queries from templates metadata and execute template against hosts returned by uncover for that query. Example of template execution using template-defined search queries. Template snippet of CVE-2021-26855
We can update the nuclei configuration file to include these tags for all scans.

Nuclei Config

Nuclei loads configuration from the standard XDG locations:
  • Each $XDG_CONFIG_DIRS/nuclei/config.yaml file is an optional, read-only system configuration. Nuclei loads the directories in reverse order so earlier entries in XDG_CONFIG_DIRS have higher priority.
  • On Unix, /etc/nuclei/config.yaml is an optional local system override. It has higher priority than every XDG_CONFIG_DIRS file and lower priority than the user configuration.
  • $XDG_CONFIG_HOME/nuclei/config.yaml is the writable user configuration. If the XDG variables are not set, Nuclei uses the platform defaults, such as /etc/xdg and $HOME/.config on Linux.
Set NUCLEI_CONFIG_DIR to use $NUCLEI_CONFIG_DIR/config.yaml instead of the XDG user configuration. When that file is missing, Nuclei copies the XDG user configuration if one exists. Otherwise, it generates a new file with the built-in options commented out. Generated user files never include values from system configuration. If the active user path also appears in XDG_CONFIG_DIRS, Nuclei loads it only once, as the writable user configuration. Nuclei applies configuration sources from lowest to highest priority: A higher-priority file replaces collections from lower-priority files rather than appending to them. Use an empty list ([]) to clear a collection. An explicit CLI flag always wins, even when its value matches the built-in default. Configuration files can select a config or profile path, and higher-priority sources can change that selection. A selected config cannot redirect to another config. A selected profile cannot redirect to another config or profile. If Nuclei cannot read or parse an automatic system or user configuration, it prints a warning and ignores all automatic layers. It still applies any config file, profile, and CLI values selected explicitly on the command line. An error in any selected config or profile stops startup. Immediate actions such as reset, version, and templates-version are CLI-only. The auth setting is also accepted only from the command line. Equivalent YAML keys do not run these actions. Update settings such as update, update-templates, update-template-dir, and disable-update-check continue to work in configuration files.

Template profiles

The profile setting accepts a file path or an extensionless community profile ID. For a relative YAML file path, Nuclei checks the current directory first and then profiles/ in the active template root. For a profile ID, it searches that profile directory and its subdirectories for a matching YAML file. A profile can provide targets through a multiline targets-inline value. A multiline list value also becomes inline targets, while a single-line list value remains a file path. Nuclei trims each target and ignores blank lines and lines that start with #. Profiles can include a secrets section. Nuclei creates a private temporary directory and writes the secrets to a file with mode 0600 for the scan. It removes the directory after normal exit, interruption, or a fatal error.

Storage locations

Nuclei keeps configuration, installed data, persistent state, and regenerable cache in separate directories: NUCLEI_CONFIG_DIR remains a compatibility override for the user configuration directory, including config.yaml, signing keys, and reporting configuration. It does not change the XDG data, state, or cache locations. Nuclei stores the active template path and version metadata in $XDG_STATE_HOME/nuclei/templates.json with file mode 0600. On startup, it reads this file first. If the file does not exist, Nuclei reads the legacy .templates-config.json, writes templates.json atomically, and leaves the legacy file in place for compatibility. If templates.json exists but cannot be read or parsed, Nuclei reports an error instead of falling back to the legacy file. Generated resume-*.cfg and crash-resume-file-*.dump files are stored under $XDG_STATE_HOME/nuclei. Nuclei uses an explicit -resume path unchanged. The catalog index is stored under $XDG_CACHE_HOME/nuclei. The -health-check output reports the config, state, and cache directories separately. It checks configuration initialization and read/write access for config.yaml, templates.json, the active .nuclei-ignore, and the active template checksum. The -reset command validates every deletion target before removing the configuration, state, cache, and active template root. Here is an example config file:
Once configured, the active user configuration is used by default. Use -config to add one higher-priority config file for a command.
Running nuclei with custom config file

Nuclei Result Dashboard

Nuclei now allows seamless integration with the ProjectDiscovery Cloud Platform to simplify the visualization of Nuclei results and generate swift reports. This highly requested feature from the community enables easier handling of scan results with minimal effort. Follow the steps below to set up your PDCP Result Dashboard:
  1. Visit https://cloud.projectdiscovery.io to create free PDCP API key.
  1. Use the nuclei -auth command, enter your API key when prompted.
  2. To perform a scan and upload the results straight to the cloud, use the -cloud-upload option while running a nuclei scan.
An example command might look like this:
And the output would be like this:
After the scan, a URL will be displayed on the command line interface. Visit this URL to check your results on the Cloud Dashboard.

Advanced Integration Options

Setting API key via environment variable Avoid entering your API key via interactive prompt by setting it via environment variable.
Enabling result upload by default If you want all your scans to automatically upload results to the cloud, enable the ENABLE_CLOUD_UPLOAD environment variable.
Disabling cloud upload warnings To suppress warnings about result uploads, disable the DISABLE_CLOUD_UPLOAD_WRN environment variable.
Your configured PDCP API key stored in $HOME/.pdcp/credentials.yaml
Nuclei OSS results uploaded to the cloud platform are scheduled for automatic cleanup after 30 days, although this duration is subject to change as we gauge user feedback and requirement.

Nuclei Reporting

Nuclei comes with reporting module support with the release of v2.3.0 supporting GitHub, GitLab, and Jira integration, this allows nuclei engine to create automatic tickets on the supported platform based on found results. -rc, -report-config flag can be used to provide a config file to read configuration details of the platform to integrate. Here is an example config file for all supported platforms. For example, to create tickets on GitHub, create a config file with the following content and replace the appropriate values:
Alternatively if you use GitLab, create a config file following content and replace the appropriate values:
To store results in Elasticsearch, create a config file with the following content and replace the appropriate values:
To forward results to Splunk HEC, create a config file with the following content and replace the appropriate values:
To forward results to Jira, create a config file with the following content and replace the appropriate values: The Jira reporting options allows for custom fields, as well as using variables from the Nuclei templates in those custom fields. The supported variables currently are: $CVSSMetrics, $CVEID, $CWEID, $Host, $Severity, $CVSSScore, $Name In addition, Jira is strict when it comes to custom field entry. If the field is a dropdown, Jira accepts only the case sensitive specific string and the API call is slightly different. To support this, there are three types of customfields.
  • name is the dropdown value
  • id is the ID value of the dropdown
  • freeform is if the customfield the entry of any value
To avoid duplication, the JQL query run can be slightly modified by the config file. The CLOSED_STATUS can be changed in the Jira template file using the status-not variable. summary ~ TEMPLATE_NAME AND summary ~ HOSTNAME AND status != CLOSED_STATUS
To write results to a MongoDB database collection, update the config file with the connection information.
Running nuclei with reporting module:
Similarly, other platforms can be configured. Reporting module also supports basic filtering and duplicate checks to avoid duplicate ticket creation.
This will ensure to only creating tickets for issues identified with high and critical severity; similarly, deny-list can be used to exclude issues with a specific severity. If you are running periodic scans on the same assets, you might want to consider -rdb, -report-db flag that creates a local copy of the valid findings in the given directory utilized by reporting module to compare and create tickets for unique issues only.
Markdown Export Nuclei supports markdown export of valid findings with -me, -markdown-export flag, this flag takes directory as input to store markdown formatted reports. Including request/response in the markdown report is optional, and included when -irr, -include-rr flag is used along with -me.
SARIF Export Nuclei supports SARIF export of valid findings with -se, -sarif-export flag. This flag takes a file as input to store SARIF formatted report.
It is also possible to visualize Nuclei results using SARIF files.
  1. By uploading a SARIF file to SARIF Viewer
  2. By uploading a SARIF file to Github Actions
More info on the SARIF output is documented here.
These are not official viewers of Nuclei and Nuclei has no liability towards any of these options to visualize Nuclei results. These are just some publicly available options to visualize SARIF files.

Scan Metrics

Nuclei expose running scan metrics on a local port 9092 when -metrics flag is used and can be accessed at localhost:9092/metrics, default port to expose scan information is configurable using -metrics-port flag. Here is an example to query metrics while running nuclei as following nuclei -t cves/ -l urls.txt -metrics

Passive Scan

Nuclei engine supports passive mode scanning for HTTP based template utilizing file support, with this support we can run HTTP based templates against locally stored HTTP response data collected from any other tool.
Passive mode support is limited for templates having {{BasedURL}} or {{BasedURL/}} as base path.

Running With Docker

If Nuclei was installed within a Docker container based on the installation instructions, the executable does not have the context of the host machine. This means that the executable will not be able to access local files such as those used for input lists or templates. To resolve this, the container should be run with volumes mapped to the local filesystem to allow access to these files.

Basic Usage

This example runs a Nuclei container against google.com, prints the results to JSON and removes the container once it has completed:

Using Volumes

This example runs a Nuclei container against a list of URLs, writes the results to a .jsonl file and removes the container once it has completed.