Black List Plugin

Utility to keep malicious users away from a public TWiki site

Description

This is a simple utility to keep black sheep away from a public TWiki site. The site can be protected against excessive page access (e.g. by bad robots), suspicious activities of users, such as multiple registrations or rapid topic updates indicating Wiki:WikiSpam, or saving text with wiki-spam.

The Plugin monitors activities by IP address and uses three IP address lists to protect the TWiki site:

  • WHITELIST: Manually maintained list of users who should never get on the BANLIST
  • BLACKLIST: Manually maintained list of malicious users
  • BANLIST: Automatically updated list of users with suspicious activities

On topic save, text is compared to a known list of spam patterns. If wiki-spam is identified, topic save is cancelled, an error message is shown, and the IP address is put on the BANLIST. Two wiki-spam lists are used:

  • Local SPAMLIST: Manually maintained list of spam patterns
  • Public wiki-spam list: Big list of wiki-spam patterns, retrieved from external web site

Users on the BLACKLIST and BANLIST will get an error message on every page access.

The registration form can also be protected from improper use.

To fight Wiki-spam, the Plugin can also add a rel="nofollow" parameter to external URLs. Search engines will not follow links that have this parameter, taking away the incentive to add spam to TWiki.

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

General settings

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Utility to keep malicious users away from a public TWiki site

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • Log access of blacklist and spam list activities: (0 or 1)
    • Set LOGACCESS = 1

