Skip to content

[BUG] Can't use expressions/variables in DNS resolver config #7374

Description

@kor-condignum

Is there an existing issue for this?

  • I have searched the existing issues.

Current Behavior

I am trying to use an expression/variable in the resolvers config in a custom template:

variables:
  test_resolver: "1.1.1.1"

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

When trying to run this template it fails:

[WRN] Could not parse template /home/user/nuclei-templates/dns/dns-test.yaml: could not compile request: could not get dns client: could not resolve resolvers expressions: failed to evaluate expression "test_resolver": No parameter 'test_resolver' found.

Expected Behavior

I am expecting expressions/variables to be correctly evaluated. My end goal is to use a previously extracted variable as the resolver for a subsequent DNS query.

Steps To Reproduce

Run nuclei with the following template (./nuclei -target google.com -t nuclei-templates/dns/dns-test.yaml -v):

id: dns-test

info:
  name: Test
  author: Test
  description: Test
  severity: info

variables:
  test_resolver: "1.1.1.1"

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

    matchers:
      - type: regex
        part: answer
        regex:
          - "IN\tA\t(.+)$"

Relevant log output

Environment

- OS: Ubuntu 22.04.5 LTS
- Nuclei: v3.8.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions