Skip to content
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

Add port status caching to reduce redundant and heavy calls #5152

Closed
tarunKoyalwar opened this issue May 6, 2024 · 1 comment · Fixed by #5148
Closed

Add port status caching to reduce redundant and heavy calls #5152

tarunKoyalwar opened this issue May 6, 2024 · 1 comment · Fixed by #5148
Assignees
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Milestone

Comments

@tarunKoyalwar
Copy link
Member

Please describe your feature request:

Nuclei not only sends http requests but also sends requests to other ports depending on templates (ex: ssh , ftp and more). and currently nuclei has no way to avoid sending redundant requests

ex: below log contains info about all templates that failed trying to connect to closed ports

$    2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:10001: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:1001: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:10134: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:10911: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:110: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:111: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:11211: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:143: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:1604: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:179: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:1801: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:1883: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:1911: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:2002: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:20880: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:2181: i/o timeout"
  17 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:21: i/o timeout"
   9 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:22: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:2375: i/o timeout"
   3 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:23: i/o timeout"
   9 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:25: i/o timeout"
   3 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:27017: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:3299: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:3306: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:3310: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:3389: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:389: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:4000: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:4369: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:445: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:4712: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:50000: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:5222: i/o timeout"
   4 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:5432: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:554: i/o timeout"
   3 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:5555: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:5672: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:587: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:5900: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:60129: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:61613: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:61616: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:6200: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:6379: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:6380: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:7001: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:70: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:79: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:8009: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:8087: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:8649: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:8728: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:873: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:9000: i/o timeout"
   1 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:902: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:9042: i/o timeout"
   2 "[:RUNTIME] ztls fallback failed <- dial tcp [2606:4700:9761:5cc5:42ca:0:a7a8:efc4]:9100: i/o timeout"

this could have been avoided if we specifiy a port scan input to nuclei and nuclei would just skip requests that connect to these ports that way it is both efficient and reduces noise , this can even furthur be chained with cdncheck flag to avoid connecting to these ports if target is a cdn ( similar to naabu )

Describe the use case of this feature:

@tarunKoyalwar tarunKoyalwar added the Type: Enhancement Most issues will probably ask for additions or changes. label May 6, 2024
@tarunKoyalwar tarunKoyalwar self-assigned this May 8, 2024
@tarunKoyalwar tarunKoyalwar changed the title Support PortScan Input for nuclei using -im portscan Add port status caching to reduce redundant and heavy calls May 8, 2024
@tarunKoyalwar
Copy link
Member Author

  • while a port scan input could have been better , from nuclei perspective a internal port cache stikes a good balance without external dependency or introducing a portscanner
  • at same time this can be easily extend to support port-scan input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants