Vulnerabilities in pkg:golang/github.com/go-pkgz/auth

PACKAGE
Advisory Identifier: GHSA-f6qq-3m3h-4g42
Advisory Summary

CVE-2026-42560 is a CRITICAL (CVSS 9.1) patreon provider assigns the same vulnerability (CWE-287: Improper Authentication) affecting auth libraries in the Go ecosystem. The issue involves patreon provider assigns the same local user id to every authenticated patreon account, enabling cross‑user impersonation. Remediation is available by upgrading affected packages to version 1.25.2, 2.1.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/go-pkgz/auth

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/go-pkgz/auth. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-f6qq-3m3h-4g42 CVE-2026-42560 CRITICAL auth: Patreon provider assigns the same local user ID to every authenticated Patreon account, enabling cross‑user impersonation

CVE-2026-42560 at a Glance

CVE Identifier CVE-2026-42560
GHSA Identifier GHSA-f6qq-3m3h-4g42
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-287: Improper Authentication
Affected Product auth
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.1

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

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

How to Fix CVE-2026-42560

To remediate this vulnerability, upgrade all affected auth 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/go-pkgz/auth fixed: 1.25.2
Upgrade github.com/go-pkgz/auth to 1.25.2
github.com/go-pkgz/auth/v2 fixed: 2.1.2
Upgrade github.com/go-pkgz/auth/v2 to 2.1.2
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/go-pkgz/auth

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-42560, inspect your project dependencies for auth:

inspect dependencies for github.com/go-pkgz/auth

Analyze the terminal output to locate any version of auth in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.25.2), 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-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In auth, 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