WHITELIST, BLACKLIST and BANLIST settings

  • WHITELIST: Comma delimited list of IP addresses; possible to use partial addresses ending in a dot
    • Set WHITELIST = 127.0.0.1

  • BLACKLIST: Comma delimited list of IP addresses; possible to use partial addresses ending in a dot
    • Set BLACKLIST = 203.88.152., 203.88.155., 219.65.75.

  • BANLIST: Automatically updated list of IP addresses based on BANLIST configuration
    • Action: IP address(es)
    • Current list: 95.91.111.111, 135.181.212.177, 135.181.180.59, 95.216.45.152, 65.108.142.143, 188.165.237.120, 65.108.128.54, 65.109.67.81, 65.108.232.38, 167.114.211.237, 185.234.69.215, 216.244.66.250, 65.108.46.72, 65.108.231.158, 65.108.100.146, 135.181.79.106, 65.21.232.254, 51.77.108.244, 65.108.41.34, 5.9.70.221, 65.108.78.33, 149.202.86.61, 174.250.36.3, 95.91.15.26, 66.249.72.15, 65.109.67.80, 218.188.41.122, 195.191.219.132, 107.174.228.109, 65.108.0.71, 167.114.116.38, 65.109.26.42, 5.189.152.91, 45.132.227.196, 65.109.63.253, 135.181.115.29, 192.95.30.12, 65.109.26.29, 65.109.63.254, 65.109.26.43, 149.202.82.11, 65.109.26.102, 92.220.10.100, 135.181.75.58, 192.99.36.181, 65.108.125.120, 167.114.157.181, 91.219.254.101, 167.114.103.160, 167.114.209.104, 65.109.67.82, 192.99.14.19, 192.99.15.199, 65.108.142.49, 192.151.157.210, 94.154.239.69, 65.108.206.155, 192.99.37.133, 173.249.2.13, 65.108.203.159, 188.165.232.135, 65.109.63.252, 94.23.209.55, 65.108.124.153, 192.99.9.92, 192.99.15.17, 95.91.76.32, 192.95.30.21, 164.68.96.117, 192.99.36.126, 192.99.7.188, 23.234.242.150, 167.114.173.115, 65.108.203.133, 37.187.73.123, 178.150.14.250, 161.97.92.73, 94.23.203.52, 195.191.219.131, 192.95.30.71, 95.217.195.123, 65.108.231.155, 195.191.219.130, 94.23.7.188, 192.99.7.70, 45.227.254.17, 161.97.91.204, 173.212.220.70, 135.181.73.59, 135.181.74.243, 192.95.30.177, 94.23.203.86, 167.114.116.25, 37.187.89.104, 202.61.253.63, 188.165.212.137, 185.214.10.153, 192.99.13.69, 167.114.159.99, 65.108.40.25, 94.23.203.180, 192.95.29.138, 192.99.37.124, 209.209.11.236, 135.181.128.56, 62.171.159.200, 192.99.37.132, 192.99.36.61, 192.99.160.200, 194.163.191.72, 38.242.254.25, 178.151.245.174, 65.109.24.4, 167.114.158.215, 192.99.15.34, 181.229.248.213, 52.237.172.216, 192.99.3.137, 192.99.35.94, 195.201.199.99, 91.219.254.102, 37.187.94.3, 37.57.218.243, 192.99.14.159, 157.90.209.77, 65.21.233.213, 188.165.217.198, 84.46.255.143, 216.244.66.199, 167.114.100.201, 188.165.225.40, 167.114.159.183, 188.165.241.181, 31.25.10.176, 94.23.203.107, 134.195.89.70, 135.181.140.38, 213.136.92.122, 144.91.73.85, 84.46.255.139, 216.240.128.213, 78.128.112.86, 84.46.245.24, 188.165.215.206, 65.108.227.178, 173.212.220.26, 65.21.206.24, 173.208.130.202, 134.101.207.169, 45.227.253.6, 95.91.75.134, 37.187.139.222, 192.99.101.79, 130.185.119.78, 95.91.75.104, 23.94.204.139, 94.23.207.193, 173.212.247.190, 157.90.181.145, 162.55.86.59, 185.181.63.72, 81.17.57.144, 173.212.246.91, 185.216.203.239, 94.23.203.202, 62.138.2.243, 194.165.17.17, 173.249.24.3, 5.189.172.182, 173.212.246.178, 192.99.15.185, 91.137.17.190, 161.97.136.234, 42.200.228.33, 62.171.162.127, 192.99.37.116, 69.197.140.197, 167.114.101.80, 95.91.74.216, 167.114.101.65, 52.188.83.128, 51.83.224.227, 37.187.140.83, 185.234.69.220, 194.165.16.5, 195.191.219.133, 173.249.30.147, 94.23.7.187, 217.76.60.59, 81.109.65.244, 107.173.63.235, 77.88.5.207, 91.191.209.2, 144.91.125.96, 95.111.247.252, 5.255.253.170, 91.219.254.100, 81.170.128.52, 192.99.15.33, 185.245.61.198, 204.12.197.234, 23.94.0.89, 78.128.112.118, 69.197.140.63, 65.21.35.235, 185.198.27.181, 95.108.213.16, 5.45.207.129, 94.46.187.223, 167.172.102.155, 173.208.206.50, 5.255.231.104, 67.58.250.232, 5.45.207.148, 93.158.161.46, 87.250.224.153, 5.255.253.168, 95.108.213.35, 95.108.213.24, 87.250.224.26, 95.91.110.174, 5.45.207.143, 141.98.9.23, 5.255.253.112, 5.255.253.117, 5.255.231.120, 87.250.224.6, 130.185.118.200, 144.91.91.164, 65.21.197.13, 5.9.158.195, 65.108.103.109, 5.45.207.144, 5.45.207.142, 95.91.75.79, 147.78.47.33, 192.99.37.138, 75.119.141.84, 192.99.15.29, 95.91.15.58, 38.242.151.181, 93.131.53.93, 161.97.149.89, 178.18.251.169, 161.97.145.53, 5.45.207.154, 2.243.35.143, 95.91.15.41, 161.97.135.248, 51.158.107.242, 134.209.187.147, 154.26.131.103, 87.250.224.47, 5.255.253.160, 207.180.221.167, 95.91.74.236, 5.181.86.99, 198.52.103.56, 84.46.245.20, 45.8.22.134, 198.144.190.209, 185.234.69.198, 43.153.64.123, 157.90.209.83, 216.240.128.215, 107.174.235.110, 207.180.245.134, 5.189.161.234, 213.136.75.74, 173.249.63.71, 38.242.155.167, 15.152.217.214, 135.181.136.229, 43.153.100.114, 199.47.82.20, 5.189.128.37, 174.232.238.7, 199.47.82.21, 91.240.118.252, 38.242.151.34, 158.69.123.143, 95.91.85.50, 95.91.76.46, 192.95.29.186, 5.253.19.58, 135.181.177.220, 164.132.201.179, 149.202.87.182, 144.91.119.44, 198.46.190.109, 164.132.203.193, 149.202.87.175, 158.69.23.160, 5.189.141.104, 149.202.87.178, 89.221.220.191, 5.45.207.91, 5.255.253.142, 158.69.22.90, 75.119.142.113, 149.202.87.139, 107.174.115.138, 149.202.87.37, 158.69.22.93, 149.202.87.160, 164.132.201.57, 164.132.201.7, 95.91.76.164, 207.180.220.114, 149.202.86.231, 202.61.204.174, 104.230.109.112, 93.158.161.50, 77.88.5.133, 93.197.162.240, 149.202.87.137, 65.108.99.43, 181.215.182.130, 212.102.49.23, 191.101.217.19, 94.156.14.23, 37.120.221.87, 212.102.36.27, 208.78.42.19, 196.196.53.138, 158.69.22.87, 158.69.22.94, 176.9.146.74, 37.187.27.125, 24.3.238.212, 51.79.93.156, 181.41.206.181, 92.205.64.63, 164.132.201.51, 71.13.87.122, 149.202.87.164, 164.132.201.165, 91.219.254.103, 167.114.101.143, 149.202.87.176, 149.202.87.166, 164.132.201.56, 167.86.71.242, 149.202.87.169, 161.97.145.38, 158.69.22.96, 51.83.35.127, 217.76.60.62, 37.187.73.121, 173.212.245.225, 149.202.87.168, 193.70.80.150, 38.242.147.182, 161.97.145.103, 66.249.73.215, 23.229.125.93, 95.91.110.109, 95.91.41.198, 135.181.136.240, 95.91.81.28, 51.83.34.183, 42.200.188.167, 65.108.99.48, 194.13.80.41, 144.202.123.60, 69.197.140.196, 194.50.243.156, 194.247.173.99, 51.91.253.126, 217.182.134.101, 217.182.175.163, 54.38.85.37, 217.182.175.38, 51.83.34.90, 217.182.134.134, 207.180.218.247, 188.165.211.159, 51.38.181.206, 217.182.175.146, 217.182.175.125, 217.182.134.106, 217.182.175.222, 217.182.175.187, 167.114.64.97, 217.182.175.120, 95.91.81.7, 84.46.245.21, 54.38.85.17, 52.167.144.103, 40.77.167.92, 185.217.125.68, 157.90.182.29, 38.15.148.36, 54.38.85.38, 54.38.85.36, 94.103.87.20, 20.172.243.96, 181.14.132.12, 54.38.85.21, 82.146.44.21, 193.70.81.99, 193.70.81.110, 149.202.65.183, 193.70.81.106, 188.126.94.182, 95.91.76.57, 149.202.86.86, 193.70.81.116, 65.108.103.105, 216.146.107.190, 149.202.65.189, 42.200.166.82, 135.181.137.110, 193.70.81.126, 149.202.86.139, 66.249.75.154, 149.202.86.190, 176.38.0.194, 193.70.81.103, 185.162.250.169, 38.242.210.185, 76.28.18.198, 51.161.80.5, 18.212.58.215, 95.91.41.36, 146.52.202.188, 65.108.99.111, 38.242.214.79, 34.134.8.53, 104.238.141.198, 217.76.60.60, 181.87.184.207, 194.187.169.39, 66.249.72.238, 65.108.99.189, 135.181.140.186, 51.77.14.132, 178.25.242.110, 149.202.86.56, 185.182.186.201, 5.104.81.62, 95.91.111.16, 38.242.197.173, 217.76.60.63, 178.25.244.57, 23.229.59.210, 66.249.64.206, 66.249.64.192, 162.19.101.44, 162.19.101.251, 116.240.149.7, 161.97.145.107, 154.26.130.139, 95.91.42.194, 66.249.79.9, 66.249.65.133, 91.137.17.143, 84.46.255.141, 65.21.35.182, 185.73.240.251, 51.83.225.251, 158.69.113.146, 38.242.249.151, 95.91.109.50, 178.132.110.93, 154.16.192.172, 194.87.149.225, 135.181.138.6, 178.25.242.92, 38.242.238.223, 154.6.12.51, 84.46.245.22, 88.134.13.220, 216.240.128.214, 216.240.150.83, 181.87.176.22, 66.249.77.200, 93.197.174.40, 136.243.212.110, 52.25.208.208, 193.142.201.48, 95.91.59.92, 64.62.202.84, 64.62.202.82, 185.109.168.20, 95.91.16.136, 135.181.138.9, 65.21.35.200, 51.174.65.41, 50.112.160.3, 44.230.252.91, 100.21.24.205, 44.231.202.44, 54.184.159.16, 178.25.242.225, 178.25.244.164, 104.28.211.187, 104.28.243.186, 95.91.110.27, 95.91.111.87, 3.88.43.75, 87.76.238.87, 65.21.136.197, 185.216.178.59, 47.242.224.53, 167.172.187.15, 135.181.137.100, 158.220.124.25, 135.181.140.173, 162.55.85.229, 52.230.152.13, 52.230.152.30, 52.230.152.61, 52.230.152.199, 52.230.152.250, 52.230.152.237, 52.230.152.20, 52.230.152.109, 52.230.152.18, 52.230.152.59, 52.230.152.100, 52.230.152.245, 34.242.15.128, 34.220.88.70, 185.215.165.249, 35.162.180.13, 54.218.254.11, 62.113.117.240, 35.91.39.172, 54.202.131.245, 54.191.236.97, 194.163.146.128, 157.90.182.30, 54.245.31.177, 54.244.169.15, 31.220.87.207, 172.245.111.253, 185.202.238.84, 95.91.42.78, 135.181.138.3, 65.21.177.74, 91.137.27.194, 178.25.242.198, 95.91.109.194, 65.21.35.190, 45.45.218.161, 167.172.187.173, 193.183.0.162, 66.249.77.196, 66.249.72.137, 178.18.252.24, 47.76.35.19, 34.42.98.183, 52.70.240.171, 3.224.220.101, 23.22.35.162, 161.97.145.138, 185.209.228.229, 194.242.57.234, 94.130.219.240, 45.13.226.95, 84.46.255.144, 65.21.91.185, 158.220.111.42, 51.75.168.198, 185.252.234.221, 185.188.249.246, 178.18.250.246, 154.38.173.98, 31.220.87.210, 38.242.198.168, 35.180.250.254, 158.220.111.44, 158.220.123.226, 65.21.35.234, 95.91.111.25, 158.220.123.224, 194.163.186.24, 158.220.111.43, 217.76.48.3, 91.229.76.186

  • BANLIST configuration, comma delimited list of:
    1. Points for registration
    2. Points for each save and upload
    3. Points for view and other actions
    4. Points for view raw
    5. Threshold to add to BANLIST
    6. Measured over time (in seconds)
    • Set BANLISTCONFIG = 10, 5, 1, 5, 120, 300
    • Your current score: 1 for IP address 54.84.65.73

  • Message for users on BLACKLIST and BANLIST:
    • Set BLACKLISTMESSAGE = Your IP address 54.84.65.73 is black listed at the TWiki web site due to excessive access or suspicious activities. Please contact site administrator fst@openfst.org if you got on the list by mistake.

