nuclei icon indicating copy to clipboard operation
nuclei copied to clipboard

Automatic scan does not include additional custom templates from default installed location

Open m-1tZ opened this issue 4 years ago • 7 comments

Nuclei version:

Nuclei Engine 2.6.9

Current Behavior:

The template is located under ~/nuclei-templates/ within a custom directory ~/nuclei-templates/specific/software/amazon. It is interesting, because I have to give the -t template location in order to run the custom directories located in the default location. This one works as expected:

nuclei -rl 7 -nts -u https://example.com -as -stats -t ~/nuclei-templates

This one not:

nuclei -rl 7 -nts -u https://example.com -as -stats

If used with manual set tags:

nuclei -rl 7 -nts -u https://example.com -tags amazon,cloudfront,web,services,s3
[...]
[INF] Templates loaded for scan: 2
[amazon-files] [http] [medium] https://example.com/awstats.conf

Expected Behavior:

Shouldn't this behave and work the same? Is it different to the -tags flag?


Tests to ensure the following conditions with automatic scan:

  • [x] default templates from the default installed location are used.
  • [x] additional templates from the default installed location are used.
  • [x] additional templates from the custom location are used if specified.

m-1tZ avatar May 06 '22 19:05 m-1tZ

@m-1tZ are you running a custom template? as I don't see any template with id as amazon-files in the template project, if so could you also include additional details to reproduce this behavior.

ehsandeep avatar May 07 '22 05:05 ehsandeep

Indeed. But does it make a difference? I thought that -as is just using -tags with the identified values under the hood?

Template:

id: amazon-files

info:
  name: AWS files Exposure
  author: m1tZ
  severity: medium
  tags: aws,amazon

requests:
  - method: GET
    path:
      - '{{BaseURL}}/awstats.conf'
      - '{{BaseURL}}/aws.sh'
      - '{{BaseURL}}/awstats.pl'
      - '{{BaseURL}}/logs/awstats.pl'
      - '{{BaseURL}}/webstats/awstats.pl'
      - '{{BaseURL}}/awstats/'
    
    matchers:
      - type: status
        status:
          - 200

m-1tZ avatar May 07 '22 07:05 m-1tZ

@m-1tZ yeah, it does make a difference as nuclei run the default templates based on available tags information as it doesn’t know where your custom templates are located.

so the question is, did you include your custom templates in the default installed location? otherwise, you can also specify the custom directory to include templates to run with -as, something we fixed n supported in the last release https://github.com/projectdiscovery/nuclei/issues/1791

ehsandeep avatar May 07 '22 07:05 ehsandeep

The template is located under ~/nuclei-templates/ within a custom directory ~/nuclei-templates/specific/software/amazon. It is interesting, because I have to give the -t template location in order to run the custom directories located in the default location. This one works as expected:

nuclei -rl 7 -nts -u https://example.com -as -stats -t ~/nuclei-templates

This one not:

nuclei -rl 7 -nts -u https://example.com -as -stats

m-1tZ avatar May 07 '22 07:05 m-1tZ

The template is located under ~/nuclei-templates/ within a custom directory ~/nuclei-templates/specific/software/amazon

Yes, this was the information I was looking for. Indeed this looks like a bug that needs to be fixed; thanks for reporting.

ehsandeep avatar May 07 '22 08:05 ehsandeep

Thanks for responding this quickly, have a nice day!

m-1tZ avatar May 07 '22 08:05 m-1tZ

@m-1tZ this is now fixed in the dev version of nuclei with - https://github.com/projectdiscovery/nuclei/pull/1968

ehsandeep avatar May 10 '22 11:05 ehsandeep