GHSA-r64r-883r-wcwh AVideo: Unauthenticated CDN Configuration Takeover via Empty Default Key Bypass and Mass-Assignment
SummaryThe CDN plugin endpoints `plugin/CDN/status.json.php` and `plugin/CDN/disable.json.php` use key-based authentication with an empty string default key. When the CDN plugin is enabled but the key has not been configured (the default state), the key validation check is completely bypassed, allowing any unauthenticated attacker to modify the full CDN configuration — including CDN URLs, storage credentials, and the authentication key itself — via mass-assignment through the `par` request parameter.DetailsThe CDN plugin defines a default empty key in `plugin/CDN/CDN.php:68`:The `status.json.php` endpoint authenticates requests using this key, but the check has a critical logic flaw at lines 16-27:When the stored key is the default empty string `""`, `!empty("")` evaluates to `false`, and the entire key comparison block is skipped. Any non-empty value provided by the attacker passes authentication.Following the bypass, lines 28-31 perform unchecked mass-assignment:The attacker-controlled `par` array sets arbitrary properties on the plugin data object. At line 95, the modified object is persisted to the database:`setDataObject()` in `Plugin.abstract.php:263` serializes the entire object to JSON and saves it, making all mass-assigned properties persistent.Exploitable properties (defined in `CDN.php:62-87`) include:`CDN` — main CDN URL for serving all video content`CDN_S3`, `CDN_B2`, `CDN_FTP` — storage-specific CDN URLs`enable_storage` — enables CDN storage functionality`storage_hostname`, `storage_username`, `storage_password` — storage backend credentials`key` — the authentication key itself (via mass-assignment, can override line 28)The `disable.json.php` endpoint has the identical authentication bypass (lines 16-27) and additionally deactivates the CDN plugin entirely (line 37: `$cdn->setStatus('inactive')`).This contrasts with other sensitive endpoints in the codebase that properly use session-based authentication. For example, `Gallery/saveSort.json.php` (commit 087dab884) uses `isGlobalTokenValid()`, and commit daca4ffb1 added `User::isAdmin()` checks to other configuration endpoints.PoC**Prerequisites:** AVideo instance with CDN plugin enabled and key not configured (default state after enabling the plugin).**Step 1: Verify CDN plugin is enabled and key is default**If the response contains `"error":false`, the key bypass worked and CDN URL has been overwritten.**Step 2: Full takeover — redirect media, enable storage with attacker credentials, lock out admins**This single request:Redirects all CDN-served media URLs to attacker's serverEnables CDN storage pointing to attacker-controlled hostSets the key to `attacker-secret-key`, locking legitimate administrators out of reconfiguring via this endpoint**Step 3: Disable CDN entirely (denial of service)**This deactivates the CDN plugin, disrupting media delivery.ImpactAn unauthenticated remote attacker can:**Redirect all media delivery** — By overwriting the CDN URL, all video content served to users is fetched from an attacker-controlled server, enabling content injection or phishing.**Exfiltrate uploaded videos** — By enabling storage with attacker-controlled credentials, newly uploaded videos are sent to the attacker's storage server.**Overwrite storage credentials** — The `storage_hostname`, `storage_username`, and `storage_password` fields are all mass-assignable, allowing the attacker to hijack the storage backend.**Lock out administrators** — By setting the `key` via mass-assignment, the attacker prevents legitimate administrators from using these endpoints to restore configuration (though admin panel access is unaffected).**Disable CDN** — Via `disable.json.php`, the attacker can deactivate the CDN plugin entirely, causing service disruption for media delivery.The vulnerability is exploitable on any AVideo instance where the CDN plugin has been enabled but the key has not been manually configured — which is the default state immediately after enabling the plugin.Recommended FixAdd proper session-based authentication to both endpoints and remove the flawed key-only auth as the sole gate. In `plugin/CDN/status.json.php` and `plugin/CDN/disable.json.php`, add an admin check after the configuration include:Additionally, restrict mass-assignment to only known, safe properties by validating against a whitelist:This prevents mass-assignment of sensitive properties like `key`, `storage_password`, `storage_hostname`, and `enable_storage` even when the key-based auth is legitimately used by CDN nodes.
CVSS v3.1 score: 8.6