Wiki-spam filtering settings

  • Filter wiki-spam on topic save and HTML file uploads based on SPAMLIST: (0 or 1)
    • Set FILTERWIKISPAM = 1

  • Comma separated list of Web.Topics to exclude from wiki-spam filtering on topic save:
    • Set SPAMEXCLUDETOPICS =

  • Local SPAMLIST: Manually maintained list of spam patterns (NOTE: Must be RegularExpression patterns)
    • Action: wiki-spam regex pattern(s) http://.*?
    • Current list:

  • EXCLUDELIST: Manually maintained list of exceptions to public wiki-spam patterns, useful to exclude patterns listed incorrectly as spam (NOTE: Must be RegularExpression patterns)
    • Action: exclude spam regex pattern(s) http://.*?
    • Current list:

  • Cache refresh time (in minutes) for public wiki-merge pattern list:
    • Set SPAMLISTREFRESH = 60

  • Cache refresh time (in minutes) for internal wiki-spam regular expression cache:
    • Set SPAMREGEXREFRESH = 10

  • Message for users trying to save text with wiki-spam:
    • Set WIKISPAMMESSAGE = Wiki-spam detected: "%WIKISPAMWORD%" is a banned word and cannot be saved. Your IP address 54.84.65.73 is black listed at the TWiki web site due to suspicious activities. Please contact site administrator fst@openfst.org if you got on the list by mistake.

