Anti-Spam measures for the Wiki. Names are (Suggested/Implemented), or both, if the same person. The source for the current wiki CGI script, and the patch stack, are available here.

Already implemented

Developed but not applied

In progress

Recent spam analysis

I said I'd have a look at the apache logs and see what's going on at the time of the wiki spam attack. With this information we might be able to prepare better defences. I started by grabbing the apache access logs for the hantslug site down to my local machine. Don't fear though I shall not release any information about anyones browsing habbits, I'm only interested in the hacks ma'am, just the hacks.

Next I grabbed a page that was hacked recently, here's a good one - the inter mezzo page will be easy to grep for.[[LinuxHints/InterMezzo]]
The spammer appeared to commit their changes twice, once at 23:17 and again at 23:19.
 Revision 35 . . February 16, 2005 11:19 pm by
 Revision 34 . . February 16, 2005 11:17 pm by
I found the first visit to that page that day. - - [[16/Feb/2005:03:50:08|+0000]] "GET /cgi-bin/[[LinuxHints/SambaAuth]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803" - - [[16/Feb/2005:03:50:12|+0000]] "GET /cgi-bin/[[MailingList/TopPosting]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803" - - [[16/Feb/2005:03:50:16|+0000]] "GET /cgi-bin/[[AboutWiki]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803" - - [[16/Feb/2005:03:50:28|+0000]] "GET /cgi-bin/[[LinuxHints]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803" - - [[16/Feb/2005:03:50:40|+0000]] "GET /cgi-bin/[[LinuxHints/InterMezzo]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803"
Note with interest that netblock is owned by someone in the far east..
Next we look for all other visits from that IP.. Boy oh boy it's hit every page - some many times. - - [[16/Feb/2005:03:50:08|+0000]] "GET /cgi-bin/[[LinuxHints/SambaAuth]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803"
 : snipped 591 lines
 : - - [[16/Feb/2005:04:37:17|+0000]] "GET /cgi-bin/[[LinuxHints/UpdatingGrub]] HTTP/1.0" 200 1137 "-" "libwww-perl/5.803"
Thats about 590 odd hits over a 40 min period which equates to about 15 a minute or one hit every 4 seconds. I don't care how fast [[ThomasAdam]] is at maintaining the wiki, he can't keep up with this puppy!
Ok, move on to look for the next hits because those times don't tie up with the times of the spam. Scout forewards to the next hits on the mezzo page.. - - [[16/Feb/2005:23:17:19|+0000]] "POST /cgi-bin/ HTTP/1.0" 302 162 "-" "libwww-perl/5.803" - - [[16/Feb/2005:23:17:20|+0000]] "GET /cgi-bin/[[LinuxHints/InterMezzo]] HTTP/1.0" 200 14270 "-" "libwww-perl/5.803" - - [[16/Feb/2005:23:17:21|+0000]] "POST /cgi-bin/ HTTP/1.0" 302 195 "-" "libwww-perl/5.803" - - [[16/Feb/2005:23:17:22|+0000]] "GET /cgi-bin/[[MailingList/UnSubscribe]] HTTP/1.0" 200 3088 "-" "libwww-perl/5.803"
Some GETs and POSTs, this is where the hack actually took place. Note the IP address ties up with the RDNS recorded in the recent changes to the page.
After that the next hit to that page were the recovery of it by the crack wiki-fix team.

Here's what we learn.


Some suggestions which may need to be moved to the next section down, but which appear appropriate here because they are directly related to the above research.

 [[RewriteCond]] %{HTTP_USER_AGENT} ^libwww-perl/[0-9] [NC] 

The above was initially written by AlanPope


AntiSpam (last edited 2009-01-04 15:03:50 by 195)