/

CVE-2026-23837

Severity:

CRITICAL RISK

(9.8)

Authorization Bypass in MyTube Role-Based Auth

CVE-2026-23837

Analyzed

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-863

Impact:

Privilege Escalation and Unauthorized Administrative Access

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

MyTube versions 1.7.65 and potentially earlier contain an authorization bypass in the roleBasedAuthMiddleware that incorrectly allows unauthenticated requests to pass through when no authentication cookie is provided.

In deployments with loginEnabled: true, an attacker can reach protected API routes, including /api/settings, and modify application settings and passwords without any valid session.

Affected context

This vulnerability affects MyTube instances that:

  • Are running version 1.7.65 or earlier in the 1.7.x series
  • Have loginEnabled: true configured
  • Rely on the roleBasedAuthMiddleware to protect administrative and authenticated routes

In this context, the middleware is expected to enforce login and role requirements, but instead permits requests with no authenticated user object to proceed as if authorized.

Exploit preconditions

  • Attack surface: HTTP(S) API endpoints exposed by the MyTube server, particularly /api/settings and other routes protected by roleBasedAuthMiddleware.
  • Required access: Network access to the vulnerable MyTube instance; no prior authentication or valid session cookie is required.
  • Trigger point: Sending requests to protected endpoints without an authentication cookie so that req.user remains undefined.
  • Why exploitation is possible: The authorization middleware implicitly treats a missing user object as a non-blocking condition and calls next(), rather than failing closed with an authorization error when no authenticated user is present.

Why this happens

The core issue is a logic flaw in the authorization middleware responsible for enforcing role-based access control.

Instead of implementing a "fail-closed" pattern that rejects requests when req.user is undefined or invalid, the middleware allows processing to continue by calling next() whenever the authentication state is absent.

This maps to CWE-863: Incorrect Authorization, where protected operations can be performed without proper authorization checks due to incorrect or incomplete validation logic in the access control layer.

Potential impact

  • An attacker may access and modify global application settings through /api/settings.
  • An attacker may change administrative and visitor passwords, potentially locking out legitimate users.
  • An attacker could access other protected routes that rely on roleBasedAuthMiddleware for enforcement.
  • An attacker might take full control of the MyTube instance configuration and behavior.

General mitigation guidance

Mitigation focuses on enforcing strict, explicit authorization checks and ensuring the middleware fails closed:

  • Ensure authorization middleware treats any missing or invalid authentication state (e.g., req.user undefined) as an error condition and returns an appropriate HTTP status (such as 401/403) instead of calling next().
  • Centralize authentication and authorization logic so that all protected routes use a consistent, well-tested middleware chain.
  • Adopt a least-privilege model for roles and permissions, defining clear policies for which roles may access sensitive endpoints like /api/settings.
  • Minimize direct exposure of administrative APIs to untrusted networks, for example by placing them behind a reverse proxy that restricts access based on IP ranges or other contextual factors.
  • Use secure-by-default configuration such that enabling login or admin features automatically applies strict access control to all relevant endpoints.

How teams detect issues like this

Detection generally revolves around identifying incorrect or missing authorization checks:

  • Static analysis: Search for middleware and handlers that:
  • Call next() when req.user (or equivalent auth context) is null/undefined, without returning an error.
  • Access sensitive operations or configuration endpoints without verifying roles or authentication state.
  • Code review: During manual review, pay attention to:
  • Authorization middleware that does not clearly distinguish between authenticated and unauthenticated requests.
  • Route definitions for critical endpoints (/api/settings, password change routes, admin panels) that lack explicit access-control checks.
  • Runtime monitoring: Configure logging and alerting for:
  • Access to administrative endpoints from unauthenticated sessions (e.g., no auth cookie or token).
  • Unusual patterns of configuration changes or password resets originating from untrusted networks.
  • Automated tools: Apply application security testing tools (SAST/DAST) configured to flag:
  • Unprotected or weakly protected admin or settings APIs.
  • Inconsistent use of authorization middleware across routes.

Sources

SourceLink
github.comgithub.com/franklioxygen/MyTube/commit/f85ae9b0d6e4a6480c6af5b675a99069d08d496e
github.comgithub.com/franklioxygen/MyTube/security/advisories/GHSA-cmvj-g69f-8664

Frequently asked

questions

Any attacker with network access to a vulnerable MyTube instance can exploit this issue, as it does not require valid credentials or an existing session; simply omitting the authentication cookie can be sufficient to bypass protection on affected routes.

No existing account is required. The flaw allows unauthenticated users—without any login—to reach routes that should only be accessible to authenticated or administrative users.

Implement a strict fail-closed authorization middleware: explicitly check for a valid authenticated user and required role, and immediately return an error (such as 401 Unauthorized or 403 Forbidden) when these conditions are not met, rather than allowing requests to fall through to downstream handlers.

Standardize on a central access-control component, require explicit authentication and role checks for sensitive endpoints, enforce security code review for middleware changes, and use automated checks or tests that validate that protected routes cannot be reached without proper authentication and authorization.

Find out what's already
exploitable in your codebase.