Skip to content

Commit f288273

Browse files
Merge pull request #497 from Codeinwp/bugfix/pro/605
Fixed broken access control vulnerability
2 parents 3029740 + 6a0a182 commit f288273

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

classes/plugin.class.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,19 @@ public static function ppom_install_demo_meta() {
927927

928928
function ppom_attach_meta() {
929929

930-
$product_id = isset( $_GET['productid'] ) ? intval( $_GET['productid'] ) : '';
930+
$product_id = isset( $_GET['productid'] ) ? intval( $_GET['productid'] ) : '';
931+
$product_url = get_permalink( $product_id );
932+
933+
if ( ! isset( $_GET['nonce'] ) || empty( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], 'ppom_attach' ) ) {
934+
wp_redirect( $product_url );
935+
exit;
936+
}
937+
938+
if ( ! current_user_can( 'edit_post', $product_id ) ) {
939+
wp_redirect( $product_url );
940+
exit;
941+
}
942+
931943
$meta_id = isset( $_GET['metaid'] ) ? intval( $_GET['metaid'] ) : '';
932944
$meta_title = isset( $_GET['metatitle'] ) ? sanitize_title( $_GET['metatitle'] ) : '';
933945

inc/admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ function ppom_admin_bar_menu() {
808808
'metaid' => $meta->productmeta_id,
809809
'metatitle' => $meta->productmeta_name,
810810
'action' => 'ppom_attach',
811+
'nonce' => wp_create_nonce( 'ppom_attach' ),
811812
);
812813
$apply_link = add_query_arg( $apply_arg, $apply_link );
813814
$bar_title = "Apply {$meta->productmeta_name}";

0 commit comments

Comments
 (0)