**//Work in Progress//**
====== Spider Bashing ======
{{tag>project software computing}}
{{process:shack-heritage-badge.png}}
===== Situation =====
Am 13.1.2011 wurde ich darauf aufmerksam, dass ein vor mir
betreuter Server erheblich groesseren IP-Traffic verursachte
als bisher ueblich.
Das auf Basis von net-acct arbeitende IP-Accounting
verriet, dass ein grosser Teil des Traffics auf einen
Webservice entfiel. Auf dem Webserver lief ein MediaWiki,
das in der juengeren Vergangenheit Ziel von Spam-Edits geworden war.
Die Untersuchung der Webserver-Logs ergab, dass immer wieder
bestimmte URIs in derselben Reihenfolge abgefragt wurden.
''Beispiel 1: ein typischer Request-Block.''
1 41.190.16.17 - - [16/Jan/2011:06:23:44 +0000] "GET /index.php?title=Main_Page&action=edit HTTP/1.1" 200 6745 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
2 41.190.16.17 - - [16/Jan/2011:06:23:45 +0000] "GET /index.php/Main_Page HTTP/1.1" 200 7227 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
3 41.190.16.17 - - [16/Jan/2011:06:23:46 +0000] "GET /index.php/Talk:Main_Page HTTP/1.1" 200 7021 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
4 41.190.16.17 - - [16/Jan/2011:06:23:47 +0000] "GET /index.php?title=Main_Page&action=history HTTP/1.1" 200 47329 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
5 41.190.16.17 - - [16/Jan/2011:06:23:49 +0000] "GET /index.php?title=Special:Userlogin&returnto=Main_Page HTTP/1.1" 200 7102 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
6 41.190.16.17 - - [16/Jan/2011:06:23:49 +0000] "GET /index.php/LinuXML:Community_Portal HTTP/1.1" 200 6973 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
7 41.190.16.17 - - [16/Jan/2011:06:23:51 +0000] "GET /index.php/Current_events HTTP/1.1" 200 6829 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
8 41.190.16.17 - - [16/Jan/2011:06:23:52 +0000] "GET /index.php/Special:Recentchanges HTTP/1.1" 200 9545 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
9 41.190.16.17 - - [16/Jan/2011:06:23:56 +0000] "GET /index.php/Special:Random HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
10 41.190.16.17 - - [16/Jan/2011:06:23:57 +0000] "GET /index.php/Index.php HTTP/1.1" 200 17642 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
11 41.190.16.17 - - [16/Jan/2011:06:23:58 +0000] "GET /index.php/Help:Contents HTTP/1.1" 200 6804 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
12 41.190.16.17 - - [16/Jan/2011:06:23:59 +0000] "GET /index.php/LinuXML:Site_support HTTP/1.1" 200 6913 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
13 41.190.16.17 - - [16/Jan/2011:06:24:00 +0000] "GET /index.php?title=Special:Whatlinkshere&target=Main_Page HTTP/1.1" 200 6086 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
14 41.190.16.17 - - [16/Jan/2011:06:24:00 +0000] "GET /index.php?title=Special:Recentchangeslinked&target=Main_Page HTTP/1.1" 200 7850 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
15 41.190.16.17 - - [16/Jan/2011:06:24:01 +0000] "GET /index.php/Special:Specialpages HTTP/1.1" 200 10482 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
16 41.190.16.17 - - [16/Jan/2011:06:24:02 +0000] "GET /index.php/LinuXML:Privacy_policy HTTP/1.1" 200 6943 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
17 41.190.16.17 - - [16/Jan/2011:06:24:03 +0000] "GET /index.php/LinuXML:About HTTP/1.1" 200 6808 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
18 41.190.16.17 - - [16/Jan/2011:06:24:04 +0000] "GET /index.php/LinuXML:General_disclaimer HTTP/1.1" 200 7003 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
''Beispiel 2: ein weiterer Request-Block zum Vergleich.''
1 188.92.240.246 - - [16/Jan/2011:04:44:41 +0000] "GET /index.php?title=Main_Page&action=edit HTTP/1.0" 200 6745 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
2 188.92.240.246 - - [16/Jan/2011:04:44:42 +0000] "GET /index.php/Main_Page HTTP/1.0" 200 7227 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
3 188.92.240.246 - - [16/Jan/2011:04:44:42 +0000] "GET /index.php/Talk:Main_Page HTTP/1.0" 200 7021 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
4 188.92.240.246 - - [16/Jan/2011:04:44:43 +0000] "GET /index.php?title=Main_Page&action=history HTTP/1.0" 200 47329 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
5 188.92.240.246 - - [16/Jan/2011:04:44:45 +0000] "GET /index.php?title=Special:Userlogin&returnto=Main_Page HTTP/1.0" 200 7102 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
6 188.92.240.246 - - [16/Jan/2011:04:44:45 +0000] "GET /index.php/LinuXML:Community_Portal HTTP/1.0" 200 6979 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
7 188.92.240.246 - - [16/Jan/2011:04:44:46 +0000] "GET /index.php/Current_events HTTP/1.0" 200 6835 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
8 188.92.240.246 - - [16/Jan/2011:04:44:46 +0000] "GET /index.php/Special:Recentchanges HTTP/1.0" 200 9551 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
9 188.92.240.246 - - [16/Jan/2011:04:44:47 +0000] "GET /index.php/Special:Random HTTP/1.0" 302 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
10 188.92.240.246 - - [16/Jan/2011:04:44:47 +0000] "GET /index.php/Etc/group HTTP/1.0" 200 7626 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
11 188.92.240.246 - - [16/Jan/2011:04:44:48 +0000] "GET /index.php/Help:Contents HTTP/1.0" 200 6810 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
12 188.92.240.246 - - [16/Jan/2011:04:44:48 +0000] "GET /index.php/LinuXML:Site_support HTTP/1.0" 200 6919 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
13 188.92.240.246 - - [16/Jan/2011:04:44:49 +0000] "GET /index.php?title=Special:Whatlinkshere&target=Main_Page HTTP/1.0" 200 6092 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
14 188.92.240.246 - - [16/Jan/2011:04:44:50 +0000] "GET /index.php?title=Special:Recentchangeslinked&target=Main_Page HTTP/1.0" 200 7856 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
15 188.92.240.246 - - [16/Jan/2011:04:44:50 +0000] "GET /index.php/Special:Specialpages HTTP/1.0" 200 10488 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
16 188.92.240.246 - - [16/Jan/2011:04:44:51 +0000] "GET /index.php/LinuXML:Privacy_policy HTTP/1.0" 200 6949 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
17 188.92.240.246 - - [16/Jan/2011:04:44:52 +0000] "GET /index.php/LinuXML:About HTTP/1.0" 200 6814 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
18 188.92.240.246 - - [16/Jan/2011:04:44:52 +0000] "GET /index.php/LinuXML:General_disclaimer HTTP/1.0" 200 7009 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
Es fallen dabei folgende Punkte auf:
* die hohe Kadenz von 18 Requests in 20 Sekunden => Es handelt sich sehr wahrscheinlich um einem Automaten
* der Einstieg in das Webangebot (Zeile 1 im Beispiel 1) mit einem EDIT-Link => Es wird ohen Umschweife versucht, den Inhalt der Startseite des Wikis zu aendern.
* die fast identische Abfolge der aufgerufenen URIs => ein weiterer Hinweis auf einen Automaten
* es werden im wesentlichen spezielle Funktionsseiten der Wiki-Engine aufgerufen. => vermutlich der Versuch, weitere Informationen ueber die Struktur des Wikis zu erhalten
* das Fehlen jeglicher Referer-Angaben ( "-" ) => der Client hat moeglicher Weise vorab detaillierte Informationen ueber die abzufufenden Seiten.
* in Beispiel 2, Zeile 10, der Aufruf einer Seite, die auf keiner der bisher angesteuerten Seiten referenziert ist und wahrscheinlich aus dem Aufruf von /index.php/Special:Random in Zeile 9 resultiert.
* der Nicht-Abruf von Dokumenten, die Seiten lediglich ergaenzen, wie Bildern, CSS- und JS-Dateien.
Von manchen IP-Adressen aus wurden die Request-Bloecke seit Wochen hundert- bis tausendfach wiederholt.
===== Erste Massnahmen =====
Bei IP-Adressen, die ueber einen laengeren Zeitraum die Quelle eines
Angriffs darstellen, liegt es nahe, den Kontakt mit Ihnen zu unterbrechen.
Im vorliegenden Falle geschah das einfach durch Setzen einer Nullroute:
route add $IP gw 127.0.0.1
Das entspricht in den Auswirkungen im Wesentlichen einer Drop-Rule
auf einer Firewall, laesst sich aber ohne lokalen Firewall-Code erreichen.
Der Reihe nach wurden die Adressen 213.172.52.202, 184.73.196.53 und
134.130.184.19 gesperrt.
Das fuehrte zu folgendem bemerkenswerten Ergebnis:
''Beispiel 3: ein Request-Block mit Unterbrechung der IP-Verbindung''
1 213.172.52.202 - - [16/Jan/2011:03:31:05 +0000] "GET /index.php?title=Main_Page&action=edit HTTP/1.1" 200 6745 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
2 213.172.52.202 - - [16/Jan/2011:03:31:14 +0000] "GET /index.php/Main_Page HTTP/1.1" 200 7227 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
3 213.172.52.202 - - [16/Jan/2011:03:31:21 +0000] "GET /index.php/Talk:Main_Page HTTP/1.1" 200 7021 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
4 184.73.196.53 - - [16/Jan/2011:03:31:55 +0000] "GET /index.php?title=Main_Page&action=history HTTP/1.1" 200 47329 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
5 184.73.196.53 - - [16/Jan/2011:03:32:00 +0000] "GET /index.php?title=Special:Userlogin&returnto=Main_Page HTTP/1.1" 200 7102 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
6 184.73.196.53 - - [16/Jan/2011:03:32:04 +0000] "GET /index.php/LinuXML:Community_Portal HTTP/1.1" 200 6976 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
7 184.73.196.53 - - [16/Jan/2011:03:32:10 +0000] "GET /index.php/Current_events HTTP/1.1" 200 6832 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
8 184.73.196.53 - - [16/Jan/2011:03:32:19 +0000] "GET /index.php/Special:Recentchanges HTTP/1.1" 200 9548 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
9 134.130.184.19 - - [16/Jan/2011:03:32:54 +0000] "GET /index.php/Special:Random HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
10 134.130.184.19 - - [16/Jan/2011:03:32:54 +0000] "GET /index.php/Example_formats HTTP/1.1" 200 8634 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
11 134.130.184.19 - - [16/Jan/2011:03:32:55 +0000] "GET /index.php/Help:Contents HTTP/1.1" 200 6810 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
12 134.130.184.19 - - [16/Jan/2011:03:32:55 +0000] "GET /index.php/LinuXML:Site_support HTTP/1.1" 200 6919 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
13 134.130.184.19 - - [16/Jan/2011:03:32:55 +0000] "GET /index.php?title=Special:Whatlinkshere&target=Main_Page HTTP/1.1" 200 6092 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
14 134.130.184.19 - - [16/Jan/2011:03:32:55 +0000] "GET /index.php?title=Special:Recentchangeslinked&target=Main_Page HTTP/1.1" 200 7856 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
15 134.130.184.19 - - [16/Jan/2011:03:32:56 +0000] "GET /index.php/Special:Specialpages HTTP/1.1" 200 10488 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
16 134.130.184.19 - - [16/Jan/2011:03:32:56 +0000] "GET /index.php/LinuXML:Privacy_policy HTTP/1.1" 200 6949 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
17 134.130.184.19 - - [16/Jan/2011:03:32:56 +0000] "GET /index.php/LinuXML:About HTTP/1.1" 200 6814 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
18 134.130.184.19 - - [16/Jan/2011:03:32:56 +0000] "GET /index.php/LinuXML:General_disclaimer HTTP/1.1" 200 7009 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
Nach der Sperrung einer IP-Adresse kam es zu einer Verzoegerung von etwas
ueber 30 Sekunden, danach kam die fuer einen Request-Block chakteristische
naechste Anfrage von einer anderen IP-Adresse.
Das bedeutet, dass das Botnet hinter diesem Szenario rueckmeldet und nachsteuert.
...
==== Gegenmassnahmen ====
Als Custom-Log wurde ein PIPE-Log fuer die Website eingerichtet.
Das Programm erkennt die typischen URIs und setzt eine Nullroute
auf die entsprechende Quell-IP.
''2011-01-26''
Die Anzahl der Hits ist wieder angestiegen.
* Die komplette Wiki-Instanz in ein Unterverzeichnis geschoben
* Redirect / auf das Unterverzeichnis
* Die Bot-Requests laufen ins Leere (404)
* Damit ist fuer's Erste mal Schluss:
1 180.191.97.240 - - [26/Jan/2011:11:14:29 +0000] "GET /index.php?title=Main_Page&action=edit HTTP/1.1" 404 306 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
2 178.152.190.84 - - [26/Jan/2011:11:14:31 +0000] "GET /index.php?title=Main_Page&action=edit HTTP/1.1" 404 306 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
==== Extrapolation ====
Es bedarf eines Systems, dass
* die typische Einstiegs-URI erkennt und die Quell-IP-Adresse umgehend sperrt.
* beim Auftreten der im Request-Block folgenden URI von einer IP-Adresse, die bisher nicht bekannt war, ist auch diese sofort zu sperren. Die Einschraenkung "bisher nicht bekannt" soll verhindern, dass legitime Nutzer behindert werden.
* Die Abfolge der angefragten URLs wird sich sicher in Kuerze aendern. Wahrscheinlich
sind dann Ueberlegungen zur Ablauferkennung und zur Distribution der Ablaeufe unausweichlich.