Description: CVE-2014-4002 Unspecified Cross-Site Scripting Vulnerability
Author: cigamit
Source: http://svn.cacti.net/viewvc?view=rev&revision=7451
Source: http://svn.cacti.net/viewvc?view=rev&revision=7452
Source: svn://svn.cacti.net/cacti/cacti@7458
--- a/host_templates.php
+++ b/host_templates.php
@@ -117,6 +117,10 @@
 function form_actions() {
 	global $colors, $host_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/cdef.php
+++ b/cdef.php
@@ -158,6 +158,10 @@
 function form_actions() {
 	global $colors, $cdef_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/data_queries.php
+++ b/data_queries.php
@@ -195,6 +195,10 @@
 function form_actions() {
 	global $colors, $dq_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/data_sources.php
+++ b/data_sources.php
@@ -307,6 +307,10 @@
 function form_actions() {
 	global $colors, $ds_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/host.php
+++ b/host.php
@@ -175,6 +175,10 @@
 function form_actions() {
 	global $colors, $device_actions, $fields_host_edit;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/data_input.php
+++ b/data_input.php
@@ -153,6 +153,10 @@
 function form_actions() {
 	global $colors, $di_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/graph_templates.php
+++ b/graph_templates.php
@@ -164,6 +164,10 @@
 function form_actions() {
 	global $colors, $graph_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/graphs.php
+++ b/graphs.php
@@ -267,6 +267,11 @@
 
 function form_actions() {
 	global $colors, $graph_actions;
+
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/data_templates.php
+++ b/data_templates.php
@@ -254,6 +254,10 @@
 function form_actions() {
 	global $colors, $ds_actions;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		$selected_items = unserialize(stripslashes($_POST["selected_items"]));
--- a/graph_templates_inputs.php
+++ b/graph_templates_inputs.php
@@ -52,6 +52,11 @@
 		$graph_input_values = array();
 		$selected_graph_items = array();
 
+		/* ================= input validation ================= */
+		input_validate_input_number(get_request_var_post("graph_template_input_id"));
+		input_validate_input_number(get_request_var_post("graph_template_id"));
+		/* ==================================================== */
+
 		$save["id"] = $_POST["graph_template_input_id"];
 		$save["hash"] = get_hash_graph_template($_POST["graph_template_input_id"], "graph_template_input");
 		$save["graph_template_id"] = $_POST["graph_template_id"];
--- a/user_admin.php
+++ b/user_admin.php
@@ -72,6 +72,10 @@
 function form_actions() {
 	global $colors, $user_actions, $auth_realms;
 
+	/* ================= input validation ================= */
+	input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)$");
+	/* ==================================================== */
+
 	/* if we are to save this form, instead of display it */
 	if (isset($_POST["selected_items"])) {
 		if (get_request_var_post("drp_action") != "2") {