### Summary The Patreon OAuth provider maps every authenticated Patreon account to the same local `user.ID`, instead of deriving a unique ID from the Patreon account returned by Patreon. In practice, this means all Patreon-authenticated users of an application using this library are collapsed into a single local identity. Any application that trusts `token.User.ID` as the stable account key can end up mixing or fully merging unrelated Patreon users, which can lead to cross-account access, privilege confusion, and subscription-state leakage. ### Details The bug is in the Patreon provider's user-mapping logic. Both the root module and the `v2` module create a fresh empty `token.User{}` and then derive the Patreon ID from `userInfo.ID` before that field has been populated: ```go mapUser: func(data UserData, bdata []byte) token.User { userInfo := token.User{} uinfoJSON := uinfo{} if err := json.Unmarshal(bdata, &uinfoJSON); err == nil { userInfo.ID = "patreon_" + token.HashID(sha1.New(), userInfo.ID) userInfo.Name = uinfoJSON.Data.Attributes.FullName userInfo.Picture = uinfoJSON.Data.Attributes.ImageURL ... } return userInfo } ``` Affected locations: - `provider/providers.go:257` - `v2/provider/providers.go:257` At that point, `userInfo.ID` is still the empty string, so the effective result is always: ```text patreon_ + sha1("") ``` which is: ```text patreon_da39a3ee5e6b4b0d3255bfef95601890afd80709 ``` for every Patreon user. The code appears to have intended to hash the Patreon user ID returned by Patreon, i.e. `uinfoJSON.Data.ID`, but instead hashes the uninitialized destination field. Why this matters: 1. Patreon is a documented, supported provider. 2. The library documents `token.User.ID` as the hashed user ID exposed to consumers. 3. The OAuth flow stores the mapped user object in JWT claims, and middleware later injects that object into the request context verbatim, consuming handlers receive the provider's wrong user.ID as authoritative identity. Relevant flow in `v2`: - `v2/provider/oauth2.go:207` calls `u := p.mapUser(...)` - `v2/provider/oauth2.go:223` stores `u` in token claims - `v2/middleware/auth.go:154` copies `*claims.User` into request context The existing tests already encode the broken behavior: - `provider/providers_test.go:179` - `provider/providers_test.go:204` - `v2/provider/providers_test.go:179` - `v2/provider/providers_test.go:204` Those tests assert the constant empty-string hash value for Patreon users. ### PoC This can be reproduced locally without contacting Patreon by exercising the provider's `mapUser` logic with two different Patreon payloads. From the repository root, create a temporary test file: `v2/provider/patreon_repro_test.go` ```go package provider import "testing" func TestPatreonSharedIdentity(t *testing.T) { r := NewPatreon(Params{ URL: "http://example.com", Cid: "cid", Csecret: "secret", }) a := r.mapUser(UserData{}, []byte(`{ "data": { "attributes": { "full_name": "Alice", "image_url": "https://example.com/alice.png" }, "id": "1111111" } }`)) b := r.mapUser(UserData{}, []byte(`{ "data": { "attributes": { "full_name": "Bob", "image_url": "https://example.com/bob.png" }, "id": "9999999" } }`)) if a.ID != b.ID { t.Fatalf("expected IDs to collide, got %q and %q", a.ID, b.ID) } t.Logf("Alice -> %s", a.ID) t.Logf("Bob -> %s", b.ID) } ``` Then run: ```bash cd v2 go test ./provider -run TestPatreonSharedIdentity -v ``` Expected result: ```text Alice -> patreon_da39a3ee5e6b4b0d3255bfef95601890afd80709 Bob -> patreon_da39a3ee5e6b4b0d3255bfef95601890afd80709 ``` I also confirmed this locally with three distinct Patreon `data.id` values; all of them produced the same `patreon_da39...` identity. You can also see the same issue reflected in the existing built-in tests, which already assert this constant Patreon ID. ### Impact This is an authentication/identity-collision vulnerability in the Patreon provider. Impacted users: - applications using `github.com/go-pkgz/auth/provider.NewPatreon` - applications using `github.com/go-pkgz/auth/v2/provider.NewPatreon` - applications that rely on `token.User.ID` as the stable local account identifier, or use it to key roles, profiles, entitlements, subscription state, or other authorization-relevant records Practical impact: - all Patreon-authenticated users in the same application can collapse into the same local account - data associated with one Patreon user may be exposed to or overwritten by another Patreon user - Patreon-specific attributes such as `is_paid_sub` can leak across unrelated users - if a target application grants any elevated privileges to the local account keyed by this shared Patreon ID, those privileges can effectively apply to every Patreon login ### Suggested Fix The Patreon provider should derive the user ID from the Patreon account ID returned by Patreon, not from the uninitialized destination struct. In both of these files: - `provider/providers.go` - `v2/provider/providers.go` change: ```go userInfo.ID = "patreon_" + token.HashID(sha1.New(), userInfo.ID) ``` to: ```go userInfo.ID = "patreon_" + token.HashID(sha1.New(), uinfoJSON.Data.ID) ``` I would also recommend adding a regression test with at least two different Patreon `data.id` values and asserting that they produce different local IDs. Because the current bug causes all Patreon users to share a single local ID, maintainers may also want to consider migration guidance for consumers who already have Patreon-linked local accounts created under the broken identifier.

CVE-2026-42560 Affected auth Versions

2 component(s)
Fixed Versions:
1.25.22.1.2
Product / Package Ecosystem Affected Versions Fixed Version
github.com/go-pkgz/auth
Go
≥ 1.18.0
< 1.25.2
1.25.2
github.com/go-pkgz/auth/v2
Go
≥ 2.0.0
< 2.1.2
2.1.2

References

Frequently Asked Questions

