nuclei icon indicating copy to clipboard operation
nuclei copied to clipboard

Logic error in DSL matcher

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

Nuclei version:

2.8.9

Current Behavior:

nuclei marks template as a match if sent against host with a 500 HTTP status code.

Expected Behavior:

Should not mark the template as a match, since the logic of the DSL matcher should not be succesful

Steps To Reproduce:

  1. Use this template:
id: anyid

info:
  name: test
  author: m1tz
  severity: low

requests:
  - method: GET
    path:
      - "{{BaseURL}}/?random1337"
      - "{{BaseURL}}/?ValueOf"

    matchers:
      - type: dsl
        dsl:
          - "status_code_1 != 500"
          - "status_code_2 == 500"
        condition: and
  1. Run that against a server that fails with a status code of 500

The first request should also result in a 500 and thus should not fulfill the logic in the DSL part.

The same issue occurs if this matcher is used:

      - type: dsl
        dsl:
          - "status_code_1 != 500 && status_code_2 == 500"

m-1tZ avatar Mar 11 '23 13:03 m-1tZ

@m-1tZ this doesn't return match for me, do you have an example target to share? using latest version of nuclei?

id: anyid

info:
  name: test
  author: m1tz
  severity: low

requests:
  - method: GET
    path:
      - "{{BaseURL}}/?random1337"
      - "{{BaseURL}}/?ValueOf"

    matchers:
      - type: dsl
        dsl:
          - "status_code_1 != 200"
          - "status_code_2 == 200"
        condition: and
echo https://example.com | nuclei -t test.yaml -v

                    __     _
  ____  __  _______/ /__  (_)
 / __ \/ / / / ___/ / _ \/ /
/ / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v2.8.9

   	projectdiscovery.io

[INF] Using Nuclei Engine 2.8.9 (latest)
[INF] Using Nuclei Templates 9.3.9 (latest)
[INF] Templates added in last update: 61
[INF] Templates loaded for scan: 1
[INF] Targets loaded for scan: 1
[VER] [anyid] Sent HTTP request to https://example.com/?random1337
[VER] [anyid] Sent HTTP request to https://example.com/?ValueOf
[INF] No results found. Better luck next time!

ehsandeep avatar Mar 11 '23 14:03 ehsandeep