Skip to content

Index

Nuclei Features

Features.

  • HTTP | DNS | TCP | FILE support
  • Fully configurable templates.
  • Large scale scanning.
  • Out of band based detection.
  • Easily write your own templates.

Nuclei Installation

GO111MODULE=on go get -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei

Info

Nuclei require latest GO version to install successfully.

brew install nuclei

Info

Supported in macOS (or Linux)

docker pull projectdiscovery/nuclei:latest
git clone https://github.com/projectdiscovery/nuclei.git; \
cd nuclei/v2/cmd/nuclei; \
go build; \
mv nuclei /usr/local/bin/; \
nuclei -version;

Info

Nuclei require the latest GO version to install successfully.

https://github.com/projectdiscovery/nuclei/releases

Tip

  • Download the latest binary for your OS.
  • Unzip the ready to run binary.

Nuclei Templates

Nuclei has had built-in support for automatic update/download templates since version v2.4.0. Nuclei-Templates project provides a community-contributed list of ready-to-use templates that is constantly updated.

You may still use the update-templates flag to update the nuclei templates at any time; automatic updates happen every 24 hours.

Tip

Writing your own unique templates will always keep you one step ahead of others.

Nuclei Usage

nuclei -h

This will display help for the tool. Here are all the switches it supports.

nuclei -h
Nuclei is a fast, template based vulnerability scanner focusing
on extensive configurability, massive extensibility and ease of use.

Usage:
  ./nuclei [flags]

Flags:
TARGET:
   -u, -target string[]  target URLs/hosts to scan
   -l, -list string      path to file containing a list of target URLs/hosts to scan (one per line)

TEMPLATES:
   -tl                      list all available templates
   -t, -templates string[]  template or template directory paths to include in the scan
   -w, -workflows string[]  list of workflows to run
   -nt, -new-templates      run newly added templates only
   -validate                validate the passed templates to nuclei

FILTERING:
   -tags string[]                         execute a subset of templates that contain the provided tags
   -include-tags string[]                 tags from the default deny list that permit executing more intrusive templates
   -etags, -exclude-tags string[]         exclude templates with the provided tags
   -include-templates string[]            templates to be executed even if they are excluded either by default or configuration
   -exclude-templates, -exclude string[]  template or template directory paths to exclude
   -severity, -impact string[]            execute templates that match the provided severities only
   -author string[]                       execute templates that are (co-)created by the specified authors

OUTPUT:
   -o, -output string            output file to write found issues/vulnerabilities
   -silent                       display findings only
   -v, -verbose                  show verbose output
   -vv                           display extra verbose information
   -nc, -no-color                disable output content coloring (ANSI escape codes)
   -json                         write output in JSONL(ines) format
   -irr, -include-rr             include request/response pairs in the JSONL output (for findings only)
   -nm, -no-meta                 don't display match metadata
   -rdb, -report-db string       local nuclei reporting database (always use this to persist report data)
   -me, -markdown-export string  directory to export results in markdown format
   -se, -sarif-export string     file to export results in SARIF format

CONFIGURATIONS:
   -config string              path to the nuclei configuration file
   -rc, -report-config string  nuclei reporting module configuration file
   -H, -header string[]        custom headers in header:value format
   -V, -var value              custom vars in var=value format
   -r, -resolvers string       file containing resolver list for nuclei
   -system-resolvers           use system DNS resolving as error fallback
   -passive                    enable passive HTTP response processing mode
   -env-vars                   Enable environment variables support

INTERACTSH:
   -no-interactsh                     do not use interactsh server for blind interaction polling
   -interactsh-url string             self-hosted Interactsh Server URL (default "https://interact.sh")
   -interactions-cache-size int       number of requests to keep in the interactions cache (default 5000)
   -interactions-eviction int         number of seconds to wait before evicting requests from cache (default 60)
   -interactions-poll-duration int    number of seconds to wait before each interaction poll request (default 5)
   -interactions-cooldown-period int  extra time for interaction polling before exiting (default 5)

