CVE-2025-53535: Better auth Better Auth Open Redirect Vulnerability Vulnerability

LOW
Advisory Identifier: GHSA-36rg-gfq2-3h56
CWE-601
Published
Advisory Summary

CVE-2025-53535 is a LOW better auth open redirect vulnerability vulnerability (CWE-601: URL Redirection to Untrusted Site ('Open Redirect')) affecting Better auth libraries in the npm ecosystem. The issue involves better auth open redirect vulnerability in origincheck middleware affects multiple routes. Remediation is available by upgrading affected packages to version 1.2.10.

CVE-2025-53535 at a Glance

CVE Identifier CVE-2025-53535
GHSA Identifier GHSA-36rg-gfq2-3h56
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-601: URL Redirection to Untrusted Site ('Open Redirect')
Affected Product Better auth
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-53535

To remediate this vulnerability, upgrade all affected Better 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.

better-auth fixed: 1.2.10
npm install better-auth@1.2.10
Verify Direct and Transitive Dependencies

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

npm ls better-auth

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-53535, inspect your project dependencies using npm:

npm ls better-auth

Analyze the terminal output to locate any version of Better auth in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.10), your application is affected.

Note: The npm ls better-auth command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect'), where the web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect. In Better 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 An open redirect has been found in the `originCheck` middleware function, which affects the following routes: `/verify-email`, `/reset-password/:token`, `/delete-user/callback`, `/magic-link/verify`, `/oauth-proxy-callback`. ### Details In the `matchesPattern` function, `url.startsWith(` can be deceived with a `url` that starts with one of the `trustedOrigins`. ```jsx const matchesPattern = (url: string, pattern: string): boolean => { if (url.startsWith("/")) { return false; } if (pattern.includes("*")) { return wildcardMatch(pattern)(getHost(url)); } return url.startsWith(pattern); }; ``` ### Open Redirect PoCs ```jsx export const auth = betterAuth({ baseURL: 'http://localhost:3000', trustedOrigins: [ "http://trusted.com" ], emailAndPassword: { ... }, }) ``` #### `/reset-password/:token` <img width="481" alt="image" src="https://github.com/user-attachments/assets/46e7871a-1dad-4375-af94-0446e29aaab6" /> <br/> <img width="518" alt="image 1" src="https://github.com/user-attachments/assets/83abfb53-6fc9-4d1f-918d-9b4ce093c808" /> #### `/verify-email` <img width="549" alt="image" src="https://github.com/user-attachments/assets/7dd424b7-42a4-4616-aa73-fcc2e3eeb309" /> <br/> <img width="436" alt="image" src="https://github.com/user-attachments/assets/54f11636-0a3e-4e83-9a09-57c5e8ba98cd" /> #### `/delete-user/callback` <img width="545" alt="image" src="https://github.com/user-attachments/assets/2ff1b217-d069-48fb-81c1-f8c8792d34a4" /> <br/> <img width="492" alt="image" src="https://github.com/user-attachments/assets/71df11db-9d38-4f34-abe1-add9d60b3486" /> #### `/magic-link/verify` <img width="379" alt="image" src="https://github.com/user-attachments/assets/6b6b6a8a-59b6-4a65-9df3-57d5b2f6eb0f" /> <br/> <img width="413" alt="image" src="https://github.com/user-attachments/assets/82a5c9c6-2ea0-44eb-af48-40732657b59e" /> #### `/oauth-proxy-callback` <img width="548" alt="image" src="https://github.com/user-attachments/assets/d8d2ee51-e9fd-4337-bec3-a70afd1ceacb" /> <br/> <img width="544" alt="image" src="https://github.com/user-attachments/assets/f097d406-b965-4f85-b124-9b0ef1cc2689" /> ### Impact Untrusted open redirects in various routes.

CVE-2025-53535 Affected Better auth Versions

1 component(s)
Fixed Versions:
1.2.10
Product / Package Ecosystem Affected Versions Fixed Version
better-auth
npm
< 1.2.10
1.2.10

References

Frequently Asked Questions

