CVE-2014-125096: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (CWE-79)
value: A vulnerability was found in Fancy Gallery Plugin 1.5.12 on WordPress. It has been declared as problematic. Affected by this vulnerability is an unknown functionality of the file class.options.php of the component Options Page. The manipulation leads to cross site scripting. The attack can be launched remotely. Upgrading to version 1.5.13 is able to address this issue. The identifier of the patch is fdf1f9e5a1ec738900f962e69c6fa4ec6055ed8d. It is recommended to upgrade the affected component. The identifier VDB-225349 was assigned to this vulnerability.
CWE description: The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.
CVSS v3 base score: 6.1
Published: 2023-04-10T03:15Z
Repository: https://github.com/wp-plugins/fancy-gallery
Language: PHP
Files changed: assets/js/fancy-gallery.js, class.options.php, plugin.php, readme.txt, widget.taxonomies.php, widget.taxonomy-cloud.php
Commit date: 2014-11-16 17:21:54 +0000
Commit message: Fixed: XSS issue in the options page, Improved: Options page slug is sanitized now, Fixed Settings warning in taxonomy and taxonomy cloud widget

git-svn-id: https://plugins.svn.wordpress.org/fancy-gallery/trunk@1026822 b8457f37-d9ea-0310-8a92-e5e31aec5664

Diff: diff --git a/assets/js/fancy-gallery.js b/assets/js/fancy-gallery.js
index 14ace4b..e758230 100755
--- a/assets/js/fancy-gallery.js
+++ b/assets/js/fancy-gallery.js
@@ -54,11 +54,11 @@
         $(options.image_selector)
           .filter(function(){ return !$(this).attr(options.gallery_relation_attr); })
           .removeAttr(options.gallery_relation_attr);
       }
 
-      // Find other link images which belongs to this one
+      // Find other linked images which belongs to this gallery
       if (gallery_relation)
         $gallery = $('a[' + options.gallery_relation_attr + '="' + gallery_relation + '"]');
       else if ($gallery_wrapper.length > 0)
         $gallery = $gallery_wrapper.find(options.image_selector);
       else if ($content_wrapper.length > 0)
