From fe7f3d3873aa89c3fa698070147ff2ff03de63cd Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Sun, 2 Apr 2017 20:04:39 -0400 Subject: [PATCH] Require CSRF token when changing settings --- scripts/pi-hole/php/savesettings.php | 3 +++ settings.php | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 5c759c6d..e78411e1 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -130,6 +130,9 @@ function isinserverlist($addr) { if(isset($_POST["field"])) { + // Handle CSRF + check_csrf(isset($_POST["token"]) ? $_POST["token"] : ""); + // Process request switch ($_POST["field"]) { // Set DNS server diff --git a/settings.php b/settings.php index 29b0f91b..f7130b8a 100644 --- a/settings.php +++ b/settings.php @@ -392,6 +392,7 @@ @@ -588,6 +589,7 @@ @@ -629,6 +631,7 @@
+ @@ -713,6 +716,7 @@ @@ -764,6 +768,7 @@
@@ -795,12 +800,15 @@
+
+
+
@@ -863,6 +871,7 @@ if($FTL)

Upload only Pi-hole backup files.

+