CVE-2015-10118: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (CWE-79)
value: A vulnerability classified as problematic was found in cchetanonline WP-CopyProtect up to 3.0.0. This vulnerability affects the function CopyProtect_options_page of the file wp-copyprotect.php. The manipulation of the argument CopyProtect_nrc_text leads to cross site scripting. The attack can be initiated remotely. Upgrading to version 3.1.0 is able to address this issue. The patch is identified as 8b8fe4102886b326330dc1ff06b17313fb10aee5. It is recommended to upgrade the affected component. VDB-231202 is the identifier 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-06-12T07:15Z
Repository: https://github.com/wp-plugins/wp-copyprotect
Language: Other
Files changed: readme.txt, wp-copyprotect.php
Commit date: 2015-06-23 13:41:01 +0000
Commit message: Sanitising user input for protection. Avoiding XSS attacks. Reference: https://codex.wordpress.org/Function_Reference/sanitize_text_field


git-svn-id: https://plugins.svn.wordpress.org/wp-copyprotect/trunk@1186194 b8457f37-d9ea-0310-8a92-e5e31aec5664

Diff: diff --git a/readme.txt b/readme.txt
index 0aee65d..f1c3f8b 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,11 +2,11 @@
 Contributors: cchetanonline
 Donate link: http://chetangole.com/blog/wp-copyprotect/#donate
 Tags: post, posts, copy, protect, right, click, disable, copyprotect, Google, SEO, page, plugin, access, content, javascript, security, wp-copyprotect, RSS, fetcher, duplicate, Bing, 
 Requires at least: 2
 Tested up to: 4.2
-Stable tag: 3.0.0
+Stable tag: 3.1.0
 License: GPLv2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 
 Protect your blog content from getting copied. A simple plug-in developed to stop the Copy cats
 
