Code: Select all
} else if (strcmp($action, "kill264") == 0) {
/* ACTION: Kill existing H264 stream process and cleanup files.
* Parms: <monitor>.
* NOTE: This will be called directly by path, so include files
* may not be available */
session_start();
require_once(dirname(__FILE__)."/../includes/functions.php");
if (!isset($_GET['monitor'])) {
logXmlErr("Not all parameters specified for kill264");
exit;
}
$monitor = $_GET['monitor'];
kill264proc($monitor);
$pid = trim(shell_exec("pgrep -f -x \"zmstreamer -m ".$monitor."\""));
obviously easy to escape to the shell.
In addition to shell execute there are SQL injection issues like in:
Code: Select all
} else if (strcmp($action, "vevent") == 0) {
...
$eventsSql = "select E.Id, E.MonitorId, E.Name, E.StartTime, E.Length, E.Frames from Events as E where (E.Id = ".$_GET['eid'].")";
$event = dbFetchOne($eventsSql);
Again its great to see code being contributed to trunk and thanks again to eyeZM for doing so, but having it enabled by default like this certainly opens a lot of security holes.
I am not all talk however and it is certainly not eyeZM's job to fix it, so I will try to get a patch together to fix most of the major issues I see. Overall shell execute calls from php should only be used when absolutely necessary, and for mysql prepared statements would be best but given most of the doesn't use them making sure to use the proper validators and dbEscape would take a second place.