The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2025-61928

CVE-2025-61928: Better Auth API Key Auth Bypass Flaw

CVE-2025-61928 is an authentication bypass flaw in Better Auth for TypeScript that allows unauthenticated attackers to create or modify API keys for any user. This article covers technical details, affected versions, and patches.

Published: April 1, 2026

CVE-2025-61928 Overview

CVE-2025-61928 is a critical authentication bypass vulnerability in Better Auth, 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.

The vulnerability stems from flawed session validation logic where, when no session exists but userId is present in the request body, the authRequired flag becomes false and the user object is set to the attacker-controlled ID. This allows attackers to bypass authentication entirely and generate API keys for arbitrary users, enabling complete account takeover.

Critical Impact

Unauthenticated attackers can generate API keys for any user and immediately gain complete authenticated access, allowing them to perform any action as the victim user and potentially compromise user data and the application.

Affected Products

  • Better Auth versions prior to 1.3.26
  • Applications using the Better Auth API key plugin with client-facing endpoints
  • TypeScript/JavaScript applications implementing Better Auth for authentication

Discovery Timeline

  • October 9, 2025 - CVE-2025-61928 published to NVD
  • October 14, 2025 - Last updated in NVD database

Technical Details for CVE-2025-61928

Vulnerability Analysis

This authentication bypass vulnerability exists in the API key creation and update endpoints of the Better Auth library. The core issue lies in the conditional logic that determines whether authentication is required for a request.

The vulnerable code path evaluates: session?.user ?? (authRequired ? null : { id: ctx.body.userId }). When an attacker sends a request without a valid session but includes a userId parameter in the request body, the authRequired variable is incorrectly set to false. This causes the system to accept the attacker-supplied userId as legitimate, creating a user object from attacker-controlled input.

Additionally, server-only field validation, which normally prevents clients from setting privileged fields, only executes when authRequired is true (lines 280-295). By exploiting this bypass, attackers can set privileged fields that should only be accessible to server-side operations.

Root Cause

The root cause is improper authorization validation (CWE-285) in the API key creation logic. The code incorrectly determines authentication requirements based on the presence of userId in the request body rather than properly validating the session state. This design flaw allows the authRequired flag to be manipulated by including a userId parameter, completely bypassing the authentication check.

Attack Vector

An attacker can exploit this vulnerability remotely without any authentication by sending a crafted HTTP POST request to the api/auth/api-key/create endpoint. The attack requires knowledge of a target user's ID, which may be obtainable through enumeration or information disclosure. The same vulnerability pattern exists in the update endpoint, allowing modification of existing API keys.

The attack flow:

  1. Attacker identifies a target user's ID
  2. Attacker sends a POST request to /api/auth/api-key/create with the victim's userId in the request body
  3. The server creates an API key for the victim user
  4. Attacker uses the generated API key to authenticate as the victim
typescript
 			} = ctx.body;
 
 			const session = await getSessionFromCtx(ctx);
-			const authRequired = (ctx.request || ctx.headers) && !ctx.body.userId;
+			const authRequired = ctx.request || ctx.headers;
 			const user =
-				session?.user ?? (authRequired ? null : { id: ctx.body.userId });
+				authRequired && !session
+					? null
+					: session?.user || { id: ctx.body.userId };
+
 			if (!user?.id) {
 				throw new APIError("UNAUTHORIZED", {
 					message: ERROR_CODES.UNAUTHORIZED_SESSION,
 				});
 			}
 
+			if (session && ctx.body.userId && session?.user.id !== ctx.body.userId) {
+				throw new APIError("UNAUTHORIZED", {
+					message: ERROR_CODES.UNAUTHORIZED_SESSION,
+				});
+			}
+
 			if (authRequired) {
 				// if this endpoint was being called from the client,
 				// we must make sure they can't use server-only properties.

Source: GitHub Commit for Better-Auth

Detection Methods for CVE-2025-61928

Indicators of Compromise

  • Unexpected API key creation events in authentication logs for users who did not initiate them
  • POST requests to /api/auth/api-key/create containing userId parameters without valid session cookies
  • Multiple API key creation attempts from single IP addresses targeting different user IDs
  • Authentication events using newly created API keys from unfamiliar IP addresses or locations

Detection Strategies

  • Monitor authentication logs for API key creation requests that lack valid session authentication
  • Implement anomaly detection for sudden spikes in API key generation across multiple user accounts
  • Alert on API key usage patterns that deviate from established user behavior baselines
  • Review web application firewall logs for requests to API key endpoints with unusual parameters

Monitoring Recommendations

  • Enable detailed logging for all Better Auth API key operations including request parameters and session state
  • Set up real-time alerting for unauthenticated or suspicious API key creation attempts
  • Implement user notification mechanisms for API key creation and usage events
  • Regularly audit existing API keys for unauthorized or suspicious entries

How to Mitigate CVE-2025-61928

Immediate Actions Required

  • Upgrade Better Auth to version 1.3.26 or later immediately
  • Audit all existing API keys created in the application for unauthorized entries
  • Revoke any API keys that were created without legitimate user sessions
  • Review application logs for potential exploitation attempts targeting the vulnerable endpoints

Patch Information

The vulnerability has been addressed in Better Auth version 1.3.26. The fix modifies the authentication logic to properly validate sessions regardless of request parameters. The patch ensures that:

  1. The authRequired flag is determined solely by the presence of a request context, not by userId presence
  2. A proper session must exist for authenticated operations
  3. If a session exists but the userId in the body doesn't match the session user, the request is rejected

For technical details on the patch, refer to the GitHub Commit for Better-Auth and the GitHub Security Advisory GHSA-99h5-pjcv-gr6v.

Workarounds

  • Temporarily disable or restrict access to the API key creation and update endpoints at the network level
  • Implement additional middleware to validate session authentication before requests reach Better Auth endpoints
  • Use network-level controls (WAF rules) to block unauthenticated requests containing userId parameters to API key endpoints
bash
# Example: Block unauthenticated API key creation at reverse proxy level
# Nginx configuration to require authentication header for API key endpoints
location /api/auth/api-key/ {
    if ($http_authorization = '') {
        return 401;
    }
    proxy_pass http://backend;
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeAuth Bypass

  • Vendor/TechBetter Auth

  • SeverityCRITICAL

  • CVSS Score9.3

  • EPSS Probability0.28%

  • Known ExploitedNo
  • CVSS Vector
  • 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/E:X/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
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-285
  • Technical References
  • GitHub Commit for Better-Auth

  • GitHub Security Advisory GHSA-99h5-pjcv-gr6v
  • Latest CVEs
  • CVE-2025-9185: Mozilla Firefox RCE Vulnerability

  • CVE-2025-9184: Mozilla Firefox RCE Vulnerability

  • CVE-2025-9180: Mozilla Firefox Auth Bypass Vulnerability

  • CVE-2025-8030: Mozilla Firefox RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English