mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #11878 from Jellyfrog/bug/security-fixes
Prevent unauthorized access to device graphs
This commit is contained in:
@ -72,6 +72,12 @@ class DeviceController extends Controller
|
||||
if ($current_tab == 'port') {
|
||||
$vars = Url::parseLegacyPath($request->path());
|
||||
$port = Port::findOrFail($vars->get('port'));
|
||||
|
||||
// This prevents users from traversal device id's by piggybacking on the auth for the specified port
|
||||
if ($port->device_id !== $device_id) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$this->authorize('view', $port);
|
||||
} else {
|
||||
$this->authorize('view', $device);
|
||||
|
@ -17,9 +17,7 @@ $start = microtime(true);
|
||||
$init_modules = array('web', 'graphs', 'auth');
|
||||
require realpath(__DIR__ . '/..') . '/includes/init.php';
|
||||
|
||||
$auth = Auth::check() || is_client_authorized($_SERVER['REMOTE_ADDR']);
|
||||
|
||||
if (!$auth) {
|
||||
if (!(Auth::check() || is_client_authorized($_SERVER['REMOTE_ADDR']))) {
|
||||
die('Unauthorized');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user