Registration protection settings

  • Protect registration: (number of minutes to expire, 15 minutes is recommended, 0 to disable)
    • Set REGEXPIRE = 15
    • If enabled, a magic number is protecting the registration process. TWiki expects a form field with a magic number. An error message is shown if not valid or if expired. This makes it harder to register a user by a script. A hidden field needs to be added to the registration form:
      <input type="hidden" name="rx" value="%BLACKLISTPLUGIN{ action="magic" }%" />

  • Regular expression list of WikiWords that are banned from registering:
    • Set REGWIKINAMEBANLIST = [A-Z]+[a-z]*[0-9]+[A-Z][A-Za-z]*, [A-Z]+[a-z0-9]+[A-Z]+[A-Za-z]*[0-9]+

  • Regular expression list of e-mails that are banned from registering:
    • Set REGEMAILBANLIST = \@binkmail.com, \@guerrillamail\.(biz|com), \@hidemyass\.com, \@mailinator\.com, \@safetymail.info, \@snkmail.com, \@[\w\.-]*trash[\w\.-]*\.

  • Message shown when registering with outdated magic number or with banned content: (this message is deliberately vague)
    • Set REGMESSAGE = Registration not possible, please try again.

Nofollow link setting

  • Add a rel="nofollow" parameter to external URLs. Use this is to fight Wiki-spam. Search engines will not follow the link if a URL has a nofollow parameter, such as <a href="http://spammer.com/" rel="nofollow">. Specify topic age in hours for which the nofollow parameter should appear (set it to a value that gives you enough time to remove spam); set it to -1 to add the nofollow parameter unconditionally to external URLs; or 0 to disable: (-1, 0, 1...N)
    • Set NOFOLLOWAGE = -1

