WordPress : Protéger votre blog contre les demandes d’URL malveillants

En raison de sa popularité, WordPress est souvent la cible de pirates informatiques. Pour réduire le risque de piratage par URL voici une solution simple et rapide à mettre en place.  Ajouter le code suivant dans votre fichier function.php de votre thème.


 255 || 

			stripos($_SERVER['REQUEST_URI'], "eval(") || 

			stripos($_SERVER['REQUEST_URI'], "CONCAT") || 

			stripos($_SERVER['REQUEST_URI'], "UNION+SELECT") || 

			stripos($_SERVER['REQUEST_URI'], "base64")) {

				@header("HTTP/1.1 414 Request-URI Too Long");

				@header("Status: 414 Request-URI Too Long");

				@header("Connection: Close");

				@exit;

		}

	}

} ?>

Une fois le code mis en place, il va discrètement et efficacement bloquer toutes les tentatives d’attaque par URL.

(Bien sur je rappelle qu’il n’y a aucune solution fiable à 100%, mais cela réduit le risque)

Exemple d’URL bloqué :


http://example.com/path/?../
http://example.com/path/?php://
http://example.com/path/?scanner
http://example.com/path/?boot.ini
http://example.com/path/?echo.*kae
http://example.com/path/?mosconfig
http://example.com/path/?etc/passwd
http://example.com/path/?path=./
http://example.com/path/?=\'
http://example.com/path/?=\%27
http://example.com/path/?environ
http://example.com/path/?menu=
http://example.com/path/?mod=
http://example.com/path/?tag=
http://example.com/path/?ftp:
http://example.com/path/?http:
http://example.com/path/?https:
http://example.com/path/?[
http://example.com/path/?]
http://example.com/path/?

0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest

0 Commentaires
Commentaires en ligne
Afficher tous les commentaires