[Nuclei](https://github.com/projectdiscovery/nuclei) is an open-source, fast, and customizable vulnerability scanner developed by [ProjectDiscovery](https://github.com/projectdiscovery/). It is designed to send requests across targets based on predefined templates, enabling efficient and accurate vulnerability detection with minimal false positives. [Nuclei](https://github.com/projectdiscovery/nuclei) supports scanning for various protocols, including TCP, DNS, HTTP, SSL, File, Whois, and Websocket.
Nuclei templates are YAML files that define the scanning logic. Here's a basic structure of a Nuclei template:
```yaml
id: example-template
info:
name: Example Vulnerability Check
author: YourName
severity: medium
description: Checks for an example vulnerability
requests:
- method: GET
path:
- "{{BaseURL}}/vulnerable-endpoint"
matchers:
- type: word
words:
- "vulnerable string"
```
Key components of a template:
1.`id`: Unique identifier for the template
2.`info`: Metadata about the template
3.`requests`: Defines the HTTP requests to be made
4.`matchers`: Specifies conditions to identify vulnerabilities
### Example: CVE Detection Template
Here's an example template for detecting CVE-2021-44228 (Log4j vulnerability):
```yaml
id: CVE-2021-44228
info:
name: Apache Log4j RCE
author: pdteam
severity: critical
description: Apache Log4j2 <=2.14.1 JNDI features used in configuration, log messages, and parameters do not protect against attacker-controlled LDAP and other JNDI related endpoints.
This template sends requests with JNDI lookup strings in various HTTP headers and checks for DNS or HTTP callbacks to detect the Log4j vulnerability[8].
## Best Practices for Template Creation
1. Use clear and descriptive template IDs and names
2. Include accurate metadata (author, severity, description)
3. Utilize dynamic variables like `{{BaseURL}}` for flexibility
4. Implement precise matchers to reduce false positives