Nuclei templates use YAML (Yet Another Markup Language) for defining vulnerability checks. This page covers the syntax fundamentals and conventions used in template development.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.
YAML basics
Structure
YAML uses indentation (spaces, not tabs) to define structure:Data types
Strings
Numbers and booleans
Lists
Maps/dictionaries
Template structure
Required fields
Every template must include:Unique identifier for the template. Use lowercase with hyphens.
Metadata block describing the template.
One or more protocol request definitions (http, dns, tcp, etc.).
Info block fields
Theinfo section contains template metadata:
- Severity levels
- info: Informational findings, no direct security impact
- low: Minor security issues with limited impact
- medium: Moderate vulnerabilities requiring attention
- high: Serious vulnerabilities with significant risk
- critical: Severe vulnerabilities requiring immediate action
Template variables
Nuclei provides built-in variables for dynamic values:Global variables
Complete base URL including protocol (e.g.,
https://example.com)Hostname or IP address (e.g.,
example.com)Hostname with port if non-standard (e.g.,
example.com:8080)Port number (e.g.,
443)URL scheme (e.g.,
https)Root URL without path (e.g.,
https://example.com)Fully qualified domain name (for DNS templates)
Usage example
Comments
Use# for comments:
Special characters
Escaping
When strings contain special YAML characters, use quotes:Multi-line strings
- Literal (|)
- Folded (>)
Preserves line breaks:
Naming conventions
Template IDs
Rules for template IDs:- Use lowercase letters
- Separate words with hyphens
- Be descriptive but concise
- Include CVE ID if applicable:
CVE-2021-1234 - Use technology name:
apache-,nginx-,wordpress-
Field names
Nuclei uses kebab-case for field names:Validation
Validate your template syntax before use:The validator checks:
- YAML syntax correctness
- Required fields presence
- Field type matching
- Matcher and extractor logic
- Protocol-specific requirements
Common syntax errors
Indentation errors
Indentation errors
Missing quotes
Missing quotes
Incorrect list syntax
Incorrect list syntax
Editor support
VS Code
- YAML extension by Red Hat
- Nuclei Template Snippets extension
- Configure tab-to-spaces conversion
JetBrains IDEs
- Built-in YAML support
- File > Settings > Editor > Code Style > YAML
- Set indent to 2 spaces
Next steps
Write your first template
Follow step-by-step guide to create a working template
Template structure
Deep dive into template components