zoneminder/web/api/app/Model
Isaac Connor 419846c875 fix: sanitize monitor Device path to prevent command injection (GHSA-g66m-77fq-79v9)
The Device field from the Monitors table was interpolated directly into
shell commands (qx(), backticks, exec()) without sanitization, allowing
authenticated users with monitor-edit permissions to execute arbitrary
commands as www-data via the Device Path field.

Defense in depth:
- Input validation: reject Device values not matching /^\/dev\/[\w\/.\-]+$/
  at save time in both web UI and REST API
- Output sanitization: use escapeshellarg() in PHP and quote validated
  values in Perl at every shell execution point

Affected locations:
- scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm (control, zmcControl)
- scripts/zmpkg.pl.in (system startup)
- web/includes/Monitor.php (zmcControl)
- web/includes/functions.php (zmcStatus, zmcCheck, validDevicePath)
- web/includes/actions/monitor.php (save action)
- web/api/app/Model/Monitor.php (daemonControl, validation rules)
- web/api/app/Controller/MonitorsController.php (daemonStatus)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 13:19:03 -04:00
..
AppModel.php Upgrade cakephp to 2.10.24 2021-02-02 23:19:52 -05:00
CameraModel.php fix: correct App::uses package path in CameraModel 2026-02-15 15:38:08 -05:00
Config.php Merged Angular UI branch API to master 2015-06-11 02:58:58 +00:00
Control.php Merged Angular UI branch API to master 2015-06-11 02:58:58 +00:00
Event.php Add Tags to event search and return tag data with events 2026-01-05 21:43:27 +11:00
EventData.php Fix Monitor=>Frame in associations 2025-12-19 16:48:15 -05:00
Event_Summary.php Merge pull request #3242 from connortechnology/fix_3232_api_monitor_event_summaries 2021-05-19 20:32:50 -04:00
Frame.php Add TimeStampSecs to fields returned for Frames. 2023-01-18 10:07:41 -05:00
Group.php Make Group containable 2019-12-20 14:56:14 -05:00
Host.php Update Host.php (#2062) 2018-03-13 22:28:38 -04:00
Log.php Initial commit of Logs MVC 2014-11-15 19:03:40 +00:00
Manufacturer.php rough in api support for Models and Manufacturers 2021-09-25 20:49:30 -04:00
Monitor.php fix: sanitize monitor Device path to prevent command injection (GHSA-g66m-77fq-79v9) 2026-03-08 13:19:03 -04:00
Monitor_Status.php rough in adding Monitor_Status to Monitors 2018-10-31 11:08:44 -04:00
Notification.php fix: address Copilot review feedback on Notifications API refs #4684 2026-03-05 20:39:54 -05:00
Role.php feat: add User Roles feature for reusable permission templates 2026-01-29 13:34:27 -05:00
RoleGroupPermission.php feat: add User Roles feature for reusable permission templates 2026-01-29 13:34:27 -05:00
RoleMonitorPermission.php feat: add User Roles feature for reusable permission templates 2026-01-29 13:34:27 -05:00
Server.php rough in Server object support 2016-05-02 10:41:25 -04:00
ServerStat.php Add ServerStats to api 2023-02-26 17:04:05 -05:00
Snapshot.php Fix the HABATM relationship in Snapshots 2022-12-07 15:01:08 -05:00
State.php Merged Angular UI branch API to master 2015-06-11 02:58:58 +00:00
Storage.php rough in a Storage Model 2018-05-07 14:09:05 -07:00
Tag.php Add Tags support to API 2023-11-03 13:33:28 -04:00
User.php feat: add User Roles feature for reusable permission templates 2026-01-29 13:34:27 -05:00
UserPreference.php Finish roughing in UserPreference in api 2023-05-12 14:10:53 -04:00
Zone.php Update api Zone Saving. Fixes #3037 2020-09-10 13:31:39 -04:00
ZonePreset.php Merged Angular UI branch API to master 2015-06-11 02:58:58 +00:00