From f8eadb9b9a1603a0ca5191a011c494c771a5ecf6 Mon Sep 17 00:00:00 2001 From: laf Date: Sat, 14 Jun 2014 23:46:17 +0100 Subject: [PATCH] Added input checking for file include! --- html/ajax_form.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/html/ajax_form.php b/html/ajax_form.php index 602ad6ee3..9899a0a67 100644 --- a/html/ajax_form.php +++ b/html/ajax_form.php @@ -24,9 +24,13 @@ include_once("includes/authenticate.inc.php"); if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; } -if(file_exists('forms/'.$_POST['type'].'.inc.php')) -{ - include_once('forms/'.$_POST['type'].'.inc.php'); +if(preg_match("/^[a-zA-Z0-9\-]+$/", $_POST['type']) == 1) { + + if(file_exists('forms/'.$_POST['type'].'.inc.php')) + { + include_once('forms/'.$_POST['type'].'.inc.php'); + } + } ?>