Don't Invite Spammers

  • Spammers search for sites with known spam signatures. Don't use this page as an invitation for spammers by telling search engines NOT to index this page:
    • Set HTTP_EQUIV_ON_VIEW =

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip BlackListPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/BlackListPlugin.txt Plugin topic
    data/TWiki/BlackListPlugin.txt,v Plugin topic repository
    lib/TWiki/Plugins/BlackListPlugin.pm Plugin Perl module
    pub/TWiki/BlackListPlugin/.htaccess Apache access control to protect pub dir
    templates/oopsblacklist.tmpl Generic oops message
  • Make sure pub/TWiki/BlackListPlugin/ is writable by the CGI user (typically nobody)
  • Run the configure utility in your browser to enable the Plugin
  • Make sure that non-administrators cannot edit this plugin topic. By default, this topic is write protected with an ALLOWTOPICCHANGE = TWikiAdminGroup setting.
  • Test if the installation was successful:
    1. Using above form, add the IP address of one of your workstations to the BANLIST
    2. Access TWiki from that workstation
      • if you look at a TWiki topic (with the view script) you should see the BLACKLISTMESSAGE (defined above) after a one minute timeout
      • else, you should get an 500 Internal Server Error for other scripts
    3. On a different workstation, remove the IP address of the test workstation from the BANLIST

