CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-P2FR-6HMX-4528

GHSA-p2fr-6hmx-4528: Unbound Resource Indicators Allow Cross-Audience Access Token Escalation in @better-auth/oauth-provider

Alon Barad
Alon Barad
Software Engineer

Jul 7, 2026·6 min read·12 visits

Executive Summary (TL;DR)

The OAuth provider fails to bind client-requested target resources to authorization codes and refresh tokens, allowing authenticated clients to escalate their access to any resource server in the validAudiences configuration list.

A security vulnerability in @better-auth/oauth-provider allows OAuth clients to obtain access tokens for unauthorized audiences due to unbound resource indicators. The implementation fails to bind the requested target resource to the initial authorization grant. Consequently, a client can request an access token targeting any resource server within the global allowlist, bypassing user consent boundaries.

Vulnerability Overview

The @better-auth/oauth-provider package, a component of the better-auth authentication framework, contains an authorization bypass flaw. The issue is located in the implementation of the RFC 8707 (Resource Indicators for OAuth 2.0) specification.

In a multi-resource server architecture, the authorization server must strictly limit the audience of an access token to the specific resources authorized by the user. Under RFC 8707, clients specify their target resource server via a resource query parameter during the authorization phase. The authorization server must capture this state and bind it to the resulting authorization grant.

Because the provider fails to persist the resource constraints between the authorization phase and the token exchange phase, clients can request access to any resource in the server configuration. The threat surface includes lateral access escalation across internal microservices and unauthorized access to downstream resource servers.

Root Cause Analysis

The core technical flaw stems from the complete decoupling of the authorization request parameter processing and the token generation logic. The provider ignores the resource parameter at the authorization endpoint (/oauth2/authorize). Because of this, the consent screens presented to the resource owner do not accurately reflect the specific resource servers the client will ultimately access.

Furthermore, the database schemas for authorization codes and refresh tokens lack fields to store stateful resource constraints. When an authorization code is successfully issued, it contains no reference to the resources that the user approved. This violates RFC 8707 Section 2.2, which dictates that the authorization server must record the authorized resources and ensure the subsequent token requests represent a subset of that initial grant.

When the client interacts with the /oauth2/token endpoint, the token generator reads the resource parameter directly from the request body. Instead of verifying this parameter against the authorization code's bound resource, the server evaluates it against a global config array called validAudiences. If the target is present in this global list, the server mints a JWT containing the target in the aud (audience) claim, completing the unauthorized access escalation.

Code Architecture & Schema Deficiencies

To understand the implementation flaw, examine the conceptual behavior of the token exchange handler and database interaction. The vulnerable state persists because the data layer does not support multi-resource tracking.

Below is a representation of the vulnerable code pattern contrasted with the patched statefulness:

// Vulnerable Token Endpoint Logic
async function handleTokenExchange(req) {
  const codeRecord = await db.findAuthCode(req.code);
  const requestedResource = req.resource; // Obtained directly from the POST body
 
  if (requestedResource) {
    // BUG: The codeRecord has no 'resources' property. 
    // The check is performed globally, ignoring user-authorized boundaries.
    if (!config.validAudiences.includes(requestedResource)) {
      throw new OAuthError("invalid_target", "Resource not in global allowlist");
    }
  }
 
  // Access token is minted for the arbitrary resource requested
  return generateAccessToken({
    sub: codeRecord.userId,
    audience: requestedResource || config.defaultAudience
  });
}

The fix implements structural changes to store the approved resources into the database. When the /oauth2/token endpoint is queried, validation is performed directly against the database record instead of the global configuration.

// Patched Token Endpoint Logic
async function handleTokenExchange(req) {
  const codeRecord = await db.findAuthCode(req.code); // Now retrieves stateful 'resources' array
  const requestedResource = req.resource;
 
  if (requestedResource) {
    // FIX: Verify the requested resource is a subset of the authorized resources
    if (!codeRecord.resources.includes(requestedResource)) {
      throw new OAuthError("invalid_target", "The requested resource is not authorized for this grant");
    }
  }
 
  return generateAccessToken({
    sub: codeRecord.userId,
    audience: requestedResource
  });
}

