Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/acf-frontend-form-element/acf-frontend.php
+++ b/acf-frontend-form-element/acf-frontend.php
@@ -3,7 +3,7 @@
* Plugin Name: Frontend Admin
* Plugin URI: https://www.dynamiapps.com/frontend-admin/
* Description: This awesome plugin allows you to easily display admin forms to the frontend of your site so your clients can easily edit content on their own from the frontend.
- * Version: 3.29.10
+ * Version: 3.29.11
* Author: Shabti Kaplan
* Author URI: https://www.dynamiapps.com/
* Text Domain: frontend-admin
--- a/acf-frontend-form-element/main/admin/admin-pages/forms/sections/permissions.php
+++ b/acf-frontend-form-element/main/admin/admin-pages/forms/sections/permissions.php
@@ -231,6 +231,8 @@
'edit_users' => __( 'Edit Other Users', 'frontend-admin' ),
'edit_terms' => __( 'Edit Terms', 'frontend-admin' ),
'delete_terms' => __( 'Delete Terms', 'frontend-admin' ),
+ 'delete_posts' => __( 'Delete Other's Posts', 'frontend-admin' ),
+ 'delete_users' => __( 'Delete Other Users', 'frontend-admin' ),
),
'conditional_logic' => array(
array(
--- a/acf-frontend-form-element/main/admin/admin-pages/plans/crud.php
+++ b/acf-frontend-form-element/main/admin/admin-pages/plans/crud.php
@@ -150,6 +150,10 @@
die();
}
+ if ( ! current_user_can( 'manage_options' ) ) {
+ wp_send_json_error( __( 'You do not have permission to do this.', 'frontend-admin' ) );
+ }
+
if( empty( $_POST['plan'] ) ) wp_send_json_error( __( 'No plan found', 'frontend-admin' ) );
$plan_id = intval( $_POST['plan'] );
--- a/acf-frontend-form-element/main/elementor/classes/permissions.php
+++ b/acf-frontend-form-element/main/elementor/classes/permissions.php
@@ -198,6 +198,8 @@
'edit_users' => __( 'Edit Users', 'frontend-admin' ),
'edit_terms' => __( 'Edit Terms', 'frontend-admin' ),
'delete_terms' => __( 'Delete Terms', 'frontend-admin' ),
+ 'delete_posts' => __( 'Delete Other's Posts', 'frontend-admin' ),
+ 'delete_users' => __( 'Delete Other Users', 'frontend-admin' ),
),
'description' => __( 'Allow special permssions. For example, allow authors to edit other user's posts or other users', 'frontend-admin' ),
)
--- a/acf-frontend-form-element/main/frontend/fields/general/class-delete-object.php
+++ b/acf-frontend-form-element/main/frontend/fields/general/class-delete-object.php
@@ -59,10 +59,8 @@
if( empty( $form ) ) {
wp_send_json_error( __( 'Not Allowed to Delete Objects', 'frontend-admin' ) );
- }else{
- $allowed_by_settings = true;
}
-
+
if ( ! empty( $form['fields'][ $key ] ) ) {
$field = $form['fields'][ $key ];
}else{
@@ -112,7 +110,8 @@
$post_id = intval( $objects['post'] );
if ( ! $post_id ) wp_send_json_error( __( 'No Post ID Found', 'frontend-admin' ) );
- if ( ! current_user_can( 'edit_post', $post_id ) && ! $allowed_by_settings ) {
+ $post_special_permissions = $field['special_permissions'] ?? array();
+ if ( ! current_user_can( 'edit_post', $post_id ) && ! in_array( 'delete_posts', $post_special_permissions ) ) {
wp_send_json_error( __( 'You do have have permission to delete this post', 'frontend-admin' ) );
}
@@ -127,7 +126,8 @@
$product_id = intval( $objects['product'] );
if( ! $product_id ) wp_send_json_error( __( 'No Product ID Found', 'frontend-admin' ) );
- if ( ! current_user_can( 'edit_post', $product_id ) && ! $allowed_by_settings ) {
+ $product_special_permissions = $field['special_permissions'] ?? array();
+ if ( ! current_user_can( 'edit_post', $product_id ) && ! in_array( 'delete_posts', $product_special_permissions ) ) {
wp_send_json_error( __( 'You do have have permission to delete this product', 'frontend-admin' ) );
}
@@ -153,8 +153,8 @@
$user_id = intval( $objects['user'] );
if( ! $user_id ) wp_send_json_error( __( 'No User ID Found', 'frontend-admin' ) );
- if( ! current_user_can( 'edit_user', $user_id ) && ! $allowed_by_settings ) {
-
+ $user_special_permissions = $field['special_permissions'] ?? array();
+ if( ! current_user_can( 'edit_user', $user_id ) && ! in_array( 'delete_users', $user_special_permissions ) ) {
wp_send_json_error( __( 'You do have have permission to delete this user', 'frontend-admin' ) );
}
--- a/acf-frontend-form-element/main/frontend/fields/user/class-role.php
+++ b/acf-frontend-form-element/main/frontend/fields/user/class-role.php
@@ -78,6 +78,57 @@
return $field;
}
+ /**
+ * Roles carrying any of these capabilities are treated as privileged: a
+ * requester without promote_users must not be able to self-assign them
+ * via a Role field, even when the field's own role_options allowlist
+ * includes them (e.g. a form intentionally offering "author" alongside
+ * "subscriber" as self-registration choices).
+ */
+ function has_sensitive_capability( $role_slug ) {
+ $sensitive_caps = array(
+ 'manage_options',
+ 'edit_others_posts',
+ 'delete_others_posts',
+ 'edit_private_posts',
+ 'delete_private_posts',
+ 'unfiltered_html',
+ 'unfiltered_upload',
+ 'edit_theme_options',
+ 'edit_files',
+ 'edit_plugins',
+ 'edit_themes',
+ 'install_plugins',
+ 'install_themes',
+ 'update_plugins',
+ 'update_themes',
+ 'update_core',
+ 'delete_plugins',
+ 'delete_themes',
+ 'create_users',
+ 'delete_users',
+ 'edit_users',
+ 'promote_users',
+ 'remove_users',
+ 'manage_network',
+ 'activate_plugins',
+ );
+
+ $role = get_role( $role_slug );
+
+ if ( ! $role ) {
+ return false;
+ }
+
+ foreach ( $sensitive_caps as $cap ) {
+ if ( ! empty( $role->capabilities[ $cap ] ) ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
function validate_value( $is_valid, $value, $field, $input ) {
$allowed_roles = $field['role_options'] ?? array( 'subscriber' );
if ( ! in_array( $value, $allowed_roles ) ) {
@@ -86,6 +137,9 @@
if ( isset( $field['frontend_admin_display_mode'] ) && $field['frontend_admin_display_mode'] == 'hidden' && $field['default_value'] != $value ) {
return __( 'Invalid role option selected.', 'frontend-admin' );
}
+ if ( $this->has_sensitive_capability( $value ) && ! current_user_can( 'promote_users' ) ) {
+ return __( 'You do not have permission to assign this role.', 'frontend-admin' );
+ }
return $is_valid;
}
@@ -93,7 +147,7 @@
function pre_update_value( $checked, $value, $post_id, $field ) {
if( $this->name !== $field['type'] ){
return $checked;
- }
+ }
$user_id = explode( '_', $post_id );
if ( 'user' != $user_id[0] || empty( $user_id[1] ) ) return true; //checked value is not a user field and there is nothing to update
@@ -108,12 +162,12 @@
if ( ! in_array( $value, $allowed_roles ) ) {
wp_die( __( 'Invalid role option selected.', 'frontend-admin' ) );
}
- if ( $value === 'administrator' && ! current_user_can( 'promote_users' ) ) {
- wp_die( __( 'You do not have permission to assign this role.', 'frontend-admin' ) );
+ if ( $this->has_sensitive_capability( $value ) && ! current_user_can( 'promote_users' ) ) {
+ wp_die( __( 'You do not have permission to assign this role.', 'frontend-admin' ) );
}
-
+
$user->set_role( $value );
-
+
return true;
}
--- a/acf-frontend-form-element/main/gutenberg/blocks/step.php
+++ b/acf-frontend-form-element/main/gutenberg/blocks/step.php
@@ -29,8 +29,8 @@
$step_index = isset($step_index) ? $step_index + 1 : 1;
$current_step = $step_index ?? 0;
- $next_button = $attr['next_button_text'] ?? __('Next', 'frontend-admin');
- $prev_button = $attr['prev_button_text'] ?? __('Previous', 'frontend-admin');
+ $next_button = esc_html( $attr['next_button_text'] ?? __('Next', 'frontend-admin') );
+ $prev_button = esc_html( $attr['prev_button_text'] ?? __('Previous', 'frontend-admin') );
--- a/acf-frontend-form-element/main/gutenberg/blocks/steps.php
+++ b/acf-frontend-form-element/main/gutenberg/blocks/steps.php
@@ -61,10 +61,10 @@
$the_step = '<span class="current-step">' . $active_step . '</span>';
if ( isset( $attr['counter_text'] ) ) {
- $counter_text = str_replace( '{current_step}', $the_step, $attr['counter_text'] );
+ $counter_text = str_replace( '{current_step}', $the_step, esc_html( $attr['counter_text'] ) );
$counter_text = str_replace( '{total_steps}', $steps_total, $counter_text );
} else {
- $counter_text = $attr['counter_prefix'] . $the_step . $attr['counter_suffix'];
+ $counter_text = esc_html( $attr['counter_prefix'] ) . $the_step . esc_html( $attr['counter_suffix'] );
}
$counter = sprintf(
--- a/acf-frontend-form-element/main/plugin.php
+++ b/acf-frontend-form-element/main/plugin.php
@@ -104,7 +104,7 @@
define( 'FEA_URL', $data['plugin_url'] );
define( 'FEA_DIR', $data['plugin_dir'] );
define( 'FEA_PLUGIN', $data['plugin'] );
- define( 'FEA_VERSION', '3.29.10' );
+ define( 'FEA_VERSION', '3.29.11' );
do_action( 'front_end_admin_loaded' );
// Add tutorial videos to plugin item on plugins page