Nuclei templates are YAML-based files that define detection logic for security vulnerabilities, misconfigurations, and exposures. Each template is a self-contained unit that specifies what to check and how to identify issues.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/projectdiscovery/nuclei/llms.txt
Use this file to discover all available pages before exploring further.
Template structure
Every Nuclei template follows a standardized structure with three main sections:Required fields
Template ID
Theid field uniquely identifies each template. It must match the pattern ^([a-zA-Z0-9]+[-_])*[a-zA-Z0-9]+$.
A good ID uniquely identifies what the template detects. For example,
git-config-exposure or CVE-2021-19520.Info block
Theinfo section contains metadata about the template:
Protocol requests
Templates can include one or more protocol-specific request sections. Each protocol has its own syntax and capabilities.HTTP requests
http/get-headers.yaml
DNS requests
dns/a.yaml
Network (TCP) requests
network/basic.yaml
Variables and constants
Templates support dynamic values through variables and constants.Variables
Variables are evaluated at runtime and can use DSL functions:Constants
Constants are static values defined once:Template options
Self-contained templates
Self-contained templates don’t require external input and can run independently:Stop at first match
Control execution flow when a match is found:When
stop-at-first-match: true, the template stops executing as soon as any matcher succeeds.Multi-protocol templates
Templates can combine multiple protocols in a single file. The order of execution is preserved:Template validation
Templates are validated during parsing:- Valid template
- Invalid template
Helper variables
Nuclei provides built-in variables for common use cases:| Variable | Description | Example |
|---|---|---|
{{BaseURL}} | Complete base URL | https://example.com |
{{Hostname}} | Target hostname | example.com |
{{Host}} | Hostname with port | example.com:443 |
{{Port}} | Target port | 443 |
{{Scheme}} | URL scheme | https |
{{FQDN}} | Fully qualified domain name | api.example.com |
{{RootURL}} | Root URL without path | https://example.com |
{{Path}} | URL path | /api/v1/users |
Best practices
Use descriptive IDs
Choose IDs that clearly describe what the template detects:
apache-rce-cve-2021-41773 instead of template-001Add metadata
Include comprehensive info block with severity, references, and classification details
Test thoroughly
Validate templates against test targets to ensure zero false positives
Keep it simple
Start with simple detection logic and add complexity only when needed
Related topics
Workflows
Learn about multi-step template execution
Protocols
Explore all supported protocols
Operators
Understand matchers and extractors