RATE-LIMIT:
   -rl, -rate-limit int          maximum number of requests to send per second (default 150)
   -rlm, -rate-limit-minute int  maximum number of requests to send per minute
   -bs, -bulk-size int           maximum number of hosts to be analyzed in parallel per template (default 25)
   -c, -concurrency int          maximum number of templates to be executed in parallel (default 10)

OPTIMIZATIONS:
   -timeout int               time to wait in seconds before timeout (default 5)
   -retries int               number of times to retry a failed request (default 1)
   -project                   use a project folder to avoid sending same request multiple times
   -project-path string       set a specific project path
   -spm, -stop-at-first-path  stop processing HTTP requests after the first match (may break template/workflow logic)

HEADLESS:
   -headless          enable templates that require headless browser support
   -page-timeout int  seconds to wait for each page in headless mode (default 20)
   -show-browser      show the browser on the screen when running templates with headless mode

DEBUG:
   -debug                     show all requests and responses
   -debug-req                 show all sent requests
   -debug-resp                show all received responses
   -proxy, -proxy-url string  URL of the HTTP proxy server
   -proxy-socks-url string    URL of the SOCKS proxy server
   -trace-log string          file to write sent requests trace log
   -version                   show nuclei version
   -tv, -templates-version    shows the version of the installed nuclei-templates

UPDATE:
   -update                        update nuclei to the latest released version
   -ut, -update-templates         update the community templates to latest released version
   -nut, -no-update-templates     Do not check for nuclei-templates updates
   -ud, -update-directory string  overwrite the default nuclei-templates directory (default "$HOME/nuclei-templates")

STATISTICS:
   -stats                    display statistics about the running scan
   -stats-json               write statistics data to an output file in JSONL(ines) format
   -si, -stats-interval int  number of seconds to wait between showing a statistics update (default 5)
   -metrics                  expose nuclei metrics on a port
   -metrics-port int         port to expose nuclei metrics on (default 9092)

Running Nuclei

Nuclei templates can be primarily executed in two ways,

1) Templates (-t/templates)

As default, all the templates (except nuclei-ignore list) gets executed from default template installation path.

nuclei -u https://example.com

Custom template directory or multiple template directory can be executed as follows,

nuclei -u https://example.com -t cves/ -t exposures/

Similarly, Templates can be executed against list of URLs.

nuclei -list http_urls.txt

2) Workflows (-w/workflows)

nuclei -u https://example.com -w workflows/

Similarly, Workflows can be executed against list of URLs.

nuclei -list http_urls.txt -w workflows/wordpress-workflow.yaml

Nuclei 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.

As default, Filters are applied on installed path of templates and can be customized with manual template path input.

For example, below command will run all the templates installed at ~/nuclei-templates/ directory and has cve tags in it.

nuclei -u https://example.com -tags cve

And this example will run all the templates available under ~/nuclei-templates/exposures/ directory and has config tag in it.

nuclei -u https://example.com -tags config -t exposures/

Multiple filters works together with AND condition, below example runs all template with cve tags AND has critical OR high severity AND geeknik as author of template.

nuclei -u https://example.com -tags cve -severity critical,high -author geeknik

Similarly, all filters are supported in workflows as well.

nuclei -w workflows/wordpress-workflow.yaml -severity critical,high -list http_urls.txt

Workflows

In Workflows, Nuclei filters are applied on templates or sub-templates running via workflows, not on the workflows itself.

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.

Flag Description
rate-limit Control the total number of request to send per seconds
bulk-size Control the number of hosts to process in parallel for each template
c Control the number of templates to process in parallel

Feel free to play with these flags to tune your nuclei scan speed and accuracy.

Tip

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 BugBounty platform/programs requires you to identify the HTTP traffic you make, this can be achieved by setting custom header using config file at $HOME/.config/nuclei/config.yaml or CLI flag -H / header

Setting custom header using config file

