{"id":"CVE-2026-41061","aliases":["CVE-2026-41061","GHSA-8pv3-29pp-pf8f"],"related":[],"kind":"vulnerability","state":"published","title":"WWBN AVideo Vulnerable to stored XSS via Unanchored Duration Regex in Video Encoder Receiver","summary":"WWBN AVideo is an open source video platform. In versions 29.0 and below, the `isValidDuration()` regex at `objects/video.php:918` uses `/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/` without a `$` end anchor, allowing arbitrary HTML/JavaScript to be appended after a valid duration prefix. The crafted duration is stored in the database and rendered without HTML escaping via `echo Video::getCleanDuration()` on trending pages, playlist pages, and video gallery thumbnails, resulting in stored cross-site scripting. Commit bcba324644df8b4ed1f891462455f1cd26822a45 contains a fix.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"WWBN AVideo is an open source video platform. In versions 29.0 and below, the `isValidDuration()` regex at `objects/video.php:918` uses `/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/` without a `$` end anchor, allowing arbitrary HTML/JavaScript to be appended after a valid duration prefix. The crafted duration is stored in the database and rendered without HTML escaping via `echo Video::getCleanDuration()` on trending pages, playlist pages, and video gallery thumbnails, resulting in stored cross-site scripting. Commit bcba324644df8b4ed1f891462455f1cd26822a45 contains a fix.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe `isValidDuration()` regex at `objects/video.php:918` uses `/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/` without a `$` end anchor, allowing arbitrary HTML/JavaScript to be appended after a valid duration prefix. The crafted duration is stored in the database and rendered without HTML escaping via `echo Video::getCleanDuration()` on trending pages, playlist pages, and video gallery thumbnails, resulting in stored cross-site scripting.\n\n## Details\n\n**Input entry point:** `objects/aVideoEncoderReceiveImage.json.php:208`\n\n```php\n// Line 203-211\nif (!empty($_REQUEST['duration'])) {\n    $video->setDuration($_REQUEST['duration']);\n}\n```\n\n**Insufficient validation:** `objects/video.php:918`\n\n```php\nstatic function isValidDuration($duration) {\n    // ...\n    return preg_match('/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/', $duration);\n    //     Missing $ anchor here -----------------------------------^\n}\n```\n\nThe regex matches `00:00:01` at the start of the string but ignores everything after it. A payload like `00:00:01</time><img src=x onerror=alert(1)><time>` passes validation.\n\n**No sanitization in output function:** `objects/video.php:3463-3480`\n\n```php\npublic static function getCleanDuration($duration = \"\") {\n    $durationParts = explode(\".\", $duration);\n    $duration = $durationParts[0];\n    $durationParts = explode(':', $duration);\n    if (count($durationParts) == 1) {\n        return '0:00:' . static::addZero($durationParts[0]);\n    } elseif (count($durationParts) == 2) {\n        return '0:' . static::addZero($durationParts[0]) . ':' . static::addZero($durationParts[1]);\n    }\n    return $duration; // Returns full string unmodified for 3+ colon parts\n}\n```\n\nWith the payload `00:00:01</time><img src=x onerror=alert(1)><time>`, exploding by `:` yields 3+ parts, so the full unsanitized string is returned.\n\n**Unescaped output sinks:**\n\n1. `view/trending.php:72`:\n```php\n<time class=\"duration\"><?php echo Video::getCleanDuration($value['duration']); ?></time>\n```\n\n2. `view/include/playlist.php:159`:\n```php\n<time class=\"duration\"><?php echo Video::getCleanDuration(@$value['duration']); ?></time>\n```\n\n3. `objects/video.php:7200` (gallery thumbnail generation):\n```php\n$img .= \"<time class=\\\"duration\\\"...>\" . $duration . \"</time>\";\n```\n\nNo Content-Security-Policy headers are set. The application uses raw PHP templates with no auto-escaping framework.\n\n## PoC\n\n1. Authenticate as a user with upload permission and obtain a `video_id_hash` for a video (visible in encoder API responses or via the upload flow).\n\n2. Send the malicious duration:\n\n```bash\ncurl -X POST \"https://target/objects/aVideoEncoderReceiveImage.json.php\" \\\n  -d \"videos_id=VIDEO_ID\" \\\n  -d \"video_id_hash=HASH\" \\\n  -d 'duration=00:00:01</time><img src=x onerror=alert(document.cookie)><time>'\n```\n\n3. The `isValidDuration()` regex matches the `00:00:01` prefix and allows the full string to be stored.\n\n4. Visit the trending page (`/view/trending.php`) or any playlist containing the poisoned video. The injected HTML breaks out of the `<time>` tag and the `onerror` handler executes JavaScript in the victim's browser context.\n\n## Impact\n\n- **Session hijacking**: Attacker can steal session cookies of any user (including administrators) who views a page listing the poisoned video (trending, playlists, search results, channel pages).\n- **Account takeover**: Stolen admin session cookies grant full platform control.\n- **Phishing**: Attacker can inject fake login forms or redirect users to malicious sites.\n- **Worm potential**: Since the XSS fires on commonly-visited listing pages (trending), it can propagate without targeted delivery — any visitor is a victim.\n\nThe attack requires only upload-level permissions (low privilege) and impacts all users who view any page rendering the poisoned video's duration (high blast radius).\n\n## Recommended Fix\n\n**Fix 1 — Anchor the regex** (`objects/video.php:918`):\n\n```php\n- return preg_match('/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/', $duration);\n+ return preg_match('/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}(\\.[0-9]+)?$/', $duration);\n```\n\n**Fix 2 — HTML-escape all duration output** (defense in depth):\n\nIn `view/trending.php:72`:\n```php\n- <time class=\"duration\"><?php echo Video::getCleanDuration($value['duration']); ?></time>\n+ <time class=\"duration\"><?php echo htmlspecialchars(Video::getCleanDuration($value['duration']), ENT_QUOTES, 'UTF-8'); ?></time>\n```\n\nIn `view/include/playlist.php:159`:\n```php\n- <time class=\"duration\"><?php echo Video::getCleanDuration(@$value['duration']); ?></time>\n+ <time class=\"duration\"><?php echo htmlspecialchars(Video::getCleanDuration(@$value['duration']), ENT_QUOTES, 'UTF-8'); ?></time>\n```\n\nIn `objects/video.php:7200`:\n```php\n- $img .= \"<time class=\\\"duration\\\"...>\" . $duration . \"</time>\";\n+ $img .= \"<time class=\\\"duration\\\"...>\" . htmlspecialchars($duration, ENT_QUOTES, 'UTF-8') . \"</time>\";\n```\n\nBoth fixes should be applied: the regex fix prevents storage of invalid data, and the output escaping provides defense in depth against any other code path that might store unvalidated durations.","format":"markdown","source":"ghsa"},{"lang":"es","text":"WWBN AVideo es una plataforma de video de código abierto. En las versiones 29.0 e inferiores, la expresión regular “isValidDuration()” en “objects/video.php:918” utiliza “/^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/” sin un ancla final “$” , permitiendo que se añada HTML/JavaScript arbitrario después de un prefijo de duración válido. La duración manipulada se almacena en la base de datos y se renderiza sin escape de HTML a través de “echo Video::getCleanDuration()” en páginas de tendencias, páginas de listas de reproducción y miniaturas de galerías de videos, lo que resulta en cross-site scripting almacenado. El commit bcba324644df8b4ed1f891462455f1cd26822a45 contiene una solución.","source":"nvd"}],"published":"2026-04-14T23:22:21.000Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"<= 29.0","status":"affected"}],"vendor":"WWBN","product":"AVideo","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","lastAffected":"29.0"}],"ecosystem":"Packagist","package":"wwbn/avideo","purl":"pkg:composer/wwbn/avideo","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"29.0"}],"vendor":"wwbn","product":"avideo","cpe":"cpe:2.3:a:wwbn:avideo:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/WWBN/AVideo/security/advisories/GHSA-8pv3-29pp-pf8f","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/WWBN/AVideo/commit/bcba324644df8b4ed1f891462455f1cd26822a45","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41061","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/WWBN/AVideo","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-04-22T13:14:23.965Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41061","url":"https://www.cve.org/CVERecord?id=CVE-2026-41061","licence":"CVE Terms of Use","modified":"2026-04-22T13:14:27.800Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-8pv3-29pp-pf8f","url":"https://github.com/advisories/GHSA-8pv3-29pp-pf8f","licence":"CC-BY-4.0","modified":"2026-05-05T16:11:40.860Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41061","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41061","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"}],"updatedAt":"2026-11-25T22:59:19.209Z","epss":{"score":0.0018,"percentile":0.07875,"date":"2026-12-01T12:00:22.000Z"}}