Summary
MyTube versions prior to 1.8.69 contain an authorization bypass in the /api/settings/import-database endpoint that allows low-privileged users to upload and replace the entire SQLite database.
When triggered, this flaw can lead to complete compromise of the application, including user accounts, configuration, and stored data; similar issues may affect other POST routes exposed by the API.
Affected context
This vulnerability affects MyTube deployments where:
- The
/api/settings/import-databaseendpoint (and similar POST routes) is exposed to authenticated users beyond administrators. - Authorization checks do not sufficiently distinguish between low-privileged and high-privileged roles for sensitive settings operations.
- The application relies on a single SQLite database file as the core data store for configuration, user data, and access rules.
In such contexts, any user with valid but low-privilege credentials can potentially trigger a database import that replaces the application's primary datastore.
Exploit preconditions
- Attack surface: HTTP(S) API endpoints, specifically
/api/settings/import-databaseand other affected POST routes. - Required access: Valid low-privilege user credentials or any account allowed to reach these endpoints.
- Trigger point: Sending a crafted POST request to the import-database endpoint (and possibly related POST routes) with a supplied SQLite database file.
- Why exploitation is possible:
- Sensitive administrative functionality is exposed without sufficient authorization enforcement.
- The endpoint trusts that any authenticated caller is allowed to perform full database imports.
- The application lacks fine-grained access control or proper role checks for high-impact operations.
Why this happens
The core issue is an access control failure where a sensitive administrative operation—importing and replacing the entire database—is not constrained to appropriately privileged roles.
This corresponds to CWE-285: Improper Authorization, where the system fails to enforce necessary authorization checks before granting access to protected functionality.
The mention of CWE-639: Authorization Bypass Through User-Controlled Key reflects how user-controllable request parameters and endpoints can be invoked without verifying the caller's effective permissions.
Abstractly, the pattern is:
- High-impact operations are exposed over generic API endpoints.
- The application treats "authenticated" as equivalent to "authorized" for operations that should be restricted to administrators.
- There is no independent verification that the caller has sufficient privilege to alter or replace the core datastore.
Potential impact
- Full replacement of the SQLite database with attacker-controlled content.
- Creation, deletion, or modification of user accounts, including promotion to administrative roles.
- Loss of integrity and availability of application data, including video metadata and configuration.
- Persistent compromise of the application through implanted configuration or embedded malicious data in the database.
- Potential exposure of sensitive information if the replacement database is crafted to weaken or bypass security controls.
- Disruption of service, including denial of service if the database is corrupted or incompatible.
General mitigation guidance
Effective mitigation centers on strengthening access control boundaries and isolating high-risk operations:
- Restrict sensitive endpoints (such as database import/export, backup/restore, and global settings) to clearly defined administrative roles.
- Apply defense-in-depth authorization checks: combine role-based access control, explicit permission flags, and route-level restrictions.
- Separate configuration and maintenance APIs from regular user APIs; consider binding administrative actions to a dedicated admin interface or network segment.
- Apply the principle of least privilege so that non-administrative accounts cannot invoke system-wide operations, even indirectly.
- Implement centralized authorization logic rather than ad-hoc checks scattered across handlers, reducing the chance of missed validations.
- Log and monitor all use of high-impact endpoints, aiding quick detection of misuse.
How teams detect issues like this
Detection typically involves both code-centric analysis and runtime monitoring:
- Static analysis / code review:
- Identify endpoints that perform high-impact operations (database import/export, configuration changes, user role management).
- Verify that each such endpoint enforces explicit authorization checks tied to admin or elevated roles.
- Look for routes where "is authenticated" is the only gate for sensitive functionality.
- Review route definitions and middleware wiring to ensure that expected authorization guards are actually attached.
- Automated tooling:
- Use API security scanners or SAST tools configured to flag missing or weak authorization checks on administrative routes.
- Enforce policies that require explicit role checks in handlers touching core datastore operations.
- Operational monitoring:
- Log all POST requests to settings and maintenance endpoints, including the initiating user identity.
- Set up alerts on unusual patterns, such as low-privilege accounts invoking administrative routes or spikes in database import activity.

