]> git.mxchange.org Git - ctracker.git/blobdiff - libs/lib_detector.php
Experimental commit:
[ctracker.git] / libs / lib_detector.php
index 095a8ba4846b3e692f1a07364626e10ae5e95826..3fa9b4da9ea0fb83545fba330c6698fd5d655520 100644 (file)
@@ -35,15 +35,16 @@ function initCrackerTrackerArrays () {
 
        // Whitelist some absolute query strings (see below)
        $GLOBALS['ctracker_whitelist'] = array(
-               'cmd=new',   // LinPHA
-               'cmd=edit',  // LinPHA
-               'cmd=lostpw' // LinPHA
+               'cmd=new',          // LinPHA
+               'cmd=edit',         // LinPHA
+               'cmd=lostpw',       // LinPHA
+               'secure_session=1', // Mantis Bug Tracker
        );
 
        // Attacks we should detect and block
        $GLOBALS['ctracker_get_blacklist'] = array(
                'chr(', 'chr=', 'chr%20', '%20chr', 'wget%20', '%20wget', 'wget(',
-               'cmd=', '%20cmd', 'cmd%20', 'rush=', '%20rush', 'rush%20',
+               'cmd.exe', '%20cmd', 'cmd%20', 'rush=', '%20rush', 'rush%20',
                'union%20', '%20union', 'union(', 'union=', 'echr(', '%20echr', 'echr%20', 'echr=',
                'esystem(', 'esystem%20', 'cp%20', '%20cp', 'cp(', 'mdir%20', '%20mdir', 'mdir(',
                'mcd%20', 'mrd%20', 'rm%20', '%20mcd', '%20mrd', '%20rm',
@@ -53,31 +54,33 @@ function initCrackerTrackerArrays () {
                'passwd%20', '%20passwd', 'passwd(', 'telnet%20', 'vi(', 'vi%20', 'cgi-', '.eml',
                'insert%20into', 'select%20', 'nigga(', '%20nigga', 'nigga%20', 'fopen', 'fwrite', '%20like', 'like%20',
                '$_request', '$_get', '$request', '$get', '.system', 'HTTP_PHP', '&aim', '%20getenv', 'getenv%20',
-               'new_password', '&icq','/etc/passwd','/etc/shadow', '/etc/groups', '/etc/gshadow',
+               'new_password', '&icq', '/self/', '/environ', '/shadow', '/gshadow', '/etc/', '/passwd',
                'HTTP_USER_AGENT', 'HTTP_HOST', 'wget%20', 'uname\x20-', 'uname%20-', 'bin/id', '/bin/', '/chgrp',
                '/chown', '/usr/bin', 'g\+\+', 'bin/python', 'bin/tclsh', 'bin/nasm', 'perl%20', 'traceroute%20',
-               'ping%20', '.pl', 'bin/xterm', 'lsof%20', '.conf', 'motd%20', 'HTTP/1.', '.inc.php', '.lib.php',
-               'config.php', 'file\://', 'window.open', '<SCRIPT>', 'javascript\://', 'img src', 'img%20src', '.jsp',
+               'ping%20', 'bin/xterm', 'lsof%20', '.conf', 'motd%20', 'HTTP/1.', '.inc.php', '.lib.php', '.class.php',
+               'config.php', 'file\://', 'window.open', 'javascript\://', 'img src', 'img%20src', '.jsp',
                'ftp.exe', 'xp_enumdsn', 'xp_availablemedia', 'xp_filelist', 'xp_cmdshell', 'nc.exe', '.htpasswd',
                'servlet', '/etc/passwd', 'wwwacl', '~root', '~ftp', '.js', '.jsp', '.history', 'bash_history',
                '.bash_history', '~nobody', 'server-info', 'server-status', 'reboot%20', 'halt%20',
                'powerdown%20', '/home/ftp', '/home/www', 'secure_site, ok', 'chunked', 'org.apache', '/servlet/con',
                '<script', '/robot.txt' ,'/perl' ,'mod_gzip_status', 'db_mysql.inc', '.inc', 'select%20from',
                'select from', 'drop%20', '.system', 'getenv', 'http_', '_php', 'php_', 'phpinfo()', '\<?php', '?\>', 'sql=',
-               'div style=', 'overflow: auto', 'height: 1px', 'cc%20', 'admin_action=', 'path=', 'action=http',
-               'page=http', 'module=http', 'op=http', 'id=http', 'id%3Dhttp', 'action%3Dhttp', 'page%3Dhttp',
-               'module%3Dhttp', 'op%3Dhttp', 'starhack', '../../','..//', 'directory=http', 'dir=http', 'busca',
-               'uol.com', '=http://', '=https://','=ftp://','=file://','_SESSION','CFG_ROOT','/proc/',',0x5',
-               '=%7BQUOT%7D', '=%5C'
+               'div style=', 'overflow: auto', 'height: 1px', 'cc%20', 'admin_action=', 'path=', 'starhack', 'busca',
+               // @TODO These two lines may block DokuWiki searches for e.g. http_request2_response
+               'action=http', 'page=http', 'module=http', 'op=http', 'id=http',
+               'action%3Dhttp', 'page%3Dhttp', 'module%3Dhttp', 'op%3Dhttp', 'id%3Dhttp', '/groups',
+               '../../','..//', 'directory=http', 'dir=http',
+               'uol.com', '=http://', '=https://','=ftp://','=file://','_SESSION','CFG_ROOT','/proc/', ',0x', '(0x',
+               '=%7BQUOT%7D', '=%5C', 'DOCUMENT_ROOT', '_SERVER','=%22http','=%22ftp','=%22file','=%27http','=%27ftp',
+               '=%27file'
        );
 
        // Block these words found in POST requests
        $GLOBALS['ctracker_post_blacklist'] = array(
                // This line is for detecting hidden link spam in wikis, forums, guestbooks, etc.
-               'div style=', 'overflow:auto', 'height:1px', 'width:1px', 'display:hidden',
-               // "Common" login name from VHCS exploiters ;-)
-               'starhack', 'DeLiMehmet', 'hisset', 'Hisset', 'delimert', 'MecTruy',
-               'busca'
+               'div style=', 'overflow:auto', 'height:1px', 'width:1px', 'display:hidden', 'style.display',
+               // "Common" login names from VHCS exploiters ;-)
+               'starhack', 'DeLiMehmet', 'hisset', 'Hisset', 'delimert', 'MecTruy'
        );
 
        // Load email header
@@ -92,7 +95,7 @@ function initCrackerTrackerArrays () {
 // Checks for worms
 function isCrackerTrackerWormDetected () {
        // Check against the whole list
-       $GLOBALS['ctracker_checkworm'] = str_replace($GLOBALS['ctracker_get_blacklist'], '*', crackerTrackerQueryString());
+       $GLOBALS['ctracker_checkworm'] = str_ireplace($GLOBALS['ctracker_get_blacklist'], '*', urldecode(crackerTrackerQueryString()));
 
        // If it differs to original and the *whole* request string is not in whitelist
        // then blog the attempt
@@ -105,7 +108,7 @@ function isCrackerTrackerPostAttackDetected () {
        $GLOBALS['ctracker_post_track'] = implode_r('', $_POST);
 
        // Check for suspicious POST data
-       $GLOBALS['ctracker_check_post'] = str_replace($GLOBALS['ctracker_post_blacklist'], '*', $GLOBALS['ctracker_post_track']);
+       $GLOBALS['ctracker_check_post'] = str_ireplace($GLOBALS['ctracker_post_blacklist'], '*', $GLOBALS['ctracker_post_track']);
 
        // Is it detected?
        return ((isCrackerTrackerWormDetected()) || ($GLOBALS['ctracker_check_post'] != $GLOBALS['ctracker_post_track']));
@@ -148,7 +151,7 @@ function sendCrackerTrackerTicketMails () {
        $mail = crackerTrackerLoadEmailTemplate('webmaster_add_ticket', $GLOBALS['ctracker_last_ticket'], getCrackerTrackerConfig('ctracker_language'));
 
        // Send email to the user
-       crackerTrackerSendMail($mail, null, getCrackerTrackerLocalized('webmaster_add_ticket_subject'));
+       crackerTrackerSendMail($mail, NULL, getCrackerTrackerLocalized('webmaster_add_ticket_subject'));
 }
 
 // Sends a mail out