Skip to content

Commit

Permalink
Fix XSS vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorino committed Jan 2, 2025
1 parent 1093caa commit 3d660ec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions crellyslider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Crelly Slider
* Plugin URI: https://wordpress.org/plugins/crelly-slider/
* Description: A free responsive slider that supports layers. Add texts, images, videos and beautify them with transitions and animations.
* Version: 1.4.6
* Version: 1.4.7
* Author: Fabio Rinaldi
* Author URI: https://github.com/fabiorino
* Text Domain: crelly-slider
Expand All @@ -18,7 +18,7 @@

define('CS_DEBUG', true);

define('CS_VERSION', '1.4.6');
define('CS_VERSION', '1.4.7');
define('CS_MIN_CAPABILITY', 'manage_options');
define('CS_PATH', plugin_dir_path(__FILE__));
define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: fabiorino
Donate link: http://crellyslider.altervista.org/contribute-and-support/
Tags: slider, layers, animations, transitions, texts, images, videos
Requires at least: 4.6
Tested up to: 6.5
Stable tag: 1.4.6
Tested up to: 6.7
Stable tag: 1.4.7
License: MIT
License URI: http://opensource.org/licenses/MIT

Expand Down Expand Up @@ -54,6 +54,9 @@ You can find the documentation <a href="http://crellyslider.altervista.org/docum

== Changelog ==

= 1.4.7 =
* Fixed XSS vulnerability.

= 1.4.6 =
* Fixed security issue.
* Fixed PHP warning.
Expand Down
10 changes: 5 additions & 5 deletions wordpress/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class="cs-slide-editing-area"
echo 'data-background-image-src="' . stripslashes($slide->background_type_image) . '"';
}

$background_url = CrellySliderCommon::getURL(stripslashes($slide->background_type_image));
$background_url = esc_url(CrellySliderCommon::getURL(stripslashes($slide->background_type_image)));

?>
style="
Expand All @@ -36,7 +36,7 @@ class="cs-slide-editing-area"

$link_output = '<a' . "\n" .
'class="cs-element cs-' . esc_attr($element->type) . '-element"' . "\n" .
'href="' . stripslashes($element->link) . '"' . "\n" .
'href="' . esc_url($element->link) . '"' . "\n" .
$target . "\n" .
'style="' .
'z-index: ' . esc_attr($element->z_index) . ';' . "\n" .
Expand Down Expand Up @@ -78,7 +78,7 @@ class="cs-slide-editing-area"
case 'image':
?>
<img
src="<?php echo CrellySliderCommon::getURL(stripslashes($element->image_src)); ?>"
src="<?php echo esc_url(CrellySliderCommon::getURL(stripslashes($element->image_src))); ?>"
alt="<?php echo esc_attr($element->image_alt); ?>"
style="
<?php
Expand Down Expand Up @@ -416,7 +416,7 @@ function crellyslider_printTextElement($element) {
<td class="cs-content">
<?php
if($void) echo '<input class="cs-element-link" type="text" value="" />';
else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
else echo '<input class="cs-element-link" type="text" value="' . esc_url($element->link) .'" />';
?>
<br />
<?php
Expand Down Expand Up @@ -666,7 +666,7 @@ function crellyslider_printImageElement($element) {
<td class="cs-content">
<?php
if($void) echo '<input class="cs-element-link" type="text" value="" />';
else echo '<input class="cs-element-link" type="text" value="' . stripslashes($element->link) .'" />';
else echo '<input class="cs-element-link" type="text" value="' . esc_url($element->link) .'" />';
?>
<br />
<?php
Expand Down
6 changes: 3 additions & 3 deletions wordpress/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ public static function output($alias) {

if($slide->link != '') {
if($slide->link_new_tab) {
$output .= '<a class="cs-background-link" target="_blank" href="' . stripslashes($slide->link) . '"></a>';
$output .= '<a class="cs-background-link" target="_blank" href="' . esc_url($slide->link) . '"></a>';
}
else {
$output .= '<a class="cs-background-link" href="' . stripslashes($slide->link) . '"></a>';
$output .= '<a class="cs-background-link" href="' . esc_url($slide->link) . '"></a>';
}
}

Expand All @@ -112,7 +112,7 @@ public static function output($alias) {
'data-top="' . esc_attr($element->data_top) . '"' . "\n" .
'data-left="' . esc_attr($element->data_left) . '"' . "\n" .
'data-time="' . esc_attr($element->data_time) . '"' . "\n" .
'href="' . stripslashes($element->link) . '"' . "\n" .
'href="' . esc_url($element->link) . '"' . "\n" .
$target . "\n" .
'style="' .
'z-index: ' . $element->z_index . ';' . "\n" .
Expand Down
2 changes: 1 addition & 1 deletion wordpress/slides.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function crellyslider_printSlide($slider, $slide, $edit) {
<td class="cs-content">
<?php
if($void) echo '<input class="cs-background-link" type="text" value="" />';
else echo '<input class="cs-background-link" type="text" value="' . stripslashes($slide->link) .'" />';
else echo '<input class="cs-background-link" type="text" value="' . esc_url($slide->link) .'" />';
?>
<br />
<?php
Expand Down

0 comments on commit 3d660ec

Please sign in to comment.