nuclei icon indicating copy to clipboard operation
nuclei copied to clipboard

Templates with multiple DNS requests fail when the input is in "host:port" format

Open mhmdiaa opened this issue 1 year ago • 1 comments

Nuclei version:

3.3.0

Current Behavior:

While executing a DNS template with multiple requests with a host:port input(s), the FQDN variable includes the port that causes the DNS requests to fail.

Expected Behavior:

The FQDN variable should not include a port regardless of the input format or the template protocol.

Steps To Reproduce:

  1. Write the following template to test-multi-request-input-handling.yaml
    id: test-multi-request-input-handling
    
    info:
      name: Test Single Protocol Input Handling
      author: mhmdiaa
      severity: info
    
    dns:
      - name: "{{FQDN}}"
        type: A
      - name: "{{FQDN}}"
        type: A
    
  2. Run nuclei -debug -u example.com:443 -t test-multi-request-input-handling.yaml
  3. The debug output will show the sent DNS requests which include the port.
    ;; QUESTION SECTION:
    ;example.com:443.  IN  A
    

Anything else:

The FQDN is parsed correctly when the template has a single request, uses another protocol, or when the input is a full URL.

$ cat test-single-request-input-handling.yaml
id: test-single-request-input-handling

info:
  name: Test Single Request Input Handling
  author: mhmdiaa
  severity: info

dns:
  - name: "{{FQDN}}"
    type: A

$ nuclei -debug -u example.com:443 -t test-single-request-input-handling.yaml
...
;; QUESTION SECTION:
;example.com.  IN  A
...
;; ANSWER SECTION:
example.com.  1009  IN  A  93.184.215.14

mhmdiaa avatar Jul 21 '24 14:07 mhmdiaa

@mhmdiaa thanks for creating an issue and fix for it.

possible related issue - https://github.com/projectdiscovery/nuclei-templates/issues/10349

ehsandeep avatar Jul 22 '24 12:07 ehsandeep