Skip to content

Commit 393dfa7

Browse files
ddb4githubJing Chen
andauthored
Fixed: #125 XSS vulnerabilities for alert/removal/reports page (#130)
Co-authored-by: Jing Chen <three_chenjing@sohu.com>
1 parent 3df5fdc commit 393dfa7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

syslog_alerts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function form_actions() {
152152
/* ==================================================== */
153153

154154
$alert_info = syslog_db_fetch_cell('SELECT name FROM `' . $syslogdb_default . '`.`syslog_alert` WHERE id=' . $matches[1]);
155-
$alert_list .= '<li>' . $alert_info . '</li>';
155+
$alert_list .= '<li>' . html_escape($alert_info) . '</li>';
156156
$alert_array[] = $matches[1];
157157
}
158158
}
@@ -789,7 +789,7 @@ function syslog_alerts() {
789789
if (cacti_sizeof($alerts)) {
790790
foreach ($alerts as $alert) {
791791
form_alternate_row('line' . $alert['id'], true);
792-
form_selectable_cell("<a class='linkEditMain' href='" . $config['url_path'] . 'plugins/syslog/syslog_alerts.php?action=edit&id=' . $alert['id'] . "'>" . ((get_request_var('filter') != '') ? preg_replace('/(' . preg_quote(get_request_var('filter')) . ')/i', "<span class='filteredValue'>\\1</span>", $alert['name']) : $alert['name']) . '</a>', $alert['id']);
792+
form_selectable_cell(filter_value($alert['name'], get_request_var('filter'), $config['url_path'] . 'plugins/syslog/syslog_alerts.php?action=edit&id=' . $alert['id']), $alert['id']);
793793
form_selectable_cell($severities[$alert['severity']], $alert['id']);
794794
form_selectable_cell(($alert['method'] == 1 ? __('Threshold', 'syslog'):__('Individual', 'syslog')), $alert['id']);
795795
form_selectable_cell(($alert['method'] == 1 ? $alert['num']:__('N/A', 'syslog')), $alert['id']);

syslog_removal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function form_actions() {
165165
FROM `" . $syslogdb_default . "`.`syslog_remove`
166166
WHERE id=" . $matches[1]);
167167

168-
$removal_list .= '<li>' . $removal_info . '</li>';
168+
$removal_list .= '<li>' . html_escape($removal_info) . '</li>';
169169
$removal_array[] = $matches[1];
170170
}
171171
}

syslog_reports.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function form_actions() {
152152
FROM `' . $syslogdb_default . '`.`syslog_reports`
153153
WHERE id=' . $matches[1]);
154154

155-
$report_list .= '<li>' . $report_info . '</li>';
155+
$report_list .= '<li>' . html_escape($report_info) . '</li>';
156156
$report_array[] = $matches[1];
157157
}
158158
}

0 commit comments

Comments
 (0)