Skip to main content
Matchers allow different type of flexible comparisons on protocol responses. They are what makes nuclei so powerful, checks are very simple to write and multiple checks can be added as per need for very effective scanning.

Types

Multiple matchers can be specified in a request. There are basically 7 types of matchers: To match status codes for responses, you can use the following syntax.
To match binary for hexadecimal responses, you can use the following syntax.
Matchers also support hex encoded data which will be decoded and matched.
Word and Regex matchers can be further configured depending on the needs of the users. XPath matchers use XPath queries to match XML and HTML responses. If the XPath query returns any results, it’s considered a match.
Complex matchers of type dsl allows building more elaborate expressions with helper functions. These function allow access to Protocol Response which contains variety of data based on each protocol. See protocol specific documentation to learn about different returned results.
Every part of a Protocol response can be matched with DSL matcher. Some examples -

Conditions

Multiple words and regexes can be specified in a single matcher and can be configured with different conditions like AND and OR.
  1. AND - Using AND conditions allows matching of all the words from the list of words for the matcher. Only then will the request be marked as successful when all the words have been matched.
  2. OR - Using OR conditions allows matching of a single word from the list of matcher. The request will be marked as successful when even one of the word is matched for the matcher.

Matched Parts

Multiple parts of the response can also be matched for the request, default matched part is body if not defined. Example matchers for HTTP response body using the AND condition:
Similarly, matchers can be written to match anything that you want to find in the response body allowing unlimited creativity and extensibility.

Negative Matchers

All types of matchers also support negative conditions, mostly useful when you look for a match with an exclusions. This can be used by adding negative: true in the matchers block. Here is an example syntax using negative condition, this will return all the URLs not having PHPSESSID in the response header.

Multiple Matchers

Multiple matchers can be used in a single template to fingerprint multiple conditions with a single request. Here is an example of syntax for multiple matchers.

Matchers Condition

While using multiple matchers the default condition is to follow OR operation in between all the matchers, AND operation can be used to make sure return the result if all matchers returns true.

Internal Matchers

When writing multi-protocol or flow based templates, there might be a case where we need to validate/match first request then proceed to next request and a good example of this is CVE-2023-6553 In this template, we are first checking if target is actual using Backup Migration plugin using matchers and if true then proceed to next request with help of flow But this will print two results, one for each request match since we are using the first request matchers as a pre-condition to proceed to next request we can mark it as internal using internal: true in the matchers block.