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

[BUG] Missing failed event for non accessible host #5556

Closed
1 task done
ehsandeep opened this issue Aug 22, 2024 · 1 comment · Fixed by #5576
Closed
1 task done

[BUG] Missing failed event for non accessible host #5556

ehsandeep opened this issue Aug 22, 2024 · 1 comment · Fixed by #5576
Assignees
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Milestone

Comments

@ehsandeep
Copy link
Member

ehsandeep commented Aug 22, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Current Behavior

-ms option doesn't generate failed event for the cases when host is not accesisble, take host down is most common for addressing takeover related templates but it doesn't get detected upon retest after issue got resovled because of this issue. cc @ShubhamRasal

$ nuclei -u trust_me_bro.real -id tech-detect -matcher-status

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.3.1

    projectdiscovery.io

[INF] Current nuclei version: v3.3.1 (latest)
[INF] Current nuclei-templates version: v9.9.3 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 56
[INF] Templates loaded for current scan: 1
[INF] Executing 1 signed templates from projectdiscovery/nuclei-templates
[INF] Targets loaded for current scan: 1
[INF] No results found. Better luck next time!

Expected Behavior

$ nuclei -u trust_me_bro.real -id tech-detect -matcher-status

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.3.1

    projectdiscovery.io

[INF] Current nuclei version: v3.3.1 (latest)
[INF] Current nuclei-templates version: v9.9.3 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 56
[INF] Templates loaded for current scan: 1
[INF] Executing 1 signed templates from projectdiscovery/nuclei-templates
[INF] Targets loaded for current scan: 1
-[INF] No results found. Better luck next time!
+[example-template] [failed] [http] [info] trustmebro.real
$ nuclei -u trust_me_bro.real -id tech-detect -matcher-status -j | jq .

{
  "template": "http/technologies/tech-detect.yaml",
  "template-url": "https://cloud.projectdiscovery.io/public/tech-detect",
  "template-id": "tech-detect",
  "template-path": "/Users/geekboy/nuclei-templates/http/technologies/tech-detect.yaml",
  "info": {
    "name": "Wappalyzer Technology Detection",
    "author": [
      "hakluke",
      "righettod"
    ],
    "tags": [
      "tech"
    ],
    "severity": "info",
    "metadata": {
      "max-request": 1
    }
  },
  "type": "http",
  "host": "example.com",
  "port": "443",
+ "error": "no address found for host",
  "url": "https://example.com",
  "timestamp": "2024-08-22T21:16:53.150038+05:30",
  "matcher-status": false
}

Steps To Reproduce

$ nuclei -u trust_me_bro.real -id tech-detect -matcher-status

Relevant log output

No response

Environment

- OS: Mac
- Nuclei: latest 
- Go: go version go1.21.3 darwin/arm64

Anything else?

  1. Error information is already exposed to elog option.
  2. We need to make sure this works for all protocol.
@ehsandeep ehsandeep added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Aug 22, 2024
@tarunKoyalwar
Copy link
Member

tarunKoyalwar commented Aug 25, 2024

Context

  • we have had some issues with exporting / making available error in result event due to callback style implementation
  • since there will be more of these edgecase , we can handle it at top level instead to potentially handle future edgecase

Idea / Proposed solution

in tmplexec , exec.go we can wrap the callback that was provided with atomic.Bool which tracks if callback was called or not , when internal requests are executed and before exiting the Executexx method in exec.go we can check if atomic.Bool is true and if it is false when matcher-status is true ( basically no even was ever generated) . we can create a fake event with template-info and error ( if any ) and run callback on this event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants