HIGH 8.1

CVE-2026-12746: Dancer2 OAuth 2.0 State Parameter Missing – Account Takeover Risk

Dancer2::Plugin::Auth::OAuth::Provider (Perl library) before version 0.23 fails to implement a critical security check during OAuth 2.0 login flows. The plugin doesn't generate or validate a 'state' parameter—a token that binds an authorization request to a specific user session. This omission allows attackers to hijack login sessions through cross-site request forgery (CSRF). An attacker can initiate an OAuth login with their own account, capture the resulting authorization code, and trick a victim into using it. The victim's session then incorrectly completes the login as the attacker, potentially granting the attacker persistent access to the victim's account if the application links OAuth identities to user profiles.

Source data · NVD / CISA · public domain

CVSS
3.1 · 8.1 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
Weaknesses (CWE)
CWE-352
Affected products
0 configuration(s)
Published / Modified
2026-07-04 / 2026-07-06

NVD description (verbatim)

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.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from two defects in the OAuth 2.0 implementation: (1) the authentication_url method does not generate and include a state parameter when building the provider authorization URL, and (2) the callback method does not validate that an incoming authorization code matches a state value previously stored in the session. The OAuth 2.0 specification (RFC 6749) mandates the state parameter precisely to prevent CSRF attacks by creating a cryptographic binding between the authorization request and the callback. Without this binding, any callback code can be associated with any session, enabling an attacker to complete an authorization flow they initiated on behalf of a victim. This is particularly dangerous in applications that persist OAuth provider identity mappings to user accounts.

Business impact

Organizations using this plugin for OAuth 2.0 authentication face account takeover risk. An attacker can associate their own provider credentials with a victim's application account, granting themselves login access without knowing the victim's password. If multi-factor authentication relies solely on the application's internal login and does not re-verify OAuth provider identity at sensitive operations, the attacker gains full account access. In worst-case scenarios—particularly for applications managing sensitive data, financial transactions, or administrative functions—this could facilitate fraud, data theft, or privilege escalation. The attack requires only user interaction (clicking a malicious link), making it broadly exploitable.

Affected systems

Dancer2::Plugin::Auth::OAuth::Provider versions prior to 0.23 are vulnerable. This affects any Perl-based web application using this plugin for OAuth 2.0 authentication. Dancer2 is a lightweight Perl web framework; applications commonly include those built on microservices, API backends, or internal authentication systems in organizations with Perl infrastructure. The plugin is used to delegate authentication to external OAuth 2.0 providers (e.g., GitHub, Google, custom corporate identity servers).

Exploitability

Exploitability is high. The attack requires no special technical sophistication: an attacker initiates a legitimate OAuth flow with a provider under their control, obtains a callback code, and crafts a URL containing that code to send to a victim (e.g., via phishing or URL shortening). The victim's browser automatically includes session cookies, and the vulnerable plugin accepts the code without validation. No special network positioning, authentication, or privilege is needed. The CVSS score of 8.1 (HIGH) reflects the high impact (account hijacking) and low attack complexity. The attack is not currently tracked as actively exploited (KEV status: not listed), but the simplicity of the attack vector and the severity of consequences make rapid remediation critical.

Remediation

Upgrade Dancer2::Plugin::Auth::OAuth::Provider to version 0.23 or later. Version 0.23 implements RFC 6749 compliance by generating a cryptographic state parameter during authorization_url, storing it in the session, and validating it on callback before accepting the authorization code. Organizations should verify the upgrade against official vendor documentation and test OAuth login flows in a staging environment before production rollout. For applications that have already been running vulnerable versions, consider auditing recent login activity and account linking to detect potential unauthorized provider associations.

Patch guidance

Update the plugin to version 0.23 or later via standard Perl package management (CPAN, or your organization's internal package repository). Verify the upgrade by checking the plugin version reported in application logs or by running `perl -MVersion -e` against Dancer2::Plugin::Auth::OAuth::Provider. After patching, test the full OAuth 2.0 flow end-to-end with a test provider account to confirm state validation is working. Organizations with strictly locked dependencies should verify compatibility with their specific Dancer2 version, though version 0.23 is designed to be a drop-in replacement.

Detection guidance

Monitor application authentication logs for suspicious patterns: (1) authorization callbacks lacking corresponding session-initiated OAuth requests, (2) multiple OAuth callbacks completing within a short timeframe from different providers but to the same user account, (3) provider identity links being added to accounts that rarely use OAuth. If you maintain application logs, search for OAuth callback processing without matching session state entries. On the provider side (if you operate an internal OAuth server), look for authorization codes issued to one account but redeemed in callback requests that reference a different session or client state. A forensic review of account linking history can reveal unauthorized provider associations.

Why prioritize this

This vulnerability should be prioritized highly because: (1) account takeover is a critical business impact, (2) exploitation requires only a victim's interaction with a malicious link (low barrier), (3) patches are available and straightforward to deploy, (4) the attack is specific enough that legacy versions are clearly vulnerable but recent versions are patched. Organizations running this plugin should treat this as a P1 security issue and schedule updates within days rather than weeks.

Risk score, explained

CVSS 3.1 score of 8.1 (HIGH) is driven by: High confidentiality and integrity impact (C:H, I:H)—the attacker gains login access and can access all data and modify account settings visible to the user. Network attack vector (AV:N) and low complexity (AC:L) reflect easy exploitation via HTTP callback interception. User interaction required (UI:R) is the one limiting factor—the victim must click a link or be redirected to the callback, though this is a very reasonable precondition for web-based CSRF. The scope is unchanged (S:U), and no availability impact (A:N) as the service itself remains operational. The 8.1 score appropriately reflects a serious vulnerability requiring urgent attention.

Frequently asked questions

Can this vulnerability be exploited without the victim's interaction?

No, the victim must at minimum perform an action that results in their browser sending a request to the callback endpoint with the attacker's authorization code. This typically means clicking a link or being silently redirected. The CVSS scoring reflects this by including UI:R; however, in practice, social engineering or drive-by redirects can make this seem 'invisible' to the victim.

Does patching require downtime or application restart?

Yes, patching requires restarting the application process (or reloading Perl interpreters if using persistent processes like FastCGI or Starman). Most organizations can perform this during a maintenance window with minimal disruption, especially if they use graceful reload mechanisms or blue-green deployments. Test in staging first to confirm no compatibility issues.

If we do not use OAuth 2.0 for login, are we affected?

No. Only applications that use Dancer2::Plugin::Auth::OAuth::Provider to delegate authentication to external OAuth 2.0 providers are vulnerable. If your application uses only local password authentication, SAML, OpenID Connect, or other methods, this CVE does not apply.

What should we do if we suspect an attacker has already compromised accounts via this vector?

Review authentication logs and account linking history to identify suspicious provider associations added to user accounts. If suspicious links are found, remove them and prompt affected users to change passwords and review their linked identities. If your application does not log provider linking events, implement logging for this immediately in the patched version. Consider mandatory password resets and security awareness communication for any confirmed compromised accounts.

This analysis is provided for informational purposes and is accurate as of the published CVE date (2026-07-04). Vendor information, patch availability, and affected product details should be verified against the official Dancer2::Plugin::Auth::OAuth::Provider documentation and CPAN repository. CVSS scores are derived from the NVD official vector and should not be modified without re-evaluation by a qualified analyst. Organizations should validate patch compatibility within their specific application environments before production deployment. SEC.co and its authors assume no liability for damages arising from the application or misapplication of this information. Source: NVD (public-domain), retrieved 2026-08-13. Analysis generated by SEC.co (claude-haiku-4-5).