Exploitation & Scenario Execution

Exploitation of this vulnerability requires the target authorization server to configure multiple resources inside the validAudiences array. No custom exploitation tools are required, as standard OAuth library clients or command-line HTTP clients can trigger the flaw.

An attacker controls a registered OAuth client. The target server has configured https://api.billing.example.com (sensitive) and https://api.stats.example.com (public) in its global allowlist. The attacker initiates the standard authorization flow targeting the public API.

After obtaining the authorization code, the client sends a token request to /oauth2/token but overrides the resource field to point to the sensitive billing API. Because there is no check linking the code to the initial scope, the server returns an access token possessing an audience claim (aud) set to the sensitive billing system.

POST /oauth2/token HTTP/1.1
Host: auth.example.com
Content-Type: application/x-www-form-urlencoded
 
grant_type=authorization_code&
code=AUTHORIZATION_CODE_HERE&
redirect_uri=https://client.example.com/callback&
client_id=CLIENT_ID&
client_secret=CLIENT_SECRET&
resource=https://api.billing.example.com

The same technique applies to refresh token grants. If a client possesses a valid refresh token, it can issue a refresh request with a modified resource parameter, pivoting its audience access to any target server inside the validAudiences array without prompting the user for consent.

Impact Assessment

This vulnerability breaks the security boundaries enforced by OAuth consent screens. While the authorization server attempts to maintain a list of valid audiences via configuration, the failure to bind those audiences to specific authorization transactions compromises the isolation of multi-tenant or multi-resource API environments.

If the authorization server is used to authenticate users across both low-security and high-security internal services, any client compromised by an attacker can escalate access tokens to gain privileges on the high-security APIs. This bypasses the zero-trust principle where resource servers rely on the correctness of the token audience claim to deny access to unauthorized clients.

From a CVSS perspective, the vulnerability is classified as Medium (6.4). The attack complexity is low, and no user interaction is required after the initial login. However, the scope of impact changes (Scope: Changed) because the failure allows the client to gain unauthorized privileges on external downstream systems (the resource servers).

Remediation & Defensive Hardening

The definitive solution is to upgrade to @better-auth/oauth-provider@1.7.0 (or @better-auth/oauth-provider@1.7.0-beta.4). The updated release implements stateful database storage for resource lists and enforces strict subset checks during token exchanges.

Because the patch introduces database schema modifications to track authorized resource boundaries, running migrations is mandatory. Administrators must run the database migration utilities to apply the structural changes.

npx auth migrate

For environments where upgrading is not immediately possible, implement the following workarounds:

  1. Limit the validAudiences configuration array to a single, global entry. When only one resource is allowed, cross-resource escalation becomes impossible.
  2. Configure downstream resource servers to strictly validate that incoming tokens contain only their specific audience identifier and do not support broad, multi-audience arrays.
  3. Implement a custom validation interceptor on the /oauth2/token endpoint to block requests containing a resource parameter that differs from the default client authorization parameters.

Technical Appendix

CVSS Score
6.4/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N

Affected Systems

@better-auth/oauth-provider

Affected Versions Detail

Product
Affected Versions
Fixed Version
@better-auth/oauth-provider
better-auth
>= 1.4.8, < 1.7.0-beta.41.7.0-beta.4
AttributeDetail
CWE IDCWE-863
Attack VectorNetwork
CVSS v3.1 Score6.4
Exploit Statusnone
CISA KEV StatusNot Listed
ImpactIncorrect Authorization (Audience Escalation)

MITRE ATT&CK Mapping

T1078Valid Accounts
Defense Evasion
T1556Modify Authentication Process
Credential Access
T1550.004Use Alternate Authentication Material: Access Tokens
Lateral Movement
CWE-863
Incorrect Authorization

