Created
November 29, 2017 14:04
-
-
Save igmoweb/5daf7ed1862e390e8cf3c1df8e6bea65 to your computer and use it in GitHub Desktop.
Ejemplo de plugin con CSRF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Un ejemplo de plugin con un problema de CSRF | |
*/ | |
add_action( 'init', 'maybe_delete_user' ); | |
function maybe_delete_user() { | |
if ( isset( $_POST['action'] ) && $_POST['action'] === 'delete-user' ) { | |
if ( ! current_user_can( 'manage_options' ) ) { | |
return; | |
} | |
$user_id = absint( $_POST['user_id'] ); | |
wp_delete_user( $user_id ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment