Better Auth: Unauthenticated API key creation through api-key plugin
Better Auth is an authentication and authorization library for TypeScript. In versions prior to 1.3.26, unauthenticated attackers can create or modify API keys for any user by passing that user's id in the request body to the `api/auth/api-key/create` route. `session?.user ?? (authRequired ? null : { id: ctx.body.userId })`. When no session exists but `userId` is present in the request body, `authRequired` becomes false and the user object is set to the attacker-controlled ID. Server-only field validation only executes when `authRequired` is true (lines 280-295), allowing attackers to set privileged fields. No additional authentication occurs before the database operation, so the malicious payload is accepted. The same pattern exists in the update endpoint. This is a critical authentication bypass enabling full an unauthenticated attacker can generate an API key for any user and immediately gain complete authenticated access. This allows the attacker to perform any action as the victim user using the api key, potentially compromise the user data and the application depending on the victim's privileges. Version 1.3.26 contains a patch for the issue.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2025-61928
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 6 Nov 2026, 00:13 UTC · Revision 1
Source evidence
Better Auth: Unauthenticated API key creation through api-key plugin
core-osv · Original sourcePublished 9 Oct 2025, 21:24 UTC
Better Auth is an authentication and authorization library for TypeScript. In versions prior to 1.3.26, unauthenticated attackers can create or modify API keys for any user by passing that user's id in the request body to the `api/auth/api-key/create` route. `session?.user ?? (authRequired ? null : { id: ctx.body.userId })`. When no session exists but `userId` is present in the request body, `authRequired` becomes false and the user object is set to the attacker-controlled ID. Server-only field validation only executes when `authRequired` is true (lines 280-295), allowing attackers to set privileged fields. No additional authentication occurs before the database operation, so the malicious payload is accepted. The same pattern exists in the update endpoint. This is a critical authentication bypass enabling full an unauthenticated attacker can generate an API key for any user and immediately gain complete authenticated access. This allows the attacker to perform any action as the victim user using the api key, potentially compromise the user data and the application depending on the victim's privileges. Version 1.3.26 contains a patch for the issue.
osv:CVE-2025-61928
Complete source record
{
"id": "987d661466ce4e2947bbc2e33a48fb228c1c74ecbb520b7f4283e4ae7441ac81",
"url": "https://osv.dev/vulnerability/CVE-2025-61928",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Better Auth: Unauthenticated API key creation through api-key plugin",
"summary": "Better Auth is an authentication and authorization library for TypeScript. In versions prior to 1.3.26, unauthenticated attackers can create or modify API keys for any user by passing that user's id in the request body to the `api/auth/api-key/create` route. `session?.user ?? (authRequired ? null : { id: ctx.body.userId })`. When no session exists but `userId` is present in the request body, `authRequired` becomes false and the user object is set to the attacker-controlled ID. Server-only field validation only executes when `authRequired` is true (lines 280-295), allowing attackers to set privileged fields. No additional authentication occurs before the database operation, so the malicious payload is accepted. The same pattern exists in the update endpoint. This is a critical authentication bypass enabling full an unauthenticated attacker can generate an API key for any user and immediately gain complete authenticated access. This allows the attacker to perform any action as the victim user using the api key, potentially compromise the user data and the application depending on the victim's privileges. Version 1.3.26 contains a patch for the issue.",
"evidence": "osv:CVE-2025-61928",
"products": [],
"severity": "critical",
"structured": {
"id": "CVE-2025-61928",
"aliases": [
"CVE-2025-61928",
"GHSA-99h5-pjcv-gr6v"
],
"metrics": [
{
"type": "CVSS_V4",
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/better-auth/better-auth",
"type": "GIT",
"events": [
{
"introduced": "0"
},
{
"fixed": "6e5ecd69a0b2505e51011e54bba527191556ad30"
},
{
"fixed": "556085067609c508f8c546ceef9003ee8c607d39"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "0"
},
{
"fixed": "1.3.26"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"fixed": "556085067609c508f8c546ceef9003ee8c607d39"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"v1.3.25",
"v1.3.24",
"v1.3.23",
"v1.3.22",
"v1.3.21",
"v1.3.20",
"v1.3.19",
"v1.3.12",
"v1.3.11",
"v1.3.10",
"v1.3.9",
"v1.3.8",
"v1.3.8-beta.1",
"v1.3.7-beta.3",
"v1.3.7-beta.2",
"v1.3.6",
"v1.3.5-beta.7",
"v1.3.5-beta.6",
"v1.3.5-beta.5",
"v1.3.5-beta.4",
"v1.3.5-beta.3",
"v1.3.5-beta.2",
"v1.3.5-beta.1",
"better-auth@1.3.4",
"@better-auth/stripe@1.3.4",
"@better-auth/sso@1.3.4",
"@better-auth/expo@1.3.4",
"@better-auth/cli@1.3.4",
"v1.3.3",
"v1.3.2",
"v1.3.1",
"v1.3.1-beta.1",
"v1.3.0",
"v1.3.0-beta.11",
"v1.3.0-beta.10",
"v1.2.12",
"v1.2.11",
"v1.2.10",
"v1.2.10-beta.1",
"v1.2.9",
"v1.2.9-beta.10",
"v1.2.9-beta.9",
"feat/2867-oidcprovider-trusted",
"v1.2.9-beta.8",
"v1.2.9-beta.7",
"v1.2.9-beta.6",
"v1.2.9-beta.5",
"v1.2.8",
"v1.2.8-beta.8",
"v1.2.8-beta.7",
"v1.2.8-beta.6",
"v1.2.8-beta.4",
"v1.2.8-beta.3",
"v1.2.8-beta.2",
"v1.2.8-beta.1",
"v1.2.7",
"v1.2.7-beta.1",
"v1.2.6",
"v1.2.6-beta.13",
"v1.2.6-beta.12",
"v1.2.6-beta.11",
"v1.2.6-beta.10",
"v1.2.6-beta.9",
"v1.2.6-beta.8",
"v1.2.6-beta.7",
"v1.2.6-beta.6",
"v1.2.6-beta.5",
"v1.2.6-beta.4",
"v1.2.6-beta.3",
"v1.2.6-beta.2",
"v1.2.6-beta.1",
"v1.2.5",
"v1.2.5-beta.10",
"v1.2.5-beta.9",
"v1.2.5-beta.8",
"v1.2.5-beta.7",
"v1.2.5-beta.6",
"v1.2.5-beta.5",
"v1.2.5-beta.4",
"v1.2.5-beta.3",
"v1.2.5-beta.2",
"v1.2.5-beta.1",
"v1.2.4",
"v1.2.4-beta.12",
"v1.2.4-beta.10",
"v1.2.4-beta.9",
"v1.2.4-beta.8",
"v1.2.4-beta.7",
"v1.2.4-beta.6",
"v1.2.4-beta.5",
"v1.2.4-beta.4",
"v1.2.4-beta.3",
"v1.2.4-beta.2",
"v1.2.4-beta.1",
"v1.2.3",
"v1.2.3-beta.3",
"v1.2.3-beta.2",
"v1.2.3-beta.1",
"v1.2.2",
"v1.2.2-beta.6",
"v1.2.2-beta.5",
"v1.2.2-beta.4",
"v1.2.2-beta.3",
"v1.2.2-beta.2",
"v1.2.2-beta.1",
"v1.2.1",
"v1.2.1-beta.8",
"v1.2.1-beta.7",
"v1.2.1-beta.6",
"v1.2.1-beta.5",
"v1.2.1-beta.4",
"v1.2.1-beta.3",
"v1.2.1-beta.2",
"v1.2.1-beta.1",
"v1.2.0",
"v1.2.0-beta.19",
"v1.2.0-beta.18",
"v1.2.0-beta.17",
"v1.2.0-beta.16",
"v1.2.0-beta.15",
"v1.2.0-beta.14",
"v1.2.0-beta.13",
"v1.2.0-beta.12",
"v1.2.0-beta.11",
"v1.2.0-beta.10",
"v1.2.0-beta.9",
"v1.2.0-beta.8",
"v1.2.0-beta.7",
"v1.2.0-beta.6",
"v1.2.0-beta.5",
"v1.2.0-beta.4",
"v1.2.0-beta.3",
"v1.2.0-beta.2",
"v1.1.15-beta.6",
"v1.1.15-beta.5",
"v1.1.15-beta.4",
"v1.1.15-beta.3",
"v1.1.15-beta.2",
"v1.1.15-beta.1",
"v1.1.14",
"v1.1.14-beta.6",
"v1.1.14-beta.5",
"v1.1.14-beta.4",
"v1.1.14-beta.3",
"v1.1.14-beta.2",
"v1.1.14-beta.1",
"v1.1.13",
"v1.1.13-beta.3",
"v1.1.13-beta.2",
"v1.1.13-beta.1",
"v1.1.12",
"v1.1.12-beta.4",
"v1.1.12-beta.3",
"v1.1.12-beta.2",
"v1.1.11",
"v1.1.11-beta.1",
"v1.1.10",
"v1.1.10-beta.2",
"v1.1.10-beta.1",
"v1.1.9",
"v1.1.9-beta.1",
"v1.1.8",
"v1.1.8-beta.3",
"v1.1.8-beta.2",
"v1.1.8-beta.1",
"v1.1.7",
"v1.1.6",
"v1.1.5",
"v1.1.4",
"v1.1.4-beta.2",
"v1.1.4-beta.1",
"v1.1.3",
"v1.1.3-beta.6",
"v1.1.2",
"v1.1.2-beta.4",
"v1.1.2-beta.3",
"v1.1.2-beta.2",
"v1.1.2-beta.1",
"v1.1.1",
"v1.1.0",
"v1.0.23-beta.6",
"v1.0.23-beta.2",
"v1.0.22",
"v1.0.22-beta.4",
"v1.0.22-beta.3",
"v1.0.22-beta.2",
"v1.0.22-beta.1",
"v1.0.21",
"v1.0.20",
"v1.0.19",
"v1.0.18",
"v1.0.17",
"v1.0.16",
"v1.0.16-beta.2",
"v1.0.16-beta.1",
"v1.0.15",
"v1.0.14",
"v1.0.13",
"v1.0.12",
"v1.0.12-beta.3",
"v1.0.12-beta.2",
"v1.0.12-beta.1",
"v1.0.11",
"v1.0.11-beta.8",
"v1.0.11-beta.7",
"v1.0.11-beta.6",
"v1.0.11-beta.5",
"v1.0.11-beta.4",
"v1.0.11-beta.2",
"v1.0.10",
"v1.0.10-beta.3",
"v1.0.10-beta.2",
"v1.0.10-beta.1",
"v1.0.9",
"v1.0.9-beta.7",
"v1.0.9-beta.6",
"v1.0.9-beta.5",
"v1.0.9-beta.3",
"v1.0.9-beta.1",
"v1.0.8",
"v1.0.8-beta.4",
"v1.0.8-beta.2",
"v1.0.8-beta.1",
"v1.0.7",
"v1.0.6",
"v1.0.5",
"v1.0.4",
"v1.0.3",
"v1.0.2",
"v0.8.9-beta.2",
"v0.8.8",
"v0.8.8-beta.2",
"v0.8.8-beta.1",
"v0.8.7-beta.5",
"v0.8.7-beta.3",
"v0.8.7-beta.2",
"v0.8.7-beta.1",
"v0.8.6-beta.6",
"v0.8.6-beta.3",
"v0.8.6-beta.2",
"v0.8.6-beta.1",
"v0.8.5",
"v0.8.5-beta.3",
"v0.8.5-beta.2",
"v0.8.5-beta.1",
"v0.8.4",
"v0.8.4-beta.7",
"v0.8.4-beta.6",
"v0.8.4-beta.5",
"v0.8.4-beta.4",
"v0.8.3-beta.6",
"v0.8.3-beta.5",
"v0.8.3-beta.4",
"v0.8.3-beta.3",
"v0.8.2",
"v0.8.2-beta.3",
"v0.8.2-beta.1",
"v0.8.1",
"v0.8.1-beta.5",
"v0.8.1-beta.4",
"v0.8.1-beta.3",
"v0.8.1-beta.2",
"v0.8.1-beta.1",
"v0.8.0",
"v0.7.6-beta.4",
"v0.7.6-beta.3",
"v0.7.6-beta.2",
"v0.7.6-beta.1",
"v0.7.5",
"v0.7.5-beta.9",
"v0.7.5-beta.8",
"v0.7.5-beta.7",
"v0.7.5-beta.6",
"v0.7.5-beta.5",
"v0.7.5-beta.4",
"v0.7.5-beta.3",
"v0.7.5-beta.2",
"v0.7.5-beta.1",
"v0.7.4",
"v0.7.3",
"v0.7.3-beta.11",
"v0.7.3-beta.9",
"v0.7.3-beta.8",
"v0.7.3-beta.7",
"v0.7.3-beta.6",
"v0.7.3-beta.5",
"v0.7.3-beta.4",
"v0.7.3-beta.3",
"v0.7.3-beta.2",
"v0.7.3-beta.1",
"v0.7.2",
"v0.7.2-beta.5",
"v0.7.2-beta.4",
"v0.7.1",
"v0.7.1-beta.6",
"v0.7.1-beta.4",
"v0.7.1-beta.3",
"v0.7.1-beta.1",
"v0.7.0",
"v0.7.0-beta.1",
"v0.6.3-beta.5",
"v0.6.2",
"v0.6.2-beta.8",
"v0.6.1",
"v0.6.1-beta.9",
"v0.6.1-beta.7",
"v0.6.1-beta.5",
"v0.6.1-beta.4",
"v0.6.1-beta.3",
"v0.6.1-beta.2",
"v0.6.1-beta.1",
"v0.6.0",
"v0.6.0-beta.1",
"v0.5.4-beta.6",
"v0.5.4-beta.5",
"v0.5.4-beta.4",
"v0.5.4-beta.3",
"v0.5.3",
"v0.5.3-beta.17",
"v0.5.3-beta.16",
"v0.5.3-beta.15",
"v0.5.3-beta.13",
"v0.5.3-beta.11",
"v0.5.3-beta.9",
"v0.5.3-beta.8",
"v0.5.3-beta.7",
"v0.5.3-beta.6",
"v0.5.3-beta.5",
"v0.5.3-beta.4",
"v0.5.3-beta.3",
"v0.5.3-beta.2",
"v0.5.3-beta.1",
"v0.5.2-beta.20",
"v0.5.2-beta.18",
"v0.5.2-beta.17",
"v0.5.2-beta.16",
"v0.5.2-beta.14",
"v0.5.2-beta.13",
"v0.5.2-beta.12",
"v0.5.2-beta.11",
"v0.5.2-beta.10",
"v0.5.2-beta.9",
"v0.5.2-beta.8",
"v0.5.2-beta.7",
"v0.5.2-beta.6",
"v0.5.2-beta.5",
"v0.5.2-beta.2",
"v0.5.1",
"v0.5.1-beta.6",
"v0.5.1-beta.5",
"v0.5.1-beta.4",
"v0.5.1-beta.3",
"v0.5.1-beta.2",
"v0.5.1-beta.1",
"v0.5.0",
"v0.4.14-beta.2",
"v0.4.14-beta.1",
"v0.4.13",
"v0.4.12",
"v0.4.12-beta.7",
"v0.4.12-beta.5",
"v0.4.12-beta.4",
"v0.4.12-beta.3",
"v0.4.12-beta.2",
"v0.4.12-beta.1",
"v0.4.11",
"v0.4.11-beta.3",
"v0.4.11-beta.2",
"v0.4.11-beta.1",
"v0.4.10",
"v0.4.10-beta.5",
"v0.4.10-beta.4",
"v0.4.9-beta.11",
"v0.4.9-beta.7",
"v0.4.9-beta.10",
"v0.4.9-beta.9",
"v0.4.9-beta.8",
"v0.4.9-beta.6",
"v0.4.9-beta.5",
"v0.4.9-beta.4",
"v0.4.9-beta.3",
"v0.4.9-beta.2",
"v0.4.9-beta.1",
"v0.4.8",
"v0.4.7",
"v0.4.7-beta.2",
"v0.4.7-beta.1",
"v0.4.5",
"v0.4.4",
"v0.4.4-beta.1",
"v0.4.3",
"v0.4.3-beta.1",
"v0.4.2",
"v0.4.1",
"v0.4.0",
"v0.3.6",
"v0.3.5",
"v0.3.5-beta.8",
"v0.3.5-beta.7",
"v0.3.5-beta.6",
"v0.3.5-beta.5",
"v0.3.5-beta.4",
"v0.3.5-beta.2",
"v0.3.5-beta.1",
"v0.3.4",
"v0.3.4-beta.6",
"v0.3.4-beta.2",
"v0.3.4-beta.1",
"v0.3.3",
"v0.3.3-beta.12",
"v0.3.3-beta.11",
"v0.3.3-beta.10",
"v0.3.3-beta.9",
"v0.3.3-beta.8",
"v0.3.3-beta.5",
"v0.3.3-beta.4",
"v0.3.3-beta.3",
"v0.3.3-beta.2",
"v0.3.3-beta.1",
"v0.3.2",
"v0.3.0",
"v0.2.11",
"v0.2.10",
"v0.2.9",
"v0.2.9-beta.9",
"v0.2.9-beta.8",
"v0.2.9-beta.7",
"v0.2.9-beta.6",
"v0.2.9-beta.5",
"v0.2.9-beta.4",
"v0.2.9-beta.2",
"v0.2.9-beta.1",
"v0.2.8",
"v0.2.8-beta.13",
"v0.2.8-beta.12",
"v0.2.8-beta.11",
"v0.2.8-beta.10",
"v0.2.8-beta.9",
"v0.2.8-beta.8",
"v0.2.8-beta.1",
"v0.2.6",
"v0.2.6-beta.10",
"v0.2.6-beta.9",
"v0.2.6-beta.8",
"v0.2.6-beta.7",
"v0.2.6-beta.6",
"v0.2.6-beta.5",
"v0.2.6-beta.4",
"v0.2.6-beta.3",
"v0.2.6-beta.1",
"v0.2.5",
"v0.2.5-beta.4",
"v0.2.5-beta.3",
"v0.2.5-beta.1",
"v0.2.3",
"v0.2.2",
"v0.2.1",
"v0.2.1-beta.1",
"v0.1.1-beta.6",
"v0.1.1-beta.5",
"v0.1.1-beta.4",
"v0.1.1-beta.2",
"v0.1.1-beta.1",
"v0.1.0",
"v0.0.10-beta.27",
"v0.0.10-beta.26",
"v0.0.10-beta.25",
"v0.0.10-beta.24",
"v0.0.10-beta.23",
"v0.0.10-beta.22",
"v0.0.10-beta.21",
"v0.0.10-beta.20",
"v0.0.10-beta.19",
"v0.0.10-beta.18",
"v0.0.10-beta.17",
"v0.0.10-beta.16",
"v0.0.10-beta.15",
"v0.0.10-beta.14",
"v0.0.10-beta.13",
"v0.0.10-beta.12",
"v0.0.10-beta.11",
"v0.0.10-beta.10",
"v0.0.10-beta.9",
"v0.0.10-beta.8",
"v0.0.10-beta.7",
"v0.0.10-beta.6",
"v0.0.10-beta.5",
"v0.0.10-beta.4",
"v0.0.10-beta.3",
"v0.0.10-beta.2",
"v0.0.10-beta.1",
"v0.0.9",
"v0.0.9-beta.38",
"v0.0.9-beta.37",
"v0.0.9-beta.36",
"v0.0.9-beta.35",
"v0.0.9-beta.34",
"v0.0.9-beta.33",
"v0.0.9-beta.32",
"v0.0.9-beta.31",
"v0.0.9-beta.30",
"v0.0.9-beta.29",
"v0.0.9-beta.28",
"v0.0.9-beta.27",
"v0.0.9-beta.26",
"v0.0.9-beta.25",
"v0.0.9-beta.24",
"v0.0.9-beta.23",
"v0.0.9-beta.22",
"v0.0.9-beta.21",
"v0.0.9-beta.20",
"v0.0.9-beta.19",
"v0.0.9-beta.18",
"v0.0.9-beta.17",
"v0.0.9-beta.16",
"v0.0.9-beta.15",
"v0.0.9-beta.14",
"v0.0.9-beta.13",
"v0.0.9-beta.12",
"v0.0.9-beta.11",
"v0.0.9-beta.10",
"v0.0.9-beta.9",
"v0.0.9-beta.8",
"v0.0.9-beta.7",
"v0.0.9-beta.6",
"v0.0.9-beta.5",
"v0.0.9-beta.4",
"v0.0.9-beta.3",
"v0.0.9-beta.2",
"v0.0.9-beta.1",
"v0.0.8",
"v0.0.8-beta.29",
"v0.0.8-beta.28",
"v0.0.8-beta.27",
"v0.0.8-beta.26",
"v0.0.8-beta.25",
"v0.0.8-beta.8",
"v0.0.8-beta.24",
"v0.0.8-beta.23",
"v0.0.8-beta.22",
"v0.0.8-beta.21",
"v0.0.8-beta.20",
"v0.0.8-beta.19",
"v0.0.8-beta.18",
"v0.0.8-beta.17",
"v0.0.8-beta.16",
"v0.0.8-beta.15",
"v0.0.8-beta.14",
"v0.0.8-beta.13",
"v0.0.8-beta.12",
"v0.0.8-beta.11",
"v0.0.8-beta.10",
"v0.0.8-beta.9",
"v0.0.8-beta.7",
"v0.0.8-beta.6",
"v0.0.8-beta.5",
"v0.0.8-beta.4",
"v0.0.8-beta.3",
"v0.0.8-beta.2",
"v0.0.8-beta.1",
"v0.0.7",
"v0.0.6",
"v0.0.5",
"v0.0.4",
"v0.0.3",
"v0.0.2"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-61928.json"
}
}
],
"modified": "2026-10-28T02:30:45.236508415Z",
"provider": "osv",
"references": [
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/61xxx/CVE-2025-61928.json",
"https://github.com/better-auth/better-auth/security/advisories/GHSA-99h5-pjcv-gr6v",
"https://nvd.nist.gov/vuln/detail/CVE-2025-61928",
"https://github.com/better-auth/better-auth/commit/556085067609c508f8c546ceef9003ee8c607d39"
],
"provider_metadata": {
"cwe_ids": [
"CWE-285",
"CWE-306"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/61xxx/CVE-2025-61928.json"
}
},
"related_cves": [
{
"value": "CVE-2025-61928",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 513385,
"published_at": "2025-10-09T21:24:37.541+00:00"
}