2026-06-23 7:5CVE-2026-9733CPANSec
PUBLISHED5.2CWE-340CWE-338

Mojolicious::Plugin::Web::Auth::OAuth2 versions through 0.17 for Perl have an insecure default state parameter

Mojolicious::Plugin::Web::Auth::OAuth2 versions through 0.17 for Perl have an insecure default state parameter.

When no state generator is specified in the constructor, the module defaults to using a SHA-1 hash of predictable and low-entropy sources, including the epoch time (which is leaked via the HTTP Date header) and a call to Perl's built-in rand function.

A predictable state allows an attacker to hijack another user's session through cross site request forgery (CSRF).

Problem type

Affected products

HAYAJO

Mojolicious::Plugin::Web::Auth::OAuth2

<= 0.17 - AFFECTED

References

GitHub Security Advisories

GHSA-rq65-66g5-5pg2

Mojolicious::Plugin::Web::Auth::OAuth2 versions through 0.17 for Perl have an insecure default...

https://github.com/advisories/GHSA-rq65-66g5-5pg2

Mojolicious::Plugin::Web::Auth::OAuth2 versions through 0.17 for Perl have an insecure default state parameter.

When no state generator is specified in the constructor, the module defaults to using a SHA-1 hash of predictable and low-entropy sources, including the epoch time (which is leaked via the HTTP Date header) and a call to Perl's built-in rand function.

A predictable state allows an attacker to hijack another user's session through cross site request forgery (CSRF).

JSON source

https://cveawg.mitre.org/api/cve/CVE-2026-9733
Click to expand
{
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2",
  "cveMetadata": {
    "cveId": "CVE-2026-9733",
    "assignerOrgId": "9b29abf9-4ab0-4765-b253-1875cd9b441e",
    "assignerShortName": "CPANSec",
    "dateUpdated": "2026-06-23T07:05:20.564Z",
    "dateReserved": "2026-05-27T17:25:58.644Z",
    "datePublished": "2026-06-23T07:05:20.564Z",
    "state": "PUBLISHED"
  },
  "containers": {
    "cna": {
      "providerMetadata": {
        "orgId": "9b29abf9-4ab0-4765-b253-1875cd9b441e",
        "shortName": "CPANSec",
        "dateUpdated": "2026-06-23T07:05:20.564Z"
      },
      "title": "Mojolicious::Plugin::Web::Auth::OAuth2 versions through 0.17 for Perl have an insecure default state parameter",
      "descriptions": [
        {
          "lang": "en",
          "value": "Mojolicious::Plugin::Web::Auth::OAuth2 versions through 0.17 for Perl have an insecure default state parameter.\n\nWhen no state generator is specified in the constructor, the module defaults to using a SHA-1 hash of predictable and low-entropy sources, including the epoch time (which is leaked via the HTTP Date header) and a call to Perl's built-in rand function.\n\nA predictable state allows an attacker to hijack another user's session through cross site request forgery (CSRF)."
        }
      ],
      "affected": [
        {
          "vendor": "HAYAJO",
          "product": "Mojolicious::Plugin::Web::Auth::OAuth2",
          "collectionURL": "https://cpan.org/modules",
          "packageName": "Mojolicious-Plugin-Web-Auth",
          "programFiles": [
            "lib/Mojolicious/Plugin/Web/Auth/OAuth2.pm"
          ],
          "programRoutines": [
            {
              "name": "Mojolicious::Plugin::Web::Auth::OAuth2::_state_generator"
            }
          ],
          "repo": "https://github.com/hayajo/Mojolicious-Plugin-Web-Auth",
          "defaultStatus": "unaffected",
          "versions": [
            {
              "version": "0",
              "status": "affected",
              "versionType": "custom",
              "lessThanOrEqual": "0.17"
            }
          ]
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "lang": "en",
              "description": "CWE-340 Generation of Predictable Numbers or Identifiers",
              "cweId": "CWE-340",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "lang": "en",
              "description": "CWE-338 Use of Cryptographically Weak Pseudo-Random Number Generator",
              "cweId": "CWE-338",
              "type": "CWE"
            }
          ]
        }
      ],
      "references": [
        {
          "url": "https://metacpan.org/release/HAYAJO/Mojolicious-Plugin-Web-Auth-0.17/source/lib/Mojolicious/Plugin/Web/Auth/OAuth2.pm#L129-131"
        },
        {
          "url": "https://datatracker.ietf.org/doc/html/rfc6749#section-10.12",
          "tags": [
            "technical-description"
          ]
        },
        {
          "url": "https://security.metacpan.org/patches/M/Mojolicious-Plugin-Web-Auth/0.17/CVE-2026-9733-r2.patch",
          "tags": [
            "patch"
          ]
        }
      ],
      "impacts": [
        {
          "capecId": "CAPEC-59",
          "descriptions": [
            {
              "lang": "en",
              "value": "CAPEC-59 Session Credential Falsification through Prediction"
            }
          ]
        },
        {
          "capecId": "CAPEC-62",
          "descriptions": [
            {
              "lang": "en",
              "value": "CAPEC-62 Cross Site Request Forgery"
            }
          ]
        }
      ],
      "workarounds": [
        {
          "lang": "en",
          "value": "Users should specify a state_generator function in the plugin configuration that uses a secure CSPRNG such as Crypt::PRNG or (for Mojolicious 9.46 or later) the Mojo::Util::random_bytes function.  For example,\n\n  plugin 'Web::Auth',\n    module => 'OAuth2',\n    ...\n    state_generator => sub {\n      unpack(\"H*\", Mojo::Util::random_bytes(20))\n    };"
        }
      ]
    }
  }
}