@@ -52,11 +52,13 @@ No, This plug-in is developed in PHP and javascript, for this reason the plug-in
 Catch me on [Wp-CopyProtect Homepage](http://chetangole.com/blog/wp-copyprotect/)
 
 == Screenshots ==
 1. Configuration page
 
-== Changelog ==
+== Changelog ==
+= ver : 3.1.0 =
+ 1. Sanitising user input for protection. Avoiding XSS attacks. Reference: https://codex.wordpress.org/Function_Reference/sanitize_text_field
 = ver : 3.0.0 = 
  1. Added user specific setting, now you can disable WP Copy Protect for admin/logged-in users. 
  2. Moved menu to top level. 
 = ver : 2.2.0 =
  1. Compatibility tag added for WP 3+
diff --git a/screenshot-1.png b/screenshot-1.png
index 3a281ed..f993e08 100644
Binary files a/screenshot-1.png and b/screenshot-1.png differ
diff --git a/wp-copyprotect.php b/wp-copyprotect.php
index bd713cc..451c222 100644
--- a/wp-copyprotect.php
+++ b/wp-copyprotect.php
@@ -1,17 +1,17 @@
 <?php
 /*
 Plugin Name: WP-CopyProtect [Protect your blog posts]
 Plugin URI: http://chetangole.com/blog/wp-copyprotect/
 Description: This plug-in will protect your blog content [posts] from being copied. A simple plug-in developed to stop the Copy cats.
-Version: 3.0.0
+Version: 3.1.0
 Author: Chetan Gole
 Author URI: http://chetangole.com/
 */
 
 /*
-Copyright (C) 2013  Chetan Gole - chetangole.com
+Copyright (C) 2015  Chetan Gole - chetangole.com
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.
@@ -31,11 +31,11 @@ function CopyProtect_no_right_click($CopyProtect_click_message)
 {
 ?>
 <script type="text/javascript">
 <!--
 /******************************************************************************
-***   COPY PROTECTED BY CHETANGOLE.COM/BLOG/WP-COPYPROTECT   version 3.0.0 ****
+***   COPY PROTECTED BY http://chetangole.com/blog/wp-copyprotect/   version 3.1.0 ****
 ******************************************************************************/
 var message="<?php echo $CopyProtect_click_message; ?>";
 function clickIE4(){
 if (event.button==2){
 alert(message);
@@ -70,11 +70,11 @@ function CopyProtect_no_right_click_without_message()
 {
 ?>
 <script type="text/javascript">
 <!--
 /******************************************************************************
-***   COPY PROTECTED BY CHETANGOLE.COM/BLOG/WP-COPYPROTECT   version 3.0.0 ****
+***   COPY PROTECTED BY http://chetangole.com/blog/wp-copyprotect/   version 3.1.0 ****
 ******************************************************************************/
 function clickIE4(){
 if (event.button==2){
 return false;
 }
@@ -105,11 +105,11 @@ document.oncontextmenu=new Function("return false")
 function CopyProtect_no_select()
 {
 ?>
 <script type="text/javascript">
 /******************************************************************************
-***   COPY PROTECTED BY CHETANGOLE.COM/BLOG/WP-COPYPROTECT   version 3.0.0 ****
+***   COPY PROTECTED BY http://chetangole.com/blog/wp-copyprotect/   version 3.1.0 ****
 ******************************************************************************/
 function disableSelection(target){
 if (typeof target.onselectstart!="undefined") //For IE 
 	target.onselectstart=function(){return false}
 else if (typeof target.style.MozUserSelect!="undefined") //For Firefox
@@ -145,15 +145,15 @@ function CopyProtect_options_page()
 	| <a href="http://chetangole.com/blog/wp-copyprotect/" target="_blank" title="Visit homepage of wordpress plugin WP-CopyProtect"> Visit Plugin page </a> | <a href="http://chetangole.com/blog/wp-copyprotect/#donate" target="_blank" title="Donate some amount to WP-CopyProtect plugin developer to help him to develop more such plugins"> Donate </a> | <a href="http://chetangole.com/blog/wp-copyprotect/#donors" target="_blank" title="Few power donors,special thanks to them"> Power Donors </a> | <br/><br/>
 <?php
 	if($_POST['CopyProtect_save']){
 		update_option('CopyProtect_nrc',$_POST['CopyProtect_nrc']);
 		update_option('CopyProtect_nts',$_POST['CopyProtect_nts']);
-		update_option('CopyProtect_nrc_text',$_POST['CopyProtect_nrc_text']);
+		update_option('CopyProtect_nrc_text', sanitize_text_field($_POST['CopyProtect_nrc_text']));
 		update_option('CopyProtect_credit',$_POST['CopyProtect_credit']);
 		update_option('CopyProtect_user_setting',$_POST['CopyProtect_user_setting']);
 
-		echo '<div class="updated"><p>Settings saved</p></div>';
+		echo '<div class="updated"><p>Settings saved, Please clear/update cache if you are using any cache plugin</p></div>';
 	}
 	$wp_CopyProtect_nrc = get_option('CopyProtect_nrc');
 	$wp_CopyProtect_nts = get_option('CopyProtect_nts');
 	$wp_CopyProtect_credit = get_option('CopyProtect_credit');
 	$wp_CopyProtect_user_setting = get_option('CopyProtect_user_setting');

Vulnerable code: Stable tag: 3.0.0
== Changelog ==
Version: 3.0.0
Copyright (C) 2013  Chetan Gole - chetangole.com
***   COPY PROTECTED BY CHETANGOLE.COM/BLOG/WP-COPYPROTECT   version 3.0.0 ****
***   COPY PROTECTED BY CHETANGOLE.COM/BLOG/WP-COPYPROTECT   version 3.0.0 ****
***   COPY PROTECTED BY CHETANGOLE.COM/BLOG/WP-COPYPROTECT   version 3.0.0 ****
		update_option('CopyProtect_nrc_text',$_POST['CopyProtect_nrc_text']);
		echo '<div class="updated"><p>Settings saved</p></div>';
Fixed code: Stable tag: 3.1.0
== Changelog ==
= ver : 3.1.0 =
 1. Sanitising user input for protection. Avoiding XSS attacks. Reference: https://codex.wordpress.org/Function_Reference/sanitize_text_field
Version: 3.1.0
Copyright (C) 2015  Chetan Gole - chetangole.com
***   COPY PROTECTED BY http://chetangole.com/blog/wp-copyprotect/   version 3.1.0 ****
***   COPY PROTECTED BY http://chetangole.com/blog/wp-copyprotect/   version 3.1.0 ****
***   COPY PROTECTED BY http://chetangole.com/blog/wp-copyprotect/   version 3.1.0 ****
		update_option('CopyProtect_nrc_text', sanitize_text_field($_POST['CopyProtect_nrc_text']));
		echo '<div class="updated"><p>Settings saved, Please clear/update cache if you are using any cache plugin</p></div>';