Skip to content

Commit 99156fd

Browse files
committed
🐛 FIX: Unauthenticated attacker can update option
🐛 FIX: Unauthenticated attacker can update option value for "udp_agent_allow_tracking" via "init" hook due to missing authorization and nonce check in it's callback function "on_init".
1 parent ae88530 commit 99156fd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

includes/udp/class-udp-agent.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ public function show_settings_ui() {
172172
* @since 1.0.0
173173
*/
174174
private function process_user_tracking_choice() {
175+
// Check if the user is logged in and has the capability to manage options.
176+
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
177+
// Redirect to home page.
178+
wp_safe_redirect( home_url() );
179+
exit;
180+
}
175181

176182
$users_choice = isset( $_GET['udp-agent-allow-access'] ) ? sanitize_text_field( wp_unslash( $_GET['udp-agent-allow-access'] ) ) : ''; //phpcs:ignore
177183

0 commit comments

Comments
 (0)