Learn about scanning targets behind authentication with Nuclei
-H
flag, but this limits the scope of authentication and is a not a scalable solution since authentication would need to be performed manually and the headers would need to be updated manually.
To solve this issue, Nuclei v3.2.0 introduces a new specification for generic client side Authentication, this allows apps like Nuclei to authenticate with targets using this format. We call this format Secret File
, and it is managed through a YAML file that contains authentication related configuration.
nuclei-templates
. These are written in YAML, are scalable, and comes with a powerful engine.
We achieve this scalability by reusing and extending our default-login
templates library. We are continuously adding templates for different apps and services, and these templates can then be referenced in the Secret File
to perform authentication.
domains
& domains-regex
(mutually exclusive) which can be used to limit the scope of a secret to a particular set of targets.
.*
to send a secret to all targets.domains
over domains-regex
.Secret File
configuration, and support the use of third-party secret management systems to templatize and manage secrets.
type
basicauth
: Basic Authenticationquery
: Query Parametersbearertoken
: Bearer Tokenheader
: Custom Headercookie
: Cookiedomains
domains-regex
and can be used to limit the scope of a secret to a particular set of targets.
Example:
domains-regex
domains
and can be used to limit the scope of a secret to a particular set of targets.
Example:
username
& password
type: basicauth
.
Example:
params
type: query
.
Example:
token
type: bearertoken
.
Example:
headers
type: header
.
Example:
cookies
type: cookie
.
Example:
template
template
contains the absolute or relative path (of nuclei-templates directory) to the template file that will be used to authenticate with the target. This field can only be used with type: dynamic
.
A template used for dynamic authentication should accept variables
and optionally input
as input, and should return the session data via extractor. The session data can then be used in the static secret.
Example:
In this example, a username and password are used to login to a Wordpress instance using REST API and the session data is exported via extractors.
variables
variables
is a list of key-value pairs that are used to specify the variables for the template. This field can only be used with type: dynamic
and is only required if the template requires variables.
Example:
input
input
is a optional input/target for the template to be executed on and is only required if the target is not hardcoded in the template. Specifying input
here allows easy switching of dev and prod environments easily compared to hardcoding the target in the template.
Example: