Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/blog2social/blog2social.php
+++ b/blog2social/blog2social.php
@@ -10,7 +10,7 @@
* Author: Blog2Social, miaadenion
* Text Domain: blog2social
* Domain Path: /languages
- * Version: 8.8.3
+ * Version: 8.8.4
* Requires at least: 6.2
* Requires PHP: 7.4
* Tested up to: 6.9
@@ -22,7 +22,7 @@
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound, WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
*/
-define('B2S_PLUGIN_VERSION', '883');
+define('B2S_PLUGIN_VERSION', '884');
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
--- a/blog2social/includes/Ajax/Get.php
+++ b/blog2social/includes/Ajax/Get.php
@@ -253,7 +253,7 @@
// Add authorization check for the specific post
if (!current_user_can('read_post',(int) $_POST['postId'])) {
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_author'));
wp_die();
}
--- a/blog2social/includes/Ajax/Post.php
+++ b/blog2social/includes/Ajax/Post.php
@@ -166,12 +166,12 @@
// JM 2026/02/12 Security Patch. Check if a user can edit the post, as this action leads to an insert/update in wp_posts
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id'])) {
if (!current_user_can('edit_post', (int) $_POST['b2s-draft-id'])) {
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
}
@@ -269,7 +269,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
@@ -584,13 +584,13 @@
// JM 2026/02/05 Security Patch. Check if a user can edit the post, as this action leads to an insert/update in wp_posts
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
if (isset($_POST['b2s-draft-id']) && !empty($_POST['b2s-draft-id'])) {
if (!current_user_can('edit_post', (int) $_POST['b2s-draft-id'])) {
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
}
@@ -833,8 +833,8 @@
wp_die();
}
- if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ if(!current_user_can('edit_others_posts')){
+ echo wp_json_encode(array('result' => false,'error' => 'permission_editor'));
wp_die();
}
@@ -1255,7 +1255,7 @@
}
if(!current_user_can('manage_options')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_administrator'));
wp_die();
}
@@ -1299,7 +1299,7 @@
}
if(!current_user_can('manage_options')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_administrator'));
wp_die();
}
@@ -1951,7 +1951,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
@@ -1999,7 +1999,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
@@ -2026,7 +2026,7 @@
if (isset($_POST['postId']) && !empty($_POST['postId']) && (int) $_POST['postId'] > 0) {
if(!current_user_can('delete_post', (int) $_POST['postId'])){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_editor'));
wp_die();
}
@@ -2177,8 +2177,8 @@
wp_die();
}
- if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ if(!current_user_can('edit_others_posts')){
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_editor'));
wp_die();
}
@@ -2210,7 +2210,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_author'));
wp_die();
}
@@ -2267,8 +2267,8 @@
wp_die();
}
- if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ if(!current_user_can('edit_others_posts')){
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_editor'));
wp_die();
}
@@ -2310,8 +2310,8 @@
wp_die();
}
- if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ if(!current_user_can('edit_others_posts')){
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_editor'));
wp_die();
}
@@ -2357,7 +2357,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false, 'error' => 'permission'));
+ echo wp_json_encode(array('result' => false, 'error' => 'permission_author'));
wp_die();
}
@@ -2936,7 +2936,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
@@ -2972,7 +2972,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
@@ -3117,7 +3117,7 @@
}
if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ echo wp_json_encode(array('result' => false,'error' => 'permission_author'));
wp_die();
}
@@ -3452,8 +3452,8 @@
wp_die();
}
- if(!current_user_can('edit_posts')){
- echo wp_json_encode(array('result' => false,'error' => 'permission'));
+ if(!current_user_can('edit_others_posts')){
+ echo wp_json_encode(array('result' => false,'error' => 'permission_editor'));
wp_die();
}
--- a/blog2social/includes/Loader.php
+++ b/blog2social/includes/Loader.php
@@ -1299,7 +1299,7 @@
'LOGIN' => sprintf(__('The connection to your social media account is interrupted. Please check your authorization and reconnect your account. The <a target="_blank" href="%s">troubleshooting guide</a> shows you how to fix the connection to your social media account.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('troubleshoot_auth'))),
'LIMIT' => esc_html__('Your daily limit has been reached.', 'blog2social'),
// translators: %s is a link
- 'IMAGE' => sprintf(__('Your post could not be posted, because your image is not available or the image source is not publish readable. <a target="_blank" href="%s">Guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('IMAGE'))),
+ 'IMAGE' => sprintf(__('The image in your post is unavailable, not publicly accessible, or does not meet the required size or format. <a target="_blank" href="%s">Guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('IMAGE'))),
// translators: %s is a link
'PROTECT' => sprintf(__('The network has blocked your account. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
// translators: %s is a link
--- a/blog2social/views/b2s/html/header.php
+++ b/blog2social/views/b2s/html/header.php
@@ -96,9 +96,19 @@
</div>
</div>
-<div class="panel panel-group b2s-left-border-danger b2s-no-permission" style="display:none;">
+<div class="panel panel-group b2s-left-border-danger b2s-no-permission b2s-no-permission-author" style="display:none;">
<div class="panel-body">
- <span class="glyphicon glyphicon-remove glyphicon-danger"></span> <?php echo esc_html_e('To execute this function, you need author permissions or a higher role. Your current role is Subscriber. Please contact your administrator for access.', 'blog2social'); ?>
+ <span class="glyphicon glyphicon-remove glyphicon-danger"></span> <?php echo esc_html_e('To execute this function, you need author permissions or a higher role. Please contact your administrator for access.', 'blog2social'); ?>
+ </div>
+</div>
+<div class="panel panel-group b2s-left-border-danger b2s-no-permission b2s-no-permission-editor" style="display:none;">
+ <div class="panel-body">
+ <span class="glyphicon glyphicon-remove glyphicon-danger"></span> <?php echo esc_html_e('To execute this function, you need editor permissions or a higher role. Please contact your administrator for access.', 'blog2social'); ?>
+ </div>
+</div>
+<div class="panel panel-group b2s-left-border-danger b2s-no-permission b2s-no-permission-administrator" style="display:none;">
+ <div class="panel-body">
+ <span class="glyphicon glyphicon-remove glyphicon-danger"></span> <?php echo esc_html_e('To execute this function, you need administrator permissions. Please contact your administrator for access.', 'blog2social'); ?>
</div>
</div>