# Headers to include with each request.
header:
  - 'X-BugBounty-Hacker: h1/geekboy'
  - 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) / nuclei'

Setting custom header using CLI flag

nuclei -header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) / nuclei' -list urls.txt -tags cves

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-ignore file is not supposed to be updated / edited / removed by user, to overwrite default ignore list, utilize nuclei configuration file.

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

nuclei -list urls.txt -t cves/ -exclude-templates cves/2020/CVE-2020-XXXX.yaml

Example of multiple template exclusion

nuclei -list urls.txt -exclude-templates exposed-panels/ -exclude-templates technologies/

Example of excluding templates with single tag

nuclei -l urls.txt -t cves/ -etags xss

Example of excluding templates with multiple tags

nuclei -l urls.txt -t cves/ -etags sqli,rce

To easily overwrite nuclei-ignore, Nuclei engine supports include-tags / include-templates flag.

Example of running blocked templates

nuclei -l urls.txt -include-tags iot,misc,fuzz

We can update the nuclei configuration file to include these tags for all scans.

Nuclei Config

Since release of v.2.3.2 nuclei uses goflags for clean CLI experience and long/short formatted flags.

goflags comes with auto-generated config file support that coverts all available CLI flags into config file, basically you can define all CLI flags into config file to avoid repetitive CLI flags that loads as default for every scan of nuclei.

Default path of nuclei config file is $HOME/.config/nuclei/config.yaml, uncomment and configure the flags you wish to run as default.

Here is an example config file:-

# Headers to include with all HTTP request
header:
  - 'X-BugBounty-Hacker: h1/geekboy'

# Directory based template execution
templates:
  - cves/
  - vulnerabilities/
  - misconfiguration/

# Tags based template execution
tags: exposures,cve

# Templates Filters
tags: exposures,cve
author: geeknik,pikpikcu,dhiyaneshdk
severity: critical,high,medium

# Template Allowlist
include-tags: dos,fuzz # Tag based inclusion (allows to overwrite nuclei-ignore list)
include-templates: # Template based inclusion (allows to overwrite nuclei-ignore list)
  - vulnerabilities/xxx
  - misconfiguration/xxxx

# Template Denylist
exclude-tags: info # Tag based exclusion
exclude-templates: # Template based exclusion
  - vulnerabilities/xxx
  - misconfiguration/xxxx

# Rate Limit configuration
rate-limit: 500
bulk-size: 50
concurrency: 50

Once configured, config file be used as default, additionally custom config file can be also provided using -config flag.

Running nuclei with custom config file

nuclei -config project.yaml -list urls.txt

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.

Platform GitHub GitLab Jira Markdown
Support

-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:-

# Github contains configuration options for GitHub issue tracker

github: 
  username: "$user"
  owner: "$user"
  token: "$token"
  project-name: "testing-project"
  issue-label: "Nuclei"

Running nuclei with reporting module:-

nuclei -l urls.txt -t cves/ -rc issue-tracker.yaml

Similarly, other platforms can be configured. Reporting module also supports basic filtering and duplicate checks to avoid duplicate ticket creation.

allow-list:
  severity: high,critical

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.

nuclei -l urls.txt -t cves/ -rc issue-tracker.yaml -rdb prod

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.

nuclei -l urls.txt -t cves/ -irr -markdown-export reports

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 exposes 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

curl -s localhost:9092/metrics | jq .
{
  "duration": "0:00:03",
  "errors": "2",
  "hosts": "1",
  "matched": "0",
  "percent": "99",
  "requests": "350",
  "rps": "132",
  "startedAt": "2021-03-27T18:02:18.886745+05:30",
  "templates": "256",
  "total": "352"
}

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.

nuclei -passive -target http_data

Passive mode support is limited for templates having {{BasedURL}} or {{BasedURL/}} as base path.

Code Contribution

Nuclei templates are the base of the nuclei project. We appreciate it if you can write and submit new templates to keep this project alive, and one of the reasons to keep us motivated to keep working on this project.

License

Nuclei is distributed under MIT License.