The software performs authorization checks but implements them incorrectly, allowing an actor to access restricted resources or execute unauthorized actions.

References & Sources

  • [1]GitHub Security Advisory GHSA-p2fr-6hmx-4528
  • [2]better-auth Repository
  • [3]Fix Release Tag (v1.7.0-beta.4)
  • [4]RFC 8707 Section 2.2
  • [5]RFC 9068 Section 2.2

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•38 minutes ago•CVE-2026-61539
10.0

CVE-2026-61539: Remote Code Execution via Llama3 Tool Parser Eval Injection in Xinference

CVE-2026-61539 is a critical remote code execution vulnerability in Xinference, an inference API framework for open-source LLMs. In version 2.5.0 and earlier, model-generated outputs representing Llama3 tool calls are passed directly to Python's built-in eval() function inside the parser components. By manipulating conversational input or injecting instructions, an attacker can influence the LLM to output a Python expression containing malicious system commands, resulting in unauthenticated remote code execution on the host. This vulnerability has been resolved in Xinference version 2.7.0.

Alon Barad
Alon Barad
2 views•6 min read
•about 2 hours ago•CVE-2026-77354
8.7

CVE-2026-77354: Uncontrolled Resource Consumption (OOM) via Sparse Array Indexes in kin-openapi

An uncontrolled resource consumption vulnerability (CWE-400/CWE-789) exists within the kin-openapi Go library prior to version 0.142.0. The vulnerability occurs during the processing of highly sparse array indexes inside query parameters defined in deepObject style. An unauthenticated remote attacker can exploit this flaw to cause an immediate Out-of-Memory (OOM) crash of the target application.

Amit Schendel
Amit Schendel
1 views•8 min read
•about 3 hours ago•CVE-2026-77413
9.3

CVE-2026-77413: Remote Code Execution via Prototype Chain Bypass in JSONata Evaluator

A critical prototype pollution and sandbox escape vulnerability was discovered in the JSONata query and transformation library before versions 1.8.8 and 2.2.0. By providing a malicious JSONata expression that bypasses ownership checks on object properties, remote attackers can execute arbitrary code in the context of the host Node.js application.

Alon Barad
Alon Barad
2 views•6 min read
•about 4 hours ago•CVE-2026-63135
8.2

CVE-2026-63135: Stored Cross-Site Scripting (XSS) via Referer Header in YOURLS

CVE-2026-63135 is a critical stored Cross-Site Scripting (XSS) vulnerability affecting YOURLS (Your Own URL Shortener) versions 1.5.1 up to (but not including) 1.10.4. Unauthenticated remote attackers can inject malicious JavaScript arrays by crafting an HTTP Referer header sent to a short URL redirect. This value is saved in the database logs and executed without context-aware escaping when an administrative user views the corresponding statistics visualization page.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 5 hours ago•CVE-2026-68508
7.8

CVE-2026-68508: Arbitrary Code Execution via Unsafe Dynamic Instantiation in Hydra Core

CVE-2026-68508 is a high-severity arbitrary code execution vulnerability in facebookresearch/hydra (hydra-core) prior to version 1.3.4. The vulnerability exists within the dynamic instantiation system hydra.utils.instantiate(), which resolves and executes arbitrary Python callables from configuration files. An attacker capable of submitting untrusted configurations can achieve arbitrary code execution in the context of the consuming process.

Alon Barad
Alon Barad
5 views•7 min read
•about 6 hours ago•CVE-2026-77415
9.3

CVE-2026-77415: Sandbox Escape and Arbitrary Code Execution in JSONata Engine

A critical sandbox escape vulnerability in JSONata versions prior to 1.8.8 and 2.2.1 allows unauthenticated remote attackers to execute arbitrary code on the host machine. By submitting crafted JSONata expressions, an attacker can manipulate internal AST structures, bypass object clone helpers, spoof native function flags, and escape the evaluation environment to execute system commands through the Node.js runtime.

Alon Barad
Alon Barad
10 views•6 min read