GHSA-6p96-cfg5-4vhp Koel: Authenticated Full-Read SSRF via Subsonic Internet Radio Stations
SummaryKoel v9.6.0 validates radio station URLs on the regular web API, but the Subsonic-compatible radio endpoints do not apply the same SSRF protections. An authenticated user can create or update a radio station with a private URL and then use Koel's radio streaming feature to make the server fetch that URL and return the upstream response body.This was validated against v9.6.0 (352ea5ec27fa22294da8fb6beacb3d5552f0d09c) using the official phanan/koel:9.6.0 image.DetailsSafeUrl is applied on the web API, but not on the Subsonic endpointsKoel's regular radio API protects station URLs with `SafeUrl` and `HasAudioContentType`:`app/Http/Requests/API/Radio/RadioStationStoreRequest.php``app/Http/Requests/API/Radio/RadioStationUpdateRequest.php`The Subsonic-compatible routes do not reuse those checks:`routes/subsonic.php``createInternetRadioStation.view``updateInternetRadioStation.view``app/Http/Requests/Subsonic/CreateInternetRadioStationRequest.php``app/Http/Requests/Subsonic/UpdateInternetRadioStationRequest.php`The result is a validation gap between two routes that create the same type of object.The unvalidated URL is stored and later fetched server-sideThe Subsonic controllers hand the supplied URL to the regular radio service without any SSRF validation:`app/Http/Controllers/Subsonic/CreateInternetRadioStationController.php``app/Http/Controllers/Subsonic/UpdateInternetRadioStationController.php``app/Services/RadioService.php`The SSRF is triggered when the station is played:`app/Http/Controllers/StreamRadioController.php``app/Services/Radio/RadioStreamService.php``app/Services/Radio/RadioStreamProxy.php``RadioStreamProxy::openStream()` opens a web address supplied by the attacker (attacker-controlled URL) without proper checks:The response body is returned to the attackerIf the upstream response is treated as a normal stream, Koel forwards it back to the client:That makes this a full-read SSRF rather than a blind SSRF. The attacker is not only limited to causing an internal request, but also they can read the HTTP response through `/radio/stream/{id}`.This behavior also differs from the documented expectation in `docs/usage/radio.md`, which says Koel checks the URL when adding or editing a radio station.PoCThe following steps were validated against the official `phanan/koel:9.6.0` image.Authenticate and obtain an API token:Obtain the user's Subsonic API key:Prepare an internal-only target URL. In my validation, I used a host-side HTTP server reachable from the container through the Docker bridge:Confirm the regular web API blocks the URL:Expected result:HTTP `422`Error includes `The url must point to a public URL.`Create the same station through the Subsonic route:Expected result:HTTP `200`JSON includes `"status":"ok"`Resolve the station ID and stream it:Expected result:HTTP `200`Response body contains the upstream content from the internal target URLAn authenticated user can abuse Koel as a full-read SSRF proxy to access internal HTTP services reachable from the Koel server.Practical impact includes:Reading loopback-only, RFC1918, or Docker-bridge HTTP servicesAccessing internal admin panels, metrics services, or metadata endpoints that are not publicly exposedPerforming internal HTTP reconnaissance and retrieving content through Koel itselfSince the response body is returned to the attacker, the impact is materially higher than a blind SSRF.RemediationThe Subsonic request validators should apply the same URL validation as the main radio API, and the stream proxy should re-check the target before opening it.Suggested patch for `app/Http/Requests/Subsonic/CreateInternetRadioStationRequest.php`:Suggested patch for `app/Http/Requests/Subsonic/UpdateInternetRadioStationRequest.php`:Suggested defense-in-depth patch for `app/Services/Radio/RadioStreamProxy.php`:
CVSS v3.1 score: 7.7