← Recursos

WordPress

Checklist de seguridad para WordPress: qué revisar al heredar un sitio

Primer pase cuando te pasan un WordPress que no has montado tú. Márcala. Este navegador guarda lo ya revisado en este equipo.

· Rafael Ramos · 0 de 27 revisados

Acceso y usuarios

  • WP-CLI

    wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
  • WP-CLI

    wp user list --fields=ID,user_login,roles,user_registered
  • WP-CLI

    wp user reset-password USUARIO
  • WP-CLI

    wp config shuffle-salts

Actualizaciones

  • WP-CLI

    wp core version
    wp core check-update
  • WP-CLI

    wp plugin list --update=available --fields=name,status,version,update_version
  • WP-CLI

    wp plugin list --status=inactive --fields=name,status,version
    wp plugin delete NOMBRE
  • WP-CLI

    wp theme list --fields=name,status,version,update
    wp theme delete NOMBRE

Configuración

  • WP-CLI

    wp config get WP_DEBUG
  • Terminal

    curl -sI "https://EL-SITIO/wp-content/debug.log"
  • Terminal

    find . -type d ! -perm 755 -print
    find . -type f ! -perm 644 -print
  • WP-CLI

    wp config set DISALLOW_FILE_EDIT true --raw
  • Terminal

    curl -sI "https://EL-SITIO/xmlrpc.php"

Código a medida

  • PHP

    check_admin_referer('guardar_ajuste');
  • PHP

    if (!current_user_can('manage_options')) {
      wp_die('No autorizado');
    }
  • PHP

    $fila = $wpdb->get_row($wpdb->prepare(
      'SELECT id, nombre FROM {$wpdb->prefix}tabla WHERE id = %d',
      $id
    ));
  • PHP

    $nombre = sanitize_text_field(wp_unslash($_POST['nombre'] ?? ''));
    echo esc_html($nombre);

Copias y recuperación

  • WP-CLI

    wp db export copia.sql

Detección

  • Terminal

    find . -type f -mtime -14 -not -path '*/cache/*' -not -path '*/upgrade/*'
  • WP-CLI

    wp cron event list

Servidor

  • WP-CLI

    wp option get siteurl
    wp option get home
  • Terminal

    curl -sI "https://EL-SITIO" | grep -iE 'strict-transport-security|x-frame-options|x-content-type-options|content-security-policy|referrer-policy'
WhatsApp