What is CVE-2025-53535?
CVE-2025-53535 is a security vulnerability in Better auth involving Better Auth Open Redirect Vulnerability in originCheck Middleware Affects Multiple Routes under CWE-601: URL Redirection to Untrusted Site ('Open Redirect').
Which Better auth versions are affected?
Affected versions include releases prior to 1.2.10 across affected packages: better-auth.
What version fixes CVE-2025-53535?
Upgrading to 1.2.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is better-auth affected?
Yes, better-auth is affected in releases prior to 1.2.10. Upgrade your dependency to 1.2.10 or later.
What CWE is associated with CVE-2025-53535?
CVE-2025-53535 is classified under CWE-601: URL Redirection to Untrusted Site ('Open Redirect') (The web application accepts a user-controlled input that specifies a link to an external site, and uses that link in a redirect.).
How can I check npm dependencies for CVE-2025-53535?
Run the dependency tree command: 'npm ls better-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-36rg-gfq2-3h56",
  "modified" : "2025-07-07T22:13:14Z",
  "published" : "2025-07-07T22:13:14Z",
  "aliases" : [ "CVE-2025-53535" ],
  "summary" : "Better Auth Open Redirect Vulnerability in originCheck Middleware Affects Multiple Routes",
  "details" : "### Summary\n\nAn open redirect has been found in the `originCheck` middleware function, which affects the following routes: `/verify-email`, `/reset-password/:token`, `/delete-user/callback`, `/magic-link/verify`, `/oauth-proxy-callback`.\n\n### Details\n\nIn the `matchesPattern` function, `url.startsWith(` can be deceived with a `url` that starts with one of the `trustedOrigins`.\n\n```jsx\n\t\tconst matchesPattern = (url: string, pattern: string): boolean => {\n\t\t\tif (url.startsWith(\"/\")) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (pattern.includes(\"*\")) {\n\t\t\t\treturn wildcardMatch(pattern)(getHost(url));\n\t\t\t}\n\t\t\treturn url.startsWith(pattern);\n\t\t};\n```\n\n### Open Redirect PoCs\n\n```jsx\nexport const auth = betterAuth({\n\tbaseURL: 'http://localhost:3000',\n\ttrustedOrigins: [\n\t\t\"http://trusted.com\"\n\t],\n\temailAndPassword: {\n\t\t...\n\t},\n})\n```\n\n#### `/reset-password/:token`\n\n<img width=\"481\" alt=\"image\" src=\"https://github.com/user-attachments/assets/46e7871a-1dad-4375-af94-0446e29aaab6\" />\n<br/>\n<img width=\"518\" alt=\"image 1\" src=\"https://github.com/user-attachments/assets/83abfb53-6fc9-4d1f-918d-9b4ce093c808\" />\n\n#### `/verify-email`\n\n<img width=\"549\" alt=\"image\" src=\"https://github.com/user-attachments/assets/7dd424b7-42a4-4616-aa73-fcc2e3eeb309\" />\n<br/>\n<img width=\"436\" alt=\"image\" src=\"https://github.com/user-attachments/assets/54f11636-0a3e-4e83-9a09-57c5e8ba98cd\" />\n\n#### `/delete-user/callback`\n\n<img width=\"545\" alt=\"image\" src=\"https://github.com/user-attachments/assets/2ff1b217-d069-48fb-81c1-f8c8792d34a4\" />\n<br/>\n<img width=\"492\" alt=\"image\" src=\"https://github.com/user-attachments/assets/71df11db-9d38-4f34-abe1-add9d60b3486\" />\n\n#### `/magic-link/verify`\n\n<img width=\"379\" alt=\"image\" src=\"https://github.com/user-attachments/assets/6b6b6a8a-59b6-4a65-9df3-57d5b2f6eb0f\" />\n<br/>\n<img width=\"413\" alt=\"image\" src=\"https://github.com/user-attachments/assets/82a5c9c6-2ea0-44eb-af48-40732657b59e\" />\n\n#### `/oauth-proxy-callback`\n\n<img width=\"548\" alt=\"image\" src=\"https://github.com/user-attachments/assets/d8d2ee51-e9fd-4337-bec3-a70afd1ceacb\" />\n<br/>\n<img width=\"544\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f097d406-b965-4f85-b124-9b0ef1cc2689\" />\n\n### Impact\n\nUntrusted open redirects in various routes.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "better-auth"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.10"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.2.9"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/better-auth/better-auth/security/advisories/GHSA-36rg-gfq2-3h56"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-53535"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/better-auth/better-auth/commit/9801d1be53d9da04686b94c6286c53ec97496740"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/better-auth/better-auth"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-601" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-07T22:13:14Z",
    "nvd_published_at" : "2025-07-07T18:15:28Z"
  }
}