URL-Matching Rules

优质
小牛编辑
130浏览
2023-12-01

URL-Matching Rules

URL-matching rules are used in various locations within Burp, to define URL-based scoping for various functions, such as general Target scope, the scope of individual functions like live scanning, URLs returning streaming responses, and the scope of session handling rules.

You can configure URL-based scoping in normal or advanced mode. Normal mode performs better in mode situations, but advanced mode provides more power and flexibility where needed. Both types of scope control rules are case insensitive.

Normal Scope Control

Normal scope control is ideal for most purposes, and involves simply specifying URL prefixes for items that are in or out of scope. Each prefix can include a specific protocol, or can omit the protocol to match both HTTP and HTTPS.

Examples of valid URL prefixes are:

  • http://example.com/path
  • https://example.com/admin
  • example.com
  • example.com/myapp/
  • http://example.com:8080/login

Note that wildcard expressions are not supported in simple URL prefixes.

Advanced Scope Control

Advanced scope control provides more power and flexibility than normal scope control, and uses URL-matching rules rather than simple prefixes. Each URL-matching rule can specify various features of the URLs that will be matched. For a URL to match the rule, it must match all of the features that are specified by the rule. The following items can be configured:

  • Protocol - This specifies the protocol(s) that the rule will match. Available options are: HTTP, HTTPS, or any.
  • Host or IP range - This specifies the host(s) that the rule will match. You can enter a regular expression to match the hostname, or an IP range in various standard formats, for example 10.1.1.1/24 or 10.1.1-20.1-127. If the host field is left blank, then the rule can match URLs containing any host.
  • Port - This specifies the port(s) that the rule will match. You can enter a regular expression to match one or more port numbers. If the port field is left blank, then the rule can match URLs containing any port.
  • File - This specifies the file portion of the URL that the rule will match (ignoring any query string). You can enter a regular expression to match the required range of URL files. If the file field is left blank, then the rule can match URLs containing any file.

Often, the easiest way to create an advanced URL-matching rule is to copy the relevant URL to the clipboard from elsewhere (either your browser or from a request within Burp), and click the "Paste URL" button on the URL-matching rule dialog. This will create a rule that matches this URL, and also any others that have this URL as a prefix (Burp places a wildcard at the end of the file expression). You can then manually edit the rule as required, to fine-tune the URLs that are matched.

You can also use the "Load ..." button to load a list of items from a text file. Each item in list should be either a URL or a hostname, and Burp will create an appropriate rule for each item.