home *** CD-ROM | disk | FTP | other *** search
/ ftp.f-secure.com / 2014.06.ftp.f-secure.com.tar / ftp.f-secure.com / support / hotfix / fsis / IS-SpamControl.fsfix / iufssc / rules / 20_uri_tests.cf < prev    next >
Text File  |  2006-11-29  |  10KB  |  216 lines

  1. # SpamAssassin rules file: URI tests
  2. #
  3. # Please don't modify this file as your changes will be overwritten with
  4. # the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
  5. # See 'perldoc Mail::SpamAssassin::Conf' for details.
  6. #
  7. # <@LICENSE>
  8. # Copyright 2004 Apache Software Foundation
  9. # Licensed under the Apache License, Version 2.0 (the "License");
  10. # you may not use this file except in compliance with the License.
  11. # You may obtain a copy of the License at
  12. #     http://www.apache.org/licenses/LICENSE-2.0
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. # </@LICENSE>
  19. #
  20. ###########################################################################
  21.  
  22. #require_version @@VERSION@@
  23.  
  24. # Redirector URI patterns
  25. redirector_pattern    /^http:\/\/chkpt\.zdnet\.com\/chkpt\/\w+\/(.*)$/i
  26. redirector_pattern    /^http:\/\/www(?:\d+)?\.nate\.com\/r\/\w+\/(.*)$/i
  27. redirector_pattern    /^http:\/\/.+\.gov\/(?:.*\/)?externalLink\.jhtml\?.*url=(.*?)(?:&.*)?$/i
  28. redirector_pattern    /^http:\/\/redir\.internet\.com\/.+?\/.+?\/(.*)$/i
  29. redirector_pattern    /^http:\/\/(?:.*?\.)?adtech\.de\/.*(?:;|\|)link=(.*?)(?:;|$)/i
  30. redirector_pattern    m'^http.*?/redirect\.php\?.*(?<=[?&])goto=(.*?)(?:$|[&\#])'i
  31. redirector_pattern      m'^https?:/*(?:[^/]+\.)?emf\d\.com/r\.cfm.*?&r=(.*)'i
  32.  
  33. # ExpressionEngine redirector
  34. # see http://www.pmachine.com/forums/viewthread/29561/
  35. # e.g. http://www.someEEBasedSite.com/index.php?URL=http://www.NastyPR0nSite.com
  36. # e.g. http://www.pmachine.com/ee/knowledgeblog/?URL=http://www.google.com
  37. redirector_pattern m'/(?:index.php)?\?.*(?<=[?&])URL=(.*?)(?:$|[&\#])'i
  38.  
  39. # Google redirector.
  40. # Common form:
  41. # http://www.google.com/url?sa=U&start=4&q=http://urlofspammer
  42. #       -> http://urlofspammer
  43. # Unhandled form:
  44. # http://www.google.com/url?q=http://urlofspammer/space&q=here
  45. #       -> http://urlofspammer/space%20here
  46. #       Redirector gets http://urlofspammer/space
  47. # http://www.google.com/url?q=http://urlof&q=spammer does not work
  48. redirector_pattern m'^http:/*(?:\w+\.)?google(?:\.\w{2,3}){1,2}/url\?.*?(?<=[?&])q=(.*?)(?:$|[&\#])'i
  49.  
  50. # Google site search
  51. # http://www.google.com/search?q=site:bluevallet.com
  52. #       -> links to http://www.bluevallet.com/
  53. redirector_pattern m'^http:/*(?:\w+\.)?google(?:\.\w{2,3}){1,2}/search\?.*?(?<=[?&])q=[^&]*?(?<=%20|..[=+\s])site:(.*?)(?:$|%20|[\s+&\#])'i
  54.  
  55. # Google search for pages that contain the site name
  56. # http://www.google.com/search?q="bluevallet.com"
  57. # http://www.google.com/search?q=%22bluevallet.com%22
  58. #       -> links to search page that probably has http://bluevallet.com
  59. #          at the top
  60. redirector_pattern m'^http:/*(?:\w+\.)?google(?:\.\w{2,3}){1,2}/search\?.*?(?<=[?&])q=[^&]*?(?<=%20|..[=+\s])(?:"|%22)(.*?)(?:$|%22|["\s+&\#])'i
  61.  
  62. # Google translate
  63. # http://translate.google.com/translate?u=www.domain.tld&langpair=en%7Cen&hl=en
  64. #       -> http://www.domain.tld inside a frame
  65. redirector_pattern m'^http:/*(?:\w+\.)?google(?:\.\w{2,3}){1,2}/translate\?.*?(?<=[?&])u=(.*?)(?:$|[&\#])'i
  66.  
  67.  
  68. uri NUMERIC_HTTP_ADDR        /^https?\:\/\/\d{7}/is
  69. describe NUMERIC_HTTP_ADDR    Uses a numeric IP address in URL
  70.  
  71. uri NORMAL_HTTP_TO_IP        m{^https?://\d+\.\d+\.\d+\.\d+}i
  72. describe NORMAL_HTTP_TO_IP    Uses a dotted-decimal IP address in URL
  73.      
  74. # Theo sez:
  75. # Have gotten FPs off this, and whitespace can't be in the host, so...
  76. # %    Visit my homepage: http://i.like.foo.com %
  77. uri HTTP_ESCAPED_HOST        /^https?\:\/\/[^\/\s]*%[0-9a-fA-F][0-9a-fA-F]/
  78. describe HTTP_ESCAPED_HOST    Uses %-escapes inside a URL's hostname
  79.  
  80. # note: do not match \r or \n
  81. uri HTTP_CTRL_CHARS_HOST    /^https?\:\/\/[^\/\s]*[\x00-\x08\x0b\x0c\x0e-\x1f]/
  82. describe HTTP_CTRL_CHARS_HOST    Uses control sequences inside a URL hostname
  83.  
  84. # look for URI with escaped 0-9, A-Z, or a-z characters (all other safe
  85. # characters have been well-tested, but are sometimes unnecessarily escaped
  86. # in nonspam; requiring "http" or "https" also reduces false positives).
  87. uri HTTP_EXCESSIVE_ESCAPES    /^https?:\/\/\S*%(?:3\d|[46][1-9a-f]|[57][\da])/i
  88. describe HTTP_EXCESSIVE_ESCAPES    Completely unnecessary %-escapes inside a URL
  89.  
  90. # bug 1801
  91. uri IP_LINK_PLUS    m{^https?://\d+\.\d+\.\d+\.\d+.{0,20}(?:cgi|click|ads|id=)}i
  92. describe IP_LINK_PLUS    Dotted-decimal IP address followed by CGI
  93.  
  94. uri REMOVE_PAGE            /^https?:\/\/[^\/]+\/.*?remove/
  95. describe REMOVE_PAGE        URL of page called "remove"
  96.      
  97. uri MAILTO_TO_SPAM_ADDR        /^mailto:[a-z]+\d{2,}\@/is
  98. describe MAILTO_TO_SPAM_ADDR    Includes a link to a likely spammer email
  99.      
  100. uri MAILTO_TO_REMOVE        /^mailto:.*?remove/is
  101. describe MAILTO_TO_REMOVE    Includes a 'remove' email address
  102.  
  103. # allow ports 80 and 443 which are http and https, respectively
  104. # we don't want to hit http://www.cnn.com:USArticle1840@www.liquidshirts.com/
  105. # though, which actually doesn't have a weird port in it.
  106. uri WEIRD_PORT            m{https?://[^/\s]+?:\d+(?<!:80)(?<!:443)(?<!:8080)(?:/|\s|$)}
  107. describe WEIRD_PORT        Uses non-standard port number for HTTP
  108.  
  109. # looks for a (maybe empty) username and (optional) password in an url
  110. uri USERPASS                    m{^https?://[^/\s]*?(?::[^/\s]+?)?\@}
  111. describe USERPASS               URL contains username and (optional) password
  112.  
  113. uri URI_IS_POUND        m{\#$}
  114. describe URI_IS_POUND        Filename is just a '\#'; probably a JS trick
  115.  
  116. uri BARGAIN_URL            /bargain([sz]|-\S+)?\.(?:com|biz)/
  117. describe BARGAIN_URL        Includes a link to a likely spammer domain
  118.  
  119. # these are somewhat loose, but results are good
  120. uri BIZ_TLD              /\.biz(?::\d+)?(?:\/|$)/i
  121. describe BIZ_TLD        Contains an URL in the BIZ top-level domain    
  122.  
  123. uri INFO_TLD              /\.info(?::\d+)?(?:\/|$)/i
  124. describe INFO_TLD        Contains an URL in the INFO top-level domain    
  125.  
  126. # Matt Cline
  127. # Pretty good for most folks, except for jm: I have a really stupid
  128. # e-commerce bunch obfuscating their URLs with this for some reason. screw 'em
  129. # jm: hesitant to remove this outright; it should be good against phishers
  130. #uri      HTTP_ENTITIES_HOST    m{https?://[^\s\">/]*\&\#[\da-f]+}i
  131. #describe HTTP_ENTITIES_HOST    URI obscured with character entities
  132.  
  133. uri YAHOO_RD_REDIR        m{^https?\://rd\.yahoo\.com/(?:[0-9]{4}|partner\b|dir\b)}i
  134. describe YAHOO_RD_REDIR        Has Yahoo Redirect URI
  135.  
  136. uri YAHOO_DRS_REDIR        m{^https?://drs\.yahoo\.com/}i
  137. describe YAHOO_DRS_REDIR    Has Yahoo Redirect URI
  138.  
  139. uri URI_OFFERS            m/offer([sz]|-\S+)?\.(?:com|bi?z)/i
  140. describe URI_OFFERS        Message has link to company offers
  141.  
  142. uri URI_4YOU            m@^(?:https?://|mailto:)[^\/]*4you@i
  143. describe URI_4YOU        Message has URI 4you
  144.  
  145. # 0 nonspam hits, hundreds of spam hits.  Serious problems there
  146. uri TERRA_ES            /terra\.es\//i
  147. describe TERRA_ES        Contains URI to a document hosted at 'terra.es'
  148.  
  149. # "www" hidden as "%77%77%77", "ww%77", etc.
  150. # note: *not* anchored to start of string, to catch use of redirectors
  151. uri HTTP_77            /http:\/\/.{0,2}\%77/
  152. describe HTTP_77        Contains an URL-encoded hostname (HTTP77)
  153.  
  154. # affiliateid, aff_id, aff_sub_id etc.
  155. uri URI_AFFILIATE        /aff\w+id=/i
  156. describe URI_AFFILIATE        Contains a URI with an affiliate ID code
  157.  
  158. # really a URI rule
  159. header URI_REDIRECTOR        eval:check_for_http_redirector()
  160. describe URI_REDIRECTOR        Message has HTTP redirector URI
  161.  
  162. # a.com.b.c
  163. uri SPOOF_COM2OTH    m{^https?://(?:\w+\.)+?com\.(?:\w+\.){2}}i
  164. describe SPOOF_COM2OTH    URI contains ".com" in middle
  165.  
  166. # a.com.b.com
  167. uri SPOOF_COM2COM    m{^https?://(?:\w+\.)+?com\.(?:\w+\.)+?com}i
  168. describe SPOOF_COM2COM     URI contains ".com" in middle and end
  169.  
  170. # a.net.b.com
  171. uri SPOOF_NET2COM    m{^https?://(?:\w+\.)+?(?:net|org)\.(?:\w+\.)+?com}i
  172. describe SPOOF_NET2COM     URI contains ".net" or ".org", then ".com"
  173.  
  174. # CDNs (Akamai (edgesuite), Speedera, and NYUD, so far) do this, so skip them
  175. uri SPOOF_OURI        m{^https?://(?:[a-z0-9_-]+?\.){2,}(?:com|net|org|biz|info|edu|www)(?!\.(?:\w+\.)?(?:edgesuite|nyud|speedera)\.net)(?:\.[a-z0-9_%-]+?){2,}(?:(?::|%3a)\d+)?}i
  176. describe SPOOF_OURI    URI has items in odd places
  177.  
  178. uri URI_DIGITS        m%^https?://[^/?]*\b\d{6,}\b%i
  179. describe URI_DIGITS    URI hostname has long digit sequence
  180.  
  181. uri URI_HEX        m%^https?://[^/?]*\b[0-9a-f]{6,}\b%i
  182. describe URI_HEX    URI hostname has long hexadecimal sequence
  183.  
  184. uri URI_NOVOWEL        m%^https?://[^/?]*[bcdfghjklmnpqrstvwxz]{7}%i
  185. describe URI_NOVOWEL    URI hostname has long non-vowel sequence
  186.  
  187. uri URI_UNSUBSCRIBE        /\b(?:gone|opened|out)\.php/i
  188. describe URI_UNSUBSCRIBE    URI contains suspicious unsubscribe link
  189.  
  190. uri URI_UPPER_LOWER        m{(?i:https?)://([A-Z][a-z]+\.){2,}[A-Za-z\d-]+\.[a-z]{2,4}(?:[?/]|$)}
  191. describe URI_UPPER_LOWER    URI contains capitalized hostname parts ("Abcde")
  192.  
  193. # bug 3896: URIs in various TLDs, other than 3rd level www
  194. uri URI_NO_WWW_INFO_CGI    /^(?:https?:\/\/)?[^\/]+(?<!\/www)\.[^.]{7,}\.info\/(?=\S{15,})\S*\?/i
  195. describe URI_NO_WWW_INFO_CGI    CGI in .info TLD other than third-level "www"
  196.  
  197. uri URI_NO_WWW_BIZ_CGI    /^(?:https?:\/\/)?[^\/]+(?<!\/www)\.[^.]{7,}\.biz\/(?=\S{15,})\S*\?/i
  198. describe URI_NO_WWW_BIZ_CGI    CGI in .biz TLD other than third-level "www"
  199.  
  200. uri URI_NO_WWW_ANY_CGI    /^(?:https?:\/\/)?[^\/]+(?<!\/www)\.[^.]{3,}\.[^.]{3,}\.(?!biz|info)[a-z]{2,4}\/\?\S{14}/i
  201. describe URI_NO_WWW_ANY_CGI    CGI with long hostname other fourth-level "www"
  202.  
  203. uri URI_SCHEME_MIXED_CASE    /^(?![a-z]{3,6}:|[A-Z]{3,6})[A-Za-z]{3,6}:\//
  204. describe URI_SCHEME_MIXED_CASE    URI scheme has mixed uppercase and lowercase
  205.  
  206. # bug 678
  207. uri DOMAIN_4U2            /[\@\.]\S{0,20}(?:[^0-9][42](?:yo)?u|for-*you)(?:[.-]\S{1,20})?\.(?:net|com|org|info)\b/
  208. describe DOMAIN_4U2        Domain name containing a "4u" variant
  209.  
  210. # possible IDN spoofing attack: http://www.shmoo.com/idn/homograph.txt
  211. # not expecting any hits on this (yet)
  212. uri HIGH_CODEPAGE_URI    /^https?:\/\/[^\/]*\&\#(?:\d{4,}|[3456789]\d\d);/i
  213.