Skip to content

Commit 388fcd5

Browse files
author
Daniel Neto
committed
fix: Enhance security by disallowing user-supplied streamerURL and sanitize name input to prevent path traversal
https://github.com/WWBN/AVideo/security/advisories/GHSA-9hv9-gvwm-95f2#event-592232
1 parent 8592a39 commit 388fcd5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

plugin/Live/standAloneFiles/control.json.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@
7474
error_log("control.json.php: Config file NOT found");
7575
}
7676

77-
if (!empty($_REQUEST['streamerURL'])) {
78-
$streamerURL = $_REQUEST['streamerURL'];
79-
}
77+
// SECURITY: User-supplied streamerURL is intentionally NOT accepted.
78+
// Allowing it would enable authentication bypass and SSRF via file_get_contents
79+
// on an attacker-controlled host. streamerURL MUST come from the configuration
80+
// file or be hard-coded in this file above.
8081

8182
error_log("Control.json.php start ".json_encode($_REQUEST));
8283

@@ -170,7 +171,9 @@
170171
$tolerance = 10; // 10 seconds
171172
$obj->response = false;
172173
// check the last file change time, if is less then x seconds it is recording
173-
$files = glob("$record_path/{$obj->name}*.flv");
174+
// Sanitize name to prevent path-traversal characters from escaping $record_path.
175+
$safeName = preg_replace('/[^a-zA-Z0-9_-]/', '', $obj->name);
176+
$files = glob("$record_path/{$safeName}*.flv");
174177
foreach ($files as $value) {
175178
if (time()<=filemtime($value)+$tolerance) {
176179
$obj->response = true;

0 commit comments

Comments
 (0)