Known Issues and Limitations

  • Scan for script eval() and escape() is currently hard-coded

Plugin Info

Plugin Author: TWiki:Main.PeterThoeny
Copyright: © 2004-2013 Peter Thoeny, TWiki.org
© 2008-2013 TWiki:TWiki.TWikiContributor
Plugin Version: 2013-03-22
Change History:  
2013-03-22: TWikibug:Item7151: Add new throwaway e-mail addresses
2013-03-08: TWikibug:Item7151: Add new throwaway e-mail addresses
2013-02-28: TWikibug:Item7154: Add REGWIKINAMEBANLIST and REGEMAILBANLIST to protect TWiki from bogus registrations; remove 60 min sleep time on ban
2013-02-17: TWikibug:Item7154: Use noindex meta tag on this plugin page because we do not want to invite spammers who search for known spam signatures
2011-07-10: TWikibug:Item6725: Change global package variables from "use vars" to "our"
2010-07-10: TWikibug:Item6519 - fix for empty oops messages in TWiki-4.x; fix for redirect to oops not working in TWiki-5.0
29 Mar 2007: Doc fixes; change view=raw penalty from 20 to 5
18 Mar 2007: Scan for evil script eval() and escape() in topic text and attachments; support for TWiki 4.2 (using new TWiki::Func::getExternalResource)
28 Dec 2006: Fixed bug where EXCLUDELIST pattern was removing only part of a wiki-spam pattern
27 Dec 2006: Support for TWiki 4.1
01 Jul 2006: Added EXCLUDELIST; scan for evil script eval in attachments; scan also .js and .css attachments; fixed writeLog error on Cairo
02 Jun 2006: Added wiki-spam filtering for HTML attachments to combat TWiki:Codev.HtmlAttachmentSpam
29 Apr 2006: Added %BLACKLISTPLUGIN{ action="spam_show_n" }% that shows the local spam list in a shareable format with newline separator
07 Feb 2006: TWiki Release 4.0 fix to allow registration with e-mail verification, reset password and approve
03 Jan 2006: Filter lines with space from spam list; fixed bug that inproperly filtered HTML from spam list; Dakar Release fix (end/postRenderingHandler issue)
08 Nov 2005: Doc fixes; code warning fixes; allow empty local SPAMLIST and public spam list
04 Nov 2005: Added registration protection with magic number
30 Oct 2005: Dakar Release compatibility: Work around Dakar preferencs bug
29 Oct 2005: Added wiki-spam filtering to prevent topic save with wiki-spam
27 Oct 2005: For BANLIST, add/remove multiple IP addresses at once, contributed by TWiki:Main.MichaelDaum
22 Jan 2005: Added NOFOLLOWAGE handling
19 Jan 2005: Added score for "view raw" to address e-mail harvester issue
05 Apr 2004: Fixed bug in event log (requiring update of earlier Plugin versions); doc updates
04 Apr 2004: Added WHITELIST and BANLIST
21 Mar 2004: Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle 99%, FormattedSearch 99%, BlackListPlugin 97%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/BlackListPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/BlackListPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/BlackListPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins, TWiki:Codev.WikiSpam

Topic attachments
I Attachment History Action SizeSorted ascending Date Who Comment
Unknown file formathtaccess .htaccess r1 manage 0.1 K 2013-03-22 - 22:05 TWikiAdminUser Saved by install script
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r5 - 2022-11-12 - MichaelRiley
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.BlackListPlugin.