.git/config files.
What you’ll build
By the end of this tutorial, you’ll have created a template that:- Sends an HTTP GET request to check for
.git/config - Validates the response contains Git configuration markers
- Reports findings with appropriate severity
- Includes proper metadata for sharing
Prerequisites
Step 1: Define template ID
Opengit-config-exposure.yaml in your editor and start with a unique identifier:
Step 2: Add metadata
Add theinfo block with descriptive metadata:
A clear, concise description that explains what the template detects
Your GitHub username or name
Risk level:
info, low, medium, high, or criticalStep 3: Add HTTP request
Define what request to send:{{BaseURL}} is a built-in variable that contains the full target URL (e.g., https://example.com).Step 4: Add matchers
Define what constitutes a positive detection:- Word matcher
- Status matcher
- Condition
Searches for the
[core] string that appears in Git config files:Step 5: Validate template
Check your template for syntax errors:Step 6: Test the template
Test against a vulnerable target
First, let’s set up a test server with an exposed Git config:Test against safe target
Step 7: Enhance the template
Let’s improve the template with additional features:Add negative matcher
Avoid false positives by ensuring the response isn’t HTML:negative: true inverts the match - it succeeds when the words are not found.Add extractor
Extract the repository URL if present:Complete template
Here’s the final, production-ready template:git-config-exposure.yaml
Running your template
Single target
Multiple targets
With output
Common issues and solutions
Template not matching when it should
Template not matching when it should
Problem: The template doesn’t detect vulnerable targets.Solutions:
- Test matchers individually by removing
matchers-condition - Use
-debugflag to see full responses - Check if response is being truncated (adjust
max-size) - Verify matcher
partis correct (default isbody)
Too many false positives
Too many false positives
Problem: Template matches non-vulnerable targets.Solutions:
- Add negative matchers to exclude common false positives
- Use
matchers-condition: andfor stricter matching - Add status code validation
- Check content-type headers
Validation errors
Validation errors
Problem:
nuclei -validate shows errors.Solutions:- Check YAML indentation (2 spaces, no tabs)
- Ensure all strings with special chars are quoted
- Verify all required fields are present
- Use YAML linter for syntax checking
Best practices learned
✓ Use descriptive template IDs✓ Include detailed metadata (description, references)✓ Combine multiple matchers with
and for accuracy✓ Use negative matchers to reduce false positives✓ Add extractors for useful information✓ Validate before testing✓ Test against both vulnerable and safe targetsNext steps
Template structure
Learn about all template components in detail
HTTP protocol
Explore advanced HTTP features
Matchers reference
Master all matcher types
Best practices
Write production-quality templates