Repository navigation
In review
Description
Several FlowView files outside the NBAR work still build SQL, shell commands and HTML by hand where Cacti's core API does the job. Each of these was read for realm and reachability, and the changes below keep behaviour the same for valid input.
Fixed (files not touched by #297)
flowview_databases.phpflowview_get_item_details(): the registry details lookup uses the keys of the row id sent by the browser as column names. Column names can not be bound, so only columns of the table are accepted; any other key returns no row. Reachable with the NetFlow Admin realm.flowview_databases.phpview_db_table(),view_dns_cache(),view_routes(): registry, DNS cache and ARIN values (downloaded from external registries) and the Source options were printed withouthtml_escape().flowview_filters.phpactions_filters()/show_filters(): the Filter names in the action confirmation and the listener name in the list were printed withouthtml_escape(). The Delete, Disable and Enable actions concatenated the (already validated) ids into SQL; they now useflowview_db_execute_prepared().flowview_process.php: the due-schedule query concatenated the queued ids and the time; it now binds them.flowview_bulkarin.php(CLI): the whois path, provider and CIDR were passed to the shell unescaped; they now go throughcacti_escapeshellcmd()/cacti_escapeshellarg().flowview_upgrade.php(CLI):plugin_flowview_versionwas written straight tosettings; it now usesset_config_option().
Reviewed and left
$_POSTloops overchk_*inflowview_filters.phpandflowview_databases.php: the core idiom; each id is checked withinput_validate_input_number().db_qstr()-quoted LIKE filters inflowview_databases.phpandcli/fixprivate.php: already escaped.DROP TABLE/ALTER TABLEwith names frominformation_schema(flowview_cleanup.php,flowview_drop_raw_tables.php,flowview_process.php,cli/repair_tables.php,cli/fixprivate.php): identifiers from the server, not from a request.flowview_runner.phpexec_background()andcli/materialize_queries.phpproc_open(): integer ids from the database, and an argument array without a shell.includes/arrays.php:610,618: a translated label inside SQL; not request data.
Also noticed, not changed
plugin_flowview_querieshas noenabledcolumn, so the Disable and Enable actions of the Filters page fail with an SQL error.flowview_databases.php?action=purgeempties the DNS cache on a GET request.view_db_table()reads$tabs[$tab]before checking that the tab exists, which logs PHP warnings when the registry tabs are switched off.
Deferred until #297 merges
#297 changes these files, so they are left alone here to avoid conflicts. Line numbers are from develop.
includes/functions.php:8576(wgetdownload): escape$local_file,$remote_fileand each proxy value withcacti_escapeshellarg().includes/functions.php:9114(whois origin lookup): same change asflowview_bulkarin.php,cacti_escapeshellcmd($whois_path)andcacti_escapeshellarg()for the provider and CIDR.includes/functions.php:9446(flow-export):cacti_escapeshellcmd($flow_export)andcacti_escapeshellarg($file).flowview_schedules.php:446:flowview_db_fetch_row_prepared('SELECT * FROM plugin_flowview_schedules WHERE id = ?', [$save['id']]).flowview_devices.php:252:flowview_db_fetch_cell_prepared(... WHERE id = ?, [$matches[1]])andhtml_escape()on the name.flowview_devices.php:517-522, 747-754, 1053-1064andflowview_schedules.php:722-728, 1029-1033:html_escape()the text columns (listener and schedule names, addresses, e-mail, sender) passed toform_selectable_cell().includes/functions.php:4696, 4714: directsettingswrites for the rematerialize queue. Left as is: the delete is conditional on the stored token, whichset_config_option()can not express.flowview.php:301, 450: the whole of$_REQUESTis saved to and restored from the session. Not a raw read, but worth a look when that page is next changed.
Metadata
Metadata
Assignees
Labels
No labels
Activity