mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix injection vulnerability in ports pages (#15314)
* Fix injection vulnerability in ports pages Unescaped output reported by: https://huntr.dev/users/hainguyen0207 * fix style
This commit is contained in:
@@ -91,7 +91,7 @@ if ((isset($vars['searchbar']) && $vars['searchbar'] != 'hide') || ! isset($vars
|
||||
$output .= "<div class='form-group'>";
|
||||
$output .= "<select name='device_id' id='device_id' class='form-control input-sm'></select> ";
|
||||
|
||||
$hasvalue = ! empty($vars['hostname']) ? "value='" . $vars['hostname'] . "'" : '';
|
||||
$hasvalue = ! empty($vars['hostname']) ? "value='" . htmlspecialchars($vars['hostname']) . "'" : '';
|
||||
|
||||
$output .= "<input type='text' name='hostname' id='hostname' title='Hostname' class='form-control input-sm' " . $hasvalue . " placeholder='Hostname'>";
|
||||
|
||||
@@ -193,7 +193,7 @@ if ((isset($vars['searchbar']) && $vars['searchbar'] != 'hide') || ! isset($vars
|
||||
$output .= '</div>';
|
||||
$output .= "<div class='form-group'>";
|
||||
|
||||
$ifaliasvalue = isset($vars['ifAlias']) ? "value='" . $vars['ifAlias'] . "'" : '';
|
||||
$ifaliasvalue = isset($vars['ifAlias']) ? "value='" . htmlspecialchars($vars['ifAlias']) . "'" : '';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
@@ -245,7 +245,7 @@ if (isset($vars['purge'])) {
|
||||
try {
|
||||
Port::hasAccess(Auth::user())->where('port_id', $vars['purge'])->firstOrFail()->delete();
|
||||
} catch (ModelNotFoundException $e) {
|
||||
echo "<div class='alert alert-danger'>Port ID {$vars['purge']} not found! Could not purge port.</div>";
|
||||
echo "<div class='alert alert-danger'>Port ID " . htmlspecialchars($vars['purge']) . ' not found! Could not purge port.</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user