GHSA-j432-4w3j-3w8j WWBN AVideo has a SSRF via same-domain hostname with alternate port bypasses isSSRFSafeURL
SummaryThe `isSSRFSafeURL()` function in `objects/functions.php` contains a same-domain shortcircuit (lines 4290-4296) that allows any URL whose hostname matches `webSiteRootURL` to bypass all SSRF protections. Because the check compares only the hostname and ignores the port, an attacker can reach arbitrary ports on the AVideo server by using the site's public hostname with a non-standard port. The response body is saved to a web-accessible path, enabling full exfiltration.DetailsCommit `40872e529` fixed an extension-based SSRF bypass by making `isSSRFSafeURL()` unconditional. However, `isSSRFSafeURL()` itself contains a same-domain shortcircuit that returns `true` when the URL's hostname matches `webSiteRootURL`'s hostname, without validating the port:The attack flow through `objects/aVideoEncoder.json.php`:User-supplied `$_REQUEST['downloadURL']` is passed to `downloadVideoFromDownloadURL()` at line 166`isSSRFSafeURL()` is called at line 368 — passes due to hostname match`url_get_contents($downloadURL)` fetches the attacker-controlled URL at line 378Response is written to `Video::getStoragePath() . "cache/tmpFile/" . basename($downloadURL)` at line 393-395The `cache/tmpFile/` directory is under the web-accessible videos storage path. The attacker can retrieve the file to exfiltrate the internal service response.The auth requirement is `User::canUpload()` (line 59), which is satisfied by any authenticated user with upload permission. Alternatively, a valid `video_id_hash` (a per-video token) can be used via `useVideoHashOrLogin()` at line 57.PoCAssuming the AVideo instance is at `https://avideo.example.com/` and an internal service runs on port 9998:Note: The internal service response must be >= 20KB (or >= 5KB if the URL ends in `.mp3`) to pass the size check at line 384. For smaller responses, the attacker can target endpoints that return verbose output or append padding parameters.The fix at `40872e529` specifically mentions blocking `http://127.0.0.1:9998/probe.mp4`. This bypass reaches the exact same internal service by replacing `127.0.0.1` with the site's public hostname — the DNS resolution points to the same server.Impact**Internal service access**: An authenticated attacker can reach any TCP port on the AVideo server that speaks HTTP, including databases with HTTP interfaces, monitoring endpoints, admin panels, cloud metadata services (if the hostname resolves to a cloud instance), and other co-hosted services.**Data exfiltration**: Response bodies are written to a web-accessible directory, allowing the attacker to retrieve internal service responses.**Scope change**: The vulnerability crosses from the AVideo application into other services on the same host, justifying S:C in CVSS scoring.**Bypass of existing fix**: This directly circumvents the SSRF protection added in commit `40872e529`.Recommended FixThe same-domain shortcircuit should validate that both the hostname and port match `webSiteRootURL`. Replace `objects/functions.php` lines 4290-4296:This ensures the shortcircuit only fires for requests to the exact same origin (scheme-implied port or explicit port) as the configured site URL.
CVSS v3.1 score: 7.7