-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nuclei v3 bug fixes #4176
nuclei v3 bug fixes #4176
Conversation
example multiprotocol templateid: multi-proto-example-code
info:
name: multi-proto-example-code
author: pdteam
severity: info
description: |
multi protocol example using code and http protocol
code:
- engine:
- sh
- bash
source: |
echo "hello from code" | base64
http:
- raw:
- |
GET /?param={{code_response}} HTTP/1.1
Host: {{Hostname}}
Origin: {{BaseURL}}
matchers:
- type: status
status:
- 200
# digest: 4b0a00483046022100c060a867912857a78e261df8fec20d879bc06a00b72305823e136dc0f3de8470022100b001a80a51081cb8c097097d8ba28b1fdc4c76e1ab745375e55677cf0f337b84 |
TODO
id: code-template
info:
name: example code template
author: pdteam
severity: info
self-contained: false
code:
- engine:
- sh
- bash
source: |
echo output1
http:
- method: GET
path:
- "{{BaseURL}}"
# digest: 4a0a00473045022100addd38e85d219e8916a52893ba8ea3944347b121e9643249c1506f156764cab7022022826f03b26f909f0488d8e5e32ac3428f64dd9a6b8e64c2f769b843140370d2 |
Signing templates by setting public/private keys in enviornment variable (POC)# set env variables
export NUCLEI_SIGNATURE_PRIVATE_KEY=$(cat $HOME/.config/nuclei/nuclei-template-signer)
export NUCLEI_SIGNATURE_PUBLIC_KEY=$(cat $HOME/.config/nuclei/nuclei-template-signer.pub)
export NUCLEI_SIGNATURE_ALGORITHM=$(cat $HOME/.config/nuclei/nuclei-template-signer.algo)
# move backup keys
cd $HOME/.config/nuclei && mkdir backup && mv nuclei-template-* backup
# verify keys are not present in default dir
la $HOME/.config/nuclei | grep "nuclei"
# sign example template
./nuclei -t code.yaml -v -sign
[INF] All templates signatures were elaborated success=1 failed=0 |
User experience using signed and unsigned templates$ ./nuclei -t ~/nuclei-templates/http -sign -v
[INF] Generating new key-pair for signing templates
[*] Enter User/Organization Name (exit to abort) : ProjectDiscovery.io
[*] Enter passphrase (exit to abort):
[*] Enter same passphrase again:
[INF] Successfully generated new key-pair for signing templates
$ ./nuclei -t ~/nuclei-templates/http -sign -v
[INF] All templates signatures were elaborated success=6464 failed=0
$ ./nuclei
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.0.0-dev
projectdiscovery.io
[WRN] Found 1 templates loaded with deprecated protocol syntax, update before v3 for continued support.
[INF] Current nuclei version: v3.0.0-dev (development)
[INF] Current nuclei-templates version: v9.6.4 (latest)
[INF] New templates added in latest release: 121
[INF] Templates loaded for current scan: 6895
[INF] Executing 6219 signed templates from 'ProjectDiscovery.io'
[WRN] Executing 687 unsigned templates. Use with caution
[INF] No results found. Better luck next time! using encrypted private key with passphrase$ ./nuclei -t ~/nuclei-templates/http -sign -v
[INF] Generating new key-pair for signing templates
[*] Enter User/Organization Name (exit to abort) : tarun
[*] Enter passphrase (exit to abort):
[*] Enter same passphrase again:
[INF] Successfully generated new key-pair for signing templates
$ ./nuclei -t ~/nuclei-templates/http -sign -v
[INF] Private Key is encrypted with passphrase
[*] Enter passphrase (exit to abort):
[INF] All templates signatures were elaborated success=6464 failed=0 |
New Changes
TBD
|
example code templateid: simple-code
info:
name: simple-code
author: pdteam
severity: info
tags: code
description: |
simple-code
code:
- engine:
- py
- python3
source: |
import sys
print("hello from code s" + sys.stdin.read())
matchers:
- type: word
words:
- "hello from code" when template does not have any digest/signature./nuclei -u scanme.sh -t simple-code.yaml
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.0.0-dev
projectdiscovery.io
[WRN] Found 1 unverified templates (carefully examine the template before using it and use -sign flag to sign them)
[INF] Current nuclei version: v3.0.0-dev (development)
[INF] Current nuclei-templates version: v9.6.4 (latest)
[WRN] Executing 1 unsigned templates. Use with caution
[INF] Targets loaded for current scan: 1
[INF] No results found. Better luck next time!
[FTL] Could not run nuclei: no templates provided for scan signing a template$ ./nuclei -u scanme.sh -t simple-code.yaml -sign
[INF] All templates signatures were elaborated success=1 failed=0 auto-verification of signed template before executing./nuclei -u scanme.sh -t simple-code.yaml
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.0.0-dev
projectdiscovery.io
[INF] Current nuclei version: v3.0.0-dev (development)
[INF] Current nuclei-templates version: v9.6.4 (latest)
[INF] New templates added in latest release: 121
[INF] Templates loaded for current scan: 1
[INF] Executing 1 signed templates from 'tarun'
[INF] Targets loaded for current scan: 1
[simple-code] [code] [info] scanme.sh when template content is modified template is considered as not verified template./nuclei -u scanme.sh -t simple-code.yaml
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.0.0-dev
projectdiscovery.io
[WRN] Found 1 unverified templates (carefully examine the template before using it and use -sign flag to sign them)
[INF] Current nuclei version: v3.0.0-dev (development)
[INF] Current nuclei-templates version: v9.6.4 (latest)
[WRN] Executing 1 unsigned templates. Use with caution
[INF] Targets loaded for current scan: 1
[INF] No results found. Better luck next time!
[FTL] Could not run nuclei: no templates provided for scan re-signing code template if fragment matches with current user/signer
re-signing of code templates when fragment is not present or does not belong to current signer/userexample template id: simple-code
info:
name: simple-code
author: pdteam
severity: info
tags: code
description: |
simple-code
code:
- engine:
- py
- python3
source: |
import sys
print("hello from code" + sys.stdin.read())
matchers:
- type: word
words:
- "hello from code"
# digest: 4a0a0047304502207cc624edaa99107f1a4b68ad246e3e48e888735cfde4f8882c4d72a5a98009d40221009ef1b4590ebeaee24d60d8485758e3711cba88c2a3eada7c2a7e18f82afb4393:abacus in this case even if user tries to re-sign code protocol template then it is not allowed as fragment does not match $ ./nuclei -u scanme.sh -t simple-code.yaml -v -sign
[ERR] could not sign 'simple-code.yaml': [signer:RUNTIME] fragment mismatch: expected '73812c4e0e52692225979bd2d5f05a3c' got 'abacus'
[INF] All templates signatures were elaborated success=0 failed=1 to resolve this situation user needs to manually remove digest from template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- printing issues when running workflows
- printing issue with non-yaml files (
.yaml
) when used with-sign
option - printing issue with counter display with workflows for unsigned templates
$ ./nuclei
__ _
____ __ _______/ /__ (_)
/ __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ / __/ /
/_/ /_/\__,_/\___/_/\___/_/ v3.0.0-dev
projectdiscovery.io
[INF] Current nuclei version: v3.0.0-dev (development)
[INF] Current nuclei-templates version: v9.6.5 (latest)
[INF] New templates added in latest release: 75
[INF] Templates loaded for current scan: 6967
[INF] Executing 6978 signed templates from tarunKoyalwar
[INF] No results found. Better luck next time! |
@ehsandeep it will show 1 unsigned template because in nuclei file extension filtering is case-sensitive and looks like there is a template in nuclei-templates repo (only 1) that has when renamed to |
Proposed changes
Checklist