What is CVE-2026-42560?
CVE-2026-42560 is a security vulnerability in auth involving Patreon provider assigns the same local user ID to every authenticated Patreon account, enabling cross‑user impersonation under CWE-287: Improper Authentication.
Which auth versions are affected?
Affected versions include releases prior to 1.25.2, 2.1.2 across affected packages: github.com/go-pkgz/auth, github.com/go-pkgz/auth/v2.
What version fixes CVE-2026-42560?
Upgrading to 1.25.2, 2.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/go-pkgz/auth affected?
Yes, github.com/go-pkgz/auth is affected in releases prior to 1.25.2. Upgrade your dependency to 1.25.2 or later.
Is github.com/go-pkgz/auth/v2 affected?
Yes, github.com/go-pkgz/auth/v2 is affected in releases prior to 2.1.2. Upgrade your dependency to 2.1.2 or later.
What is the CVSS score of CVE-2026-42560?
CVE-2026-42560 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-42560?
CVE-2026-42560 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check Go dependencies for CVE-2026-42560?
Run the dependency tree command: 'inspect dependencies for github.com/go-pkgz/auth'. 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-f6qq-3m3h-4g42",
  "modified" : "2026-05-13T13:41:17Z",
  "published" : "2026-04-30T20:47:24Z",
  "aliases" : [ "CVE-2026-42560" ],
  "summary" : "auth: Patreon provider assigns the same local user ID to every authenticated Patreon account, enabling cross‑user impersonation",
  "details" : "### Summary\nThe Patreon OAuth provider maps every authenticated Patreon account to the same local `user.ID`, instead of deriving a unique ID from the Patreon account returned by Patreon.\n\nIn practice, this means all Patreon-authenticated users of an application using this library are collapsed into a single local identity. Any application that trusts `token.User.ID` as the stable account key can end up mixing or fully merging unrelated Patreon users, which can lead to cross-account access, privilege confusion, and subscription-state leakage.\n\n### Details\nThe bug is in the Patreon provider's user-mapping logic.\n\nBoth the root module and the `v2` module create a fresh empty `token.User{}` and then derive the Patreon ID from `userInfo.ID` before that field has been populated:\n\n```go\nmapUser: func(data UserData, bdata []byte) token.User {\n    userInfo := token.User{}\n\n    uinfoJSON := uinfo{}\n    if err := json.Unmarshal(bdata, &uinfoJSON); err == nil {\n        userInfo.ID = \"patreon_\" + token.HashID(sha1.New(), userInfo.ID)\n        userInfo.Name = uinfoJSON.Data.Attributes.FullName\n        userInfo.Picture = uinfoJSON.Data.Attributes.ImageURL\n        ...\n    }\n    return userInfo\n}\n```\n\nAffected locations:\n\n- `provider/providers.go:257`\n- `v2/provider/providers.go:257`\n\nAt that point, `userInfo.ID` is still the empty string, so the effective result is always:\n\n```text\npatreon_ + sha1(\"\")\n```\n\nwhich is:\n\n```text\npatreon_da39a3ee5e6b4b0d3255bfef95601890afd80709\n```\n\nfor every Patreon user.\n\nThe code appears to have intended to hash the Patreon user ID returned by Patreon, i.e. `uinfoJSON.Data.ID`, but instead hashes the uninitialized destination field.\n\nWhy this matters:\n\n1. Patreon is a documented, supported provider.\n2. The library documents `token.User.ID` as the hashed user ID exposed to consumers.\n3. The OAuth flow stores the mapped user object in JWT claims, and middleware later injects that object into the request context verbatim, consuming handlers receive the provider's wrong user.ID as authoritative identity.\n\nRelevant flow in `v2`:\n\n- `v2/provider/oauth2.go:207` calls `u := p.mapUser(...)`\n- `v2/provider/oauth2.go:223` stores `u` in token claims\n- `v2/middleware/auth.go:154` copies `*claims.User` into request context\n\nThe existing tests already encode the broken behavior:\n\n- `provider/providers_test.go:179`\n- `provider/providers_test.go:204`\n- `v2/provider/providers_test.go:179`\n- `v2/provider/providers_test.go:204`\n\nThose tests assert the constant empty-string hash value for Patreon users.\n\n### PoC\nThis can be reproduced locally without contacting Patreon by exercising the provider's `mapUser` logic with two different Patreon payloads.\n\nFrom the repository root, create a temporary test file:\n\n`v2/provider/patreon_repro_test.go`\n\n```go\npackage provider\n\nimport \"testing\"\n\nfunc TestPatreonSharedIdentity(t *testing.T) {\n    r := NewPatreon(Params{\n        URL:     \"http://example.com\",\n        Cid:     \"cid\",\n        Csecret: \"secret\",\n    })\n\n    a := r.mapUser(UserData{}, []byte(`{\n        \"data\": {\n            \"attributes\": {\n                \"full_name\": \"Alice\",\n                \"image_url\": \"https://example.com/alice.png\"\n            },\n            \"id\": \"1111111\"\n        }\n    }`))\n\n    b := r.mapUser(UserData{}, []byte(`{\n        \"data\": {\n            \"attributes\": {\n                \"full_name\": \"Bob\",\n                \"image_url\": \"https://example.com/bob.png\"\n            },\n            \"id\": \"9999999\"\n        }\n    }`))\n\n    if a.ID != b.ID {\n        t.Fatalf(\"expected IDs to collide, got %q and %q\", a.ID, b.ID)\n    }\n\n    t.Logf(\"Alice -> %s\", a.ID)\n    t.Logf(\"Bob   -> %s\", b.ID)\n}\n```\n\nThen run:\n\n```bash\ncd v2\ngo test ./provider -run TestPatreonSharedIdentity -v\n```\n\nExpected result:\n\n```text\nAlice -> patreon_da39a3ee5e6b4b0d3255bfef95601890afd80709\nBob   -> patreon_da39a3ee5e6b4b0d3255bfef95601890afd80709\n```\n\nI also confirmed this locally with three distinct Patreon `data.id` values; all of them produced the same `patreon_da39...` identity.\n\nYou can also see the same issue reflected in the existing built-in tests, which already assert this constant Patreon ID.\n\n### Impact\nThis is an authentication/identity-collision vulnerability in the Patreon provider.\n\nImpacted users:\n\n- applications using `github.com/go-pkgz/auth/provider.NewPatreon`\n- applications using `github.com/go-pkgz/auth/v2/provider.NewPatreon`\n- applications that rely on `token.User.ID` as the stable local account identifier, or use it to key roles, profiles, entitlements, subscription state, or other authorization-relevant records\n\nPractical impact:\n\n- all Patreon-authenticated users in the same application can collapse into the same local account\n- data associated with one Patreon user may be exposed to or overwritten by another Patreon user\n- Patreon-specific attributes such as `is_paid_sub` can leak across unrelated users\n- if a target application grants any elevated privileges to the local account keyed by this shared Patreon ID, those privileges can effectively apply to every Patreon login\n\n\n### Suggested Fix\nThe Patreon provider should derive the user ID from the Patreon account ID returned by Patreon, not from the uninitialized destination struct.\n\nIn both of these files:\n\n- `provider/providers.go`\n- `v2/provider/providers.go`\n\nchange:\n\n```go\nuserInfo.ID = \"patreon_\" + token.HashID(sha1.New(), userInfo.ID)\n```\n\nto:\n\n```go\nuserInfo.ID = \"patreon_\" + token.HashID(sha1.New(), uinfoJSON.Data.ID)\n```\n\nI would also recommend adding a regression test with at least two different Patreon `data.id` values and asserting that they produce different local IDs.\n\nBecause the current bug causes all Patreon users to share a single local ID, maintainers may also want to consider migration guidance for consumers who already have Patreon-linked local accounts created under the broken identifier.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-pkgz/auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.18.0"
      }, {
        "fixed" : "1.25.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.25.1"
    }
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/go-pkgz/auth/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.1.1"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-pkgz/auth/security/advisories/GHSA-f6qq-3m3h-4g42"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42560"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-pkgz/auth/commit/c0b15ee72a8401da83c01781c16636c521f42698"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-pkgz/auth"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-pkgz/auth/releases/tag/v1.25.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-pkgz/auth/releases/tag/v2.1.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-30T20:47:24Z",
    "nvd_published_at" : "2026-05-09T06:16:10Z"
  }
}