diff --git a/class.options.php b/class.options.php
index fa75125..604f7fc 100644
--- a/class.options.php
+++ b/class.options.php
@@ -2,14 +2,16 @@
 Namespace WordPress\Plugin\Fancy_Gallery;
 
 class Options {
   private
     $arr_option_box, # Meta boxes for the option page
+    $options_page_slug, # Slug for the options page
     $core; # Pointer to the core object
 
   public function __construct($core){
     $this->core = $core;
+    $this->options_page_slug = Sanitize_Title(Str_Replace(Array('\\', '/', '_'), '-', __CLASS__));
 
     # Option boxes
     $this->arr_option_box = Array(
       'main' => Array(),
       'side' => Array()
@@ -25,11 +27,11 @@ class Options {
   public function Add_Options_Page(){
     $handle = Add_Options_Page (
       $this->t('Fancy Gallery Options'),
       $this->t('Fancy Gallery'),
       'manage_options',
-      __CLASS__,
+      $this->options_page_slug,
       Array($this, 'Print_Options_Page')
     );
 
     # Add JavaScript to this handle
     Add_Action ('load-' . $handle, Array($this, 'Load_Options_Page'));
@@ -43,11 +45,11 @@ class Options {
     $this->Add_Option_Box($this->t('Gallery "Excerpts"'), DirName(__FILE__).'/options-page/excerpt.php', 'side');
     $this->Add_Option_Box($this->t('Archive Url'), DirName(__FILE__).'/options-page/archive-link.php', 'side');
   }
 
   private function Get_Options_Page_Url($parameters = Array()){
-    $url = Add_Query_Arg(Array('page' => __CLASS__), Admin_Url('options-general.php'));
+    $url = Add_Query_Arg(Array('page' => $this->options_page_slug), Admin_Url('options-general.php'));
     If (Is_Array($parameters) && !Empty($parameters)) $url = Add_Query_Arg($parameters, $url);
     return $url;
   }
 
   public function Load_Options_Page(){
@@ -55,11 +57,11 @@ class Options {
     If (IsSet($_GET['delete']) && $this->core->Get_Template_Properties ($_GET['delete'])){ # You can only delete Fancy Gallery Templates!
       Unlink($_GET['delete']);
       WP_Redirect( $this->Get_Options_Page_Url(Array('template_deleted' => 'true')) );
     }
     ElseIf (IsSet($_GET['delete'])){
-      WP_Die($this->t('Error while deleting: ' . $_GET['delete']));
+      WP_Die($this->t('Error while deleting: ' . HTMLSpecialChars($_GET['delete'])));
     }
 
     # If the Request was redirected from a "Save Options"-Post
     If (IsSet($_REQUEST['options_saved'])) Flush_Rewrite_Rules();
 
diff --git a/plugin.php b/plugin.php
index 13f9d76..9d95ded 100755
--- a/plugin.php
+++ b/plugin.php
@@ -1,11 +1,11 @@
 <?php
 /*
 Plugin Name: Fancy Gallery Lite
 Plugin URI: http://dennishoppe.de/en/wordpress-plugins/fancy-gallery
 Description: Fancy Gallery enables you to create and manage galleries and converts your galleries in post and pages to valid HTML5 blocks and associates linked images with a nice and responsive lightbox.
-Version: 1.5.12
+Version: 1.5.13
 Author: Dennis Hoppe
 Author URI: http://DennisHoppe.de
 */
 
 If (Version_Compare(PHP_VERSION, '5.3.0', '<')){
diff --git a/readme.txt b/readme.txt
index 89edbe4..e485f14 100755
--- a/readme.txt
+++ b/readme.txt
@@ -166,10 +166,15 @@ Fancy Gallery is available as [premium plugin](http://dennishoppe.de/en/wordpres
 Possibly even more important, buying the premium edition gives you access to me and my support team. You can email us your questions about usage of the plugin or your problems in setting it up and we will assist you in no time!
 
 
 == Changelog ==
 
+= 1.5.13 =
+* Fixed: XSS issue in the options page
+* Improved: Options page slug is sanitized now
+* Fixed Settings warning in taxonomy and taxonomy cloud widget
+
 = 1.5.12 =
 * Removed the Install_Template() function
 
 = 1.5.11 =
 * Fixed warning in library import tab
diff --git a/widget.taxonomies.php b/widget.taxonomies.php
index 8002c3a..788257e 100755
--- a/widget.taxonomies.php
+++ b/widget.taxonomies.php
@@ -1,10 +1,12 @@
 <?php
 Namespace WordPress\Plugin\Fancy_Gallery\Widget;
 
 class Taxonomies Extends \WP_Widget {
-  var $core; #  Pointer to the core class
+  public
+    $arr_options,
+    $core; #  Pointer to the core class
 
   function __construct(){
     $this->core = $GLOBALS['WordPress\Plugin\Fancy_Gallery\Core'];
 
     # Setup the Widget data
@@ -118,11 +120,11 @@ class Taxonomies Extends \WP_Widget {
     If (!Taxonomy_Exists($this->Get_Option('taxonomy'))) return False;
 
     # Display Widget
     Echo $args['before_widget'];
 
-    Echo $args['before_title'] . Apply_Filters('widget_title', $this->Get_Option('title'), $settings, $this->id_base) . $args['after_title'];
+    Echo $args['before_title'] . Apply_Filters('widget_title', $this->Get_Option('title'), $this->arr_option, $this->id_base) . $args['after_title'];
 
     Echo '<ul>';
     WP_List_Categories(Array(
       'taxonomy'   => $this->Get_Option('taxonomy'),
       'show_count' => $this->Get_Option('count'),
diff --git a/widget.taxonomy-cloud.php b/widget.taxonomy-cloud.php
index 0b1ff99..0e858ec 100755
--- a/widget.taxonomy-cloud.php
+++ b/widget.taxonomy-cloud.php
@@ -1,10 +1,12 @@
 <?php
 Namespace WordPress\Plugin\Fancy_Gallery\Widget;
 
 class Taxonomy_Cloud Extends \WP_Widget {
-  var $core; #  Pointer to the core class
+  public
+    $arr_option,
+    $core; #  Pointer to the core class
 
   function __construct(){
     $this->core = $GLOBALS['WordPress\Plugin\Fancy_Gallery\Core'];
 
     # Setup the Widget data
@@ -113,11 +115,11 @@ class Taxonomy_Cloud Extends \WP_Widget {
     If (!Taxonomy_Exists($this->Get_Option('taxonomy'))) return False;
 
     # Display Widget
     Echo $args['before_widget'];
 
-    Echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $settings, $this->id_base) . $args['after_title'];
+    Echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $this->arr_option, $this->id_base) . $args['after_title'];
 
     Echo '<ul>';
     WP_Tag_Cloud(Array(
       'taxonomy' => $this->Get_Option('taxonomy'),
       'number'   => $this->Get_Option('number'),

Vulnerable code:       // Find other link images which belongs to this one
      __CLASS__,
    $url = Add_Query_Arg(Array('page' => __CLASS__), Admin_Url('options-general.php'));
      WP_Die($this->t('Error while deleting: ' . $_GET['delete']));
Version: 1.5.12
  var $core; #  Pointer to the core class
    Echo $args['before_title'] . Apply_Filters('widget_title', $this->Get_Option('title'), $settings, $this->id_base) . $args['after_title'];
  var $core; #  Pointer to the core class
    Echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $settings, $this->id_base) . $args['after_title'];
Fixed code:       // Find other linked images which belongs to this gallery
    $options_page_slug, # Slug for the options page
    $this->options_page_slug = Sanitize_Title(Str_Replace(Array('\\', '/', '_'), '-', __CLASS__));
      $this->options_page_slug,
    $url = Add_Query_Arg(Array('page' => $this->options_page_slug), Admin_Url('options-general.php'));
      WP_Die($this->t('Error while deleting: ' . HTMLSpecialChars($_GET['delete'])));
Version: 1.5.13
= 1.5.13 =
* Fixed: XSS issue in the options page
* Improved: Options page slug is sanitized now
* Fixed Settings warning in taxonomy and taxonomy cloud widget

  public
    $arr_options,
    $core; #  Pointer to the core class
    Echo $args['before_title'] . Apply_Filters('widget_title', $this->Get_Option('title'), $this->arr_option, $this->id_base) . $args['after_title'];
  public
    $arr_option,
    $core; #  Pointer to the core class
    Echo $args['before_title'] . Apply_Filters('widget_title', $this->get_option('title'), $this->arr_option, $this->id_base) . $args['after_title'];