From 46509472418a70bbf9e6c6972e165881ce392304 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 27 Mar 2022 19:00:43 +0100 Subject: [PATCH 1/2] Fix client portal priority --- portal/portal_post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/portal/portal_post.php b/portal/portal_post.php index ccfa4653..95077f0d 100644 --- a/portal/portal_post.php +++ b/portal/portal_post.php @@ -111,13 +111,15 @@ if(isset($_POST['add_ticket'])){ $client_id = $session_client_id; $contact = $session_contact_id; $subject = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['subject']))); - $priority = $_POST['priority']; $details = trim(mysqli_real_escape_string($mysqli,$purifier->purify(html_entity_decode(nl2br($_POST['details']))))); // Ensure priority is low/med/high (as can be user defined) - if($priority !== "Low" OR $priority !== "Medium" OR $priority !== "High"){ + if($_POST['priority'] !== "Low" && $_POST['priority'] !== "Medium" && $_POST['priority'] !== "High"){ $priority = "Low"; } + else{ + $priority = trim(strip_tags(mysqli_real_escape_string($mysqli,$_POST['priority']))); + } // Get the next Ticket Number and add 1 for the new ticket number $ticket_number = $config_ticket_next_number; From 816ba87485e68e2636167a945496c9e33a199f99 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sun, 27 Mar 2022 20:02:16 +0100 Subject: [PATCH 2/2] SQL Injection / XSS fixes --- api/v1/contacts/read.php | 2 +- client_asset_add_modal.php | 2 +- client_assets.php | 10 +++--- client_certificates.php | 6 ++-- client_contacts.php | 6 ++-- client_departments.php | 4 +-- client_documents.php | 4 +-- client_domains.php | 6 ++-- client_invoices.php | 6 ++-- client_locations.php | 6 ++-- client_logins.php | 6 ++-- client_logs.php | 2 +- client_networks.php | 6 ++-- client_payments.php | 6 ++-- client_quotes.php | 6 ++-- client_recurring_invoices.php | 6 ++-- client_software.php | 6 ++-- client_tickets.php | 6 ++-- client_trips.php | 6 ++-- client_vendors.php | 6 ++-- invoices.php | 2 +- post.php | 64 ++++++++++++++++++++++------------- 22 files changed, 95 insertions(+), 79 deletions(-) diff --git a/api/v1/contacts/read.php b/api/v1/contacts/read.php index 5b4409ea..7f7b4903 100644 --- a/api/v1/contacts/read.php +++ b/api/v1/contacts/read.php @@ -17,7 +17,7 @@ if(isset($_GET['contact_id'])){ // Specific contact via email (single) elseif(isset($_GET['contact_email'])){ - $email = trim($_GET['contact_email']); + $email = trim(strip_tags(mysqli_real_escape_string($mysqli,$_GET['contact_email']))); $sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_email = '$email' AND company_id = '$company_id'"); } diff --git a/client_asset_add_modal.php b/client_asset_add_modal.php index a21c9069..ee3764a8 100644 --- a/client_asset_add_modal.php +++ b/client_asset_add_modal.php @@ -2,7 +2,7 @@