Fix security vuls (#13554)

* Fix XSS vulnerabilities

* fix XSS vulnerabilities in alerts.inc.php

* fix XSS vulnerability in poller-groups.inc.php

* small fix for the integration

* another fix for the inegration

* another fix for the inegration

* change the sanitizer at sources instead of json_encode sinks

* another change sanitizer at sources instead of json_encode sinks

* another change sanitizer at sources instead of common_output and current_config sinks

* fix path manipulation vulnerability
This commit is contained in:
Feras Al-Kassar
2021-11-24 17:00:25 +01:00
committed by GitHub
parent 214f92359c
commit 35a6905092
17 changed files with 46 additions and 46 deletions

View File

@@ -44,5 +44,5 @@ if (! empty($group_name)) {
if (! empty($ok)) {
exit("$ok");
} else {
exit("ERROR: $error");
exit('ERROR: ' . htmlspecialchars($error));
}

View File

@@ -48,10 +48,10 @@ if (isset($_POST['device_id'])) {
if (! empty($update) || $update == '0') {
$status = 'ok';
$message = 'Devices of group ' . $_POST['device_group_id'] . ' will be rediscovered';
$message = 'Devices of group ' . htmlspecialchars($_POST['device_group_id']) . ' will be rediscovered';
} else {
$status = 'error';
$message = 'Error rediscovering devices of group ' . $_POST['device_group_id'];
$message = 'Error rediscovering devices of group ' . htmlspecialchars($_POST['device_group_id']);
}
}
} else {

View File

@@ -38,7 +38,7 @@ if (! Auth::user()->hasGlobalAdmin()) {
if (isset($_POST['device_id'])) {
if (! is_numeric($_POST['device_id'])) {
$status = 'error';
$message = 'Invalid device id ' . $_POST['device_id'];
$message = 'Invalid device id ' . htmlspecialchars($_POST['device_id']);
} else {
$device = Device::find($_POST['device_id']);

View File

@@ -49,10 +49,10 @@ if (isset($_POST['sub_type']) && ! empty($_POST['sub_type'])) {
}
if (dbUpdate(['sensor_alert' => $state], 'sensors', '`sensor_id` = ? AND `device_id` = ?', [$_POST['sensor_id'], $_POST['device_id']]) >= 0) {
$status = ($state == 0) ? 'info' : 'ok';
$message = 'Alerts ' . $state_string . ' for sensor ' . $_POST['sensor_desc'];
$message = 'Alerts ' . $state_string . ' for sensor ' . htmlspecialchars($_POST['sensor_desc']);
} else {
$status = 'error';
$message = 'Couldn\'t ' . substr($state_string, 0, -1) . ' alerts for sensor ' . $_POST['sensor_desc'] . '. Enable debug and check librenms.log';
$message = 'Couldn\'t ' . substr($state_string, 0, -1) . ' alerts for sensor ' . htmlspecialchars($_POST['sensor_desc']) . '. Enable debug and check librenms.log';
}
}
}