projectdiscovery / nuclei

Nuclei is a fast, customizable vulnerability scanner powered by the global security community and built on a simple YAML-based DSL, enabling collaboration to tackle trending vulnerabilities on the internet. It helps you find vulnerabilities in your applications, APIs, networks, DNS, and cloud configurations.
https://docs.projectdiscovery.io/tools/nuclei
MIT License
20.55k stars 2.5k forks source link

template directory is not handled correctly #2264

Closed hktalent closed 2 years ago

hktalent commented 2 years ago

$ nuclei -version

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   2.7.3

        projectdiscovery.io

[WRN] Use with caution. You are responsible for your actions.
[WRN] Developers assume no liability and are not responsible for any misuse or damage.
[INF] Current Version: 2.7.3
$ ls /Users/51pwn/MyWork/nuclei-templates
51pwn               TEMPLATES-STATS.md      exposed-panels          miscellaneous           vulnerabilities
CODE_OF_CONDUCT.md      TOP-10.md           exposures           misconfiguration        wappalyzer-mapping.yml
CONTRIBUTING.md         cnvd                file                network             workflows
LICENSE.md          contributors.json       fuzzing             ssl
PULL_REQUEST_TEMPLATE.md    cves                headless            takeovers
README.md           default-logins          helpers             technologies
TEMPLATES-STATS.json        dns             iot             token-spray

$ nuclei -validate -w "./" -t $HOME/MyWork/nuclei-templates 

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   2.7.3

        projectdiscovery.io

[WRN] Use with caution. You are responsible for your actions.
[WRN] Developers assume no liability and are not responsible for any misuse or damage.
[WRN] The given path (/Users/51pwn/MyWork/nuclei-templates) is outside the default template directory path ()! Referenced sub-templates with relative paths in workflows will be resolved against the default template directory.
[ERR] Could not find template 'technologies/fingerprinthub-web-fingerprints.yaml': could not find template file: no such path found: technologies/fingerprinthub-web-fingerprints.yaml
[ERR] Could not find template '/Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates': could not find file: stat /Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates: no such file or directory
[ERR] Could not find template 'technologies/fingerprinthub-web-fingerprints.yaml': could not find template file: no such path found: technologies/fingerprinthub-web-fingerprints.yaml
[ERR] Could not find template '/Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates': could not find file: stat /Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates: no such file or directory
 $ ls `pwd`/config/nuclei-templates
51pwn               TEMPLATES-STATS.md      exposed-panels          miscellaneous           token-spray
CODE_OF_CONDUCT.md      TOP-10.md           exposures           misconfiguration        vulnerabilities
CONTRIBUTING.md         cnvd                file                network             wappalyzer-mapping.yml
LICENSE.md          contributors.json       fuzzing             ssl             workflows
PULL_REQUEST_TEMPLATE.md    cves                headless            takeovers
README.md           default-logins          helpers             tb.sh
TEMPLATES-STATS.json        dns             iot             technologies

$ nuclei -validate -t `pwd`/config/nuclei-templates   

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   2.7.3

        projectdiscovery.io

[WRN] Use with caution. You are responsible for your actions.
[WRN] Developers assume no liability and are not responsible for any misuse or damage.
[WRN] The given path (/Users/51pwn/MyWork/scan4all/config/nuclei-templates) is outside the default template directory path ()! Referenced sub-templates with relative paths in workflows will be resolved against the default template directory.
[ERR] Could not find template 'technologies/fingerprinthub-web-fingerprints.yaml': could not find template file: no such path found: technologies/fingerprinthub-web-fingerprints.yaml
[ERR] Could not find template '/Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates': could not find file: stat /Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates: no such file or directory

[ERR] Could not find template 'technologies/sap/sap-netweaver-detect.yaml': could not find template file: no such path found: technologies/sap/sap-netweaver-detect.yaml
[ERR] Could not find template 'cves/2020/CVE-2020-6287.yaml': could not find template file: no such path found: cves/2020/CVE-2020-6287.yaml
[ERR] Could not find template 'cves/2017/CVE-2017-12637.yaml': could not find template file: no such path found: cves/2017/CVE-2017-12637.yaml
[ERR] Could not find template 'cves/2020/CVE-2020-6308.yaml': could not find template file: no such path found: cves/2020/CVE-2020-6308.yaml
[ERR] Could not find template 'exposed-panels/fiorilaunchpad-logon.yaml': could not find template file: no such path found: exposed-panels/fiorilaunchpad-logon.yaml
[ERR] Could not find template 'exposed-panels/hmc-hybris-panel.yaml': could not find template file: no such path found: exposed-panels/hmc-hybris-panel.yaml
[ERR] Could not find template 'exposed-panels/sap-netweaver-portal.yaml': could not find template file: no such path found: exposed-panels/sap-netweaver-portal.yaml
[ERR] Could not find template 'exposed-panels/sap-hana-xsengine-panel.yaml': could not find template file: no such path found: exposed-panels/sap-hana-xsengine-panel.yaml
[ERR] Could not find template 'misconfiguration/sap/': could not find template file: no such path found: misconfiguration/sap/
[ERR] Could not find template 'network/sap-router.yaml': could not find template file: no such path found: network/sap-router.yaml
[ERR] Could not find template 'network/sap-router-info-leak.yaml': could not find template file: no such path found: network/sap-router-info-leak.yaml
[ERR] Could not find template 'exposed-panels/netgear-version-detect.yaml': could not find template file: no such path found: exposed-panels/netgear-version-detect.yaml
[ERR] Could not find template '/Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates': could not find file: stat /Users/51pwn/MyWork/scan4all/tmp/config/nuclei-templates: no such file or directory
forgedhallpass commented 2 years ago

Your default template directory is defined in cat ~/.config/nuclei/.templates-config.json | jq '."nuclei-templates-directory"'.

In my case that something like /Users/forgedhallpass/nuclei-templates. If I would like to validate a specific template, I'd need to use nuclei -validate -t technologies/tech-detect.yaml. That being said, validation of templates with an absolute path should also work. The -ud, -update-directory can be used to overwrite the template directory path.

hktalent commented 2 years ago

@forgedhallpass thanks