Security Advisories (2)
CVE-2026-11832 (2026-06-15)

Dancer2::Plugin::Auth::OAuth versions before 0.22 for Perl default to a predictable nonce. The default nonce was generated using an MD5 hash of the epoch time, which is predictable.

CVE-2026-12746 (2026-07-04)

Dancer2::Plugin::Auth::OAuth::Provider versions before 0.23 for Perl do not support the OAuth 2.0 state parameter. The authentication_url method builds the provider authorization redirect without issuing a state value, and the callback method exchanges the callback code and registers the resulting token into the session without verifying that the callback corresponds to an authorization request this session initiated. Any application that uses this plugin for OAuth 2.0 login is exposed to login cross-site request forgery: because the callback is not bound to the session that began the flow, an attacker who starts an authorization with their own provider account can deliver the resulting callback to a victim, causing the victim's session to complete the attacker's authorization and associating the attacker's provider identity and access token with that session. Where the application persists this as an account link, the attacker may retain access to the victim's account through their own provider credentials.

NAME

Dancer2::Plugin::Auth::OAuth::Provider::AzureAD - Provider for Microsoft/AzureAD

SYNOPSIS

View the documentation for Dancer2::Plugin::Auth::OAuth

Default values; change these in your YML config if needed:

plugins:
  "Auth::OAuth":
    providers:
      AzureAD:
        urls:
          authorize_url: "https://login.microsoftonline.com/common/oauth2/authorize"
          access_token_url: "https://login.microsoftonline.com/common/oauth2/token"
          user_info: "https://graph.microsoft.com/v1.0/me/"
        tokens:
          client_id: your_client_id
          client_secret: your_client_secret
        query_params:
          authorize:
            scope: 'User.Read',
            resource: 'https://graph.microsoft.com/',

DESCRIPTION

Generic provider for Microsoft OAuth2.

Note that you will undoubtably need to change some or all of the options above.

After login, the following session key will have contents: {oauth}{azuread}

The token will probably be in {id_token}

When log in has occured, the provider attempts to decode the resulting token for information about the user. All of the decoded information can be found in the session key: {oauth}{azuread}{login_info}

The login email address, for example, will probably be in a key called {unique_name}

If the user_info option is defined (which it is by default!), a corresponding call is made to that URL to find out more information about the user. This is stashed in the session key {oauth}{azuread}{user_info}

ADDING TENANT ID

If you need to add a tenant ID to your calls, this should be done by replacing "common" in the authorize_url and access_token_url.

PREVENTING USER LOOKUP WITH GRAPH

By default this provider requests scope and resource to perform a request on Microsoft's Graph API to return the logged in user details. This is not strictly necessary, as part of the token returned on authentication is the email address used to log in.

To prevent this lookup, set "user_info" to a blank string.

AUTHOR

Pero Moretti <pero@cpan.org>

COPYRIGHT

Copyright 2022- Pero Moretti

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.