Vulnerabilities in pkg:golang/github.com/ory/hydra/v2

PACKAGE
Advisory Identifier: GHSA-r9w3-57w2-gch2
Advisory Summary

CVE-2026-33504 is a HIGH (CVSS 7.2) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Github.com/ory/hydra libraries in the Go ecosystem. The issue involves ory hydra has a sql injection via forged pagination tokens. Remediation is available by upgrading affected packages to version 2.3.1-0.20260320110106-0b84568fffcc.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/ory/hydra/v2

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/ory/hydra/v2. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-r9w3-57w2-gch2 CVE-2026-33504 HIGH Ory Hydra has a SQL injection via forged pagination tokens

CVE-2026-33504 at a Glance

CVE Identifier CVE-2026-33504
GHSA Identifier GHSA-r9w3-57w2-gch2
Severity HIGH
CVSS v3.1 Base Score 7.2
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Github.com/ory/hydra
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-33504

To remediate this vulnerability, upgrade all affected Github.com/ory/hydra dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/ory/hydra fixed: Latest secure release
Upgrade github.com/ory/hydra to Latest secure release
github.com/ory/hydra/v2 fixed: 2.3.1-0.20260320110106-0b84568fffcc
Upgrade github.com/ory/hydra/v2 to 2.3.1-0.20260320110106-0b84568fffcc
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/ory/hydra

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-33504, inspect your project dependencies for Github.com/ory/hydra:

inspect dependencies for github.com/ory/hydra

Analyze the terminal output to locate any version of Github.com/ory/hydra in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.1-0.20260320110106-0b84568fffcc), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Github.com/ory/hydra, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Description Following Admin APIs in Ory Hydra are vulnerable to SQL injection due to flaws in its pagination implementation: - listOAuth2Clients - listOAuth2ConsentSessions - listTrustedOAuth2JwtGrantIssuers Pagination tokens are encrypted using the secret configured in `secrets.pagination`. If this value is not set, Hydra falls back to using `secrets.system`. An attacker who knows this secret can craft their own tokens, including malicious tokens that lead to SQL injection. ## Preconditions This issue can be exploited when the following conditions are met: - One or more **admin APIs** listed above are directly or indirectly accessible to the attacker - The attacker can pass a raw pagination token to the affected API - The configuration value `secrets.pagination` is set and known to the attacker, or `secrets.pagination` is not set and `secrets.system` is known to the attacker ## Impact An attacker can execute arbitrary SQL queries through forged pagination tokens. ## Mitigation As a first line of defense, immediately configure a custom value for `secrets.pagination` by generating a cryptographically secure random secret, for example: ``` openssl rand -base64 32 ``` Next, upgrade **Hydra** to the fixed version **as soon as possible**.

CVE-2026-33504 Affected Github.com/ory/hydra Versions

2 component(s)
Fixed Versions:
2.3.1-0.20260320110106-0b84568fffcc
Product / Package Ecosystem Affected Versions Fixed Version
github.com/ory/hydra
Go
≤ 1.11.10
github.com/ory/hydra/v2
Go
< 2.3.1-0.20260320110106-0b84568fffcc
2.3.1-0.20260320110106-0b84568fffcc

References

Frequently Asked Questions

What is CVE-2026-33504?
CVE-2026-33504 is a security vulnerability in Github.com/ory/hydra involving Ory Hydra has a SQL injection via forged pagination tokens under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Github.com/ory/hydra versions are affected?
Affected versions include releases prior to 2.3.1-0.20260320110106-0b84568fffcc across affected packages: github.com/ory/hydra, github.com/ory/hydra/v2.
What version fixes CVE-2026-33504?
Upgrading to 2.3.1-0.20260320110106-0b84568fffcc (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ory/hydra affected?
Yes, github.com/ory/hydra is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
Is github.com/ory/hydra/v2 affected?
Yes, github.com/ory/hydra/v2 is affected in releases prior to 2.3.1-0.20260320110106-0b84568fffcc. Upgrade your dependency to 2.3.1-0.20260320110106-0b84568fffcc or later.
What is the CVSS score of CVE-2026-33504?
CVE-2026-33504 has a CVSS v3.1 base score of 7.2 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-33504?
CVE-2026-33504 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Go dependencies for CVE-2026-33504?
Run the dependency tree command: 'inspect dependencies for github.com/ory/hydra'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r9w3-57w2-gch2",
  "modified" : "2026-03-27T20:59:48Z",
  "published" : "2026-03-20T20:55:04Z",
  "aliases" : [ "CVE-2026-33504" ],
  "summary" : "Ory Hydra has a SQL injection via forged pagination tokens",
  "details" : "## Description\n\nFollowing Admin APIs in Ory Hydra are vulnerable to SQL injection due to flaws in its pagination implementation:\n\n- listOAuth2Clients\n- listOAuth2ConsentSessions\n- listTrustedOAuth2JwtGrantIssuers\n\nPagination tokens are encrypted using the secret configured in `secrets.pagination`. If this value is not set, Hydra falls back to using `secrets.system`. An attacker who knows this secret can craft their own tokens, including malicious tokens that lead to SQL injection.\n\n## Preconditions\n\nThis issue can be exploited when the following conditions are met:\n\n- One or more **admin APIs** listed above are directly or indirectly accessible to the attacker\n- The attacker can pass a raw pagination token to the affected API\n- The configuration value `secrets.pagination` is set and known to the attacker, or `secrets.pagination` is not set and `secrets.system` is known to the attacker\n\n## Impact\n\nAn attacker can execute arbitrary SQL queries through forged pagination tokens.\n\n## Mitigation\n\nAs a first line of defense, immediately configure a custom value for `secrets.pagination` by generating a cryptographically secure random secret, for example:\n\n```\nopenssl rand -base64 32\n```\n\nNext, upgrade **Hydra** to the fixed version **as soon as possible**.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ory/hydra"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.11.10"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ory/hydra/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.3.1-0.20260320110106-0b84568fffcc"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ory/hydra/security/advisories/GHSA-r9w3-57w2-gch2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33504"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ory/hydra"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-20T20:55:04Z",
    "nvd_published_at" : "2026-03-26T18:16:31Z"
  }
}