HomeHelpTrac

Changeset 13117


Ignore:
Timestamp:
10/29/09 23:28:44 (3 years ago)
Author:
Alexander Trofimov
Message:

Ticket #1384

Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/banners.php

    r12933 r13117  
    1818* see license.txt file; if not, write to marketing@boonex.com 
    1919***************************************************************************/ 
     20 
     21define('BX_SECURITY_EXCEPTIONS', true); 
     22$aBxSecurityExceptions = array( 
     23    'POST.Text', 
     24    'REQUEST.Text', 
     25); 
    2026 
    2127require_once( '../inc/header.inc.php' ); 
  • trunk/administration/basic_settings.php

    r12257 r13117  
    1818* see license.txt file; if not, write to marketing@boonex.com 
    1919***************************************************************************/ 
     20 
     21define('BX_SECURITY_EXCEPTIONS', true); 
     22$aBxSecurityExceptions = array( 
     23    'POST.content_text', 
     24    'REQUEST.content_text', 
     25); 
    2026 
    2127require_once( '../inc/header.inc.php' ); 
  • trunk/administration/css_file.php

    r11473 r13117  
    1818* see license.txt file; if not, write to marketing@boonex.com 
    1919***************************************************************************/ 
     20 
     21define('BX_SECURITY_EXCEPTIONS', true); 
     22$aBxSecurityExceptions = array( 
     23    'POST.content', 
     24    'REQUEST.content', 
     25); 
    2026 
    2127require_once( '../inc/header.inc.php' ); 
  • trunk/administration/lang_file.php

    r12534 r13117  
    1919***************************************************************************/ 
    2020 
     21define ('BX_SECURITY_EXCEPTIONS', true); 
     22$aBxSecurityExceptions = array (); 
     23for ($i=1; $i<255 ; ++$i) { 
     24    $aBxSecurityExceptions[] = 'POST.string_for_'.$i; 
     25    $aBxSecurityExceptions[] = 'REQUEST.string_for_'.$i; 
     26} 
     27 
    2128require_once( '../inc/header.inc.php' ); 
    2229require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' ); 
  • trunk/administration/notifies.php

    r11762 r13117  
    1818* see license.txt file; if not, write to marketing@boonex.com 
    1919***************************************************************************/ 
     20 
     21define('BX_SECURITY_EXCEPTIONS', true); 
     22$aBxSecurityExceptions = array( 
     23    'POST.body', 
     24    'REQUEST.body', 
     25); 
    2026 
    2127require_once( '../inc/header.inc.php' ); 
  • trunk/administration/pageBuilder.php

    r12554 r13117  
    2020***************************************************************************/ 
    2121 
     22define('BX_SECURITY_EXCEPTIONS', true); 
     23$aBxSecurityExceptions = array( 
     24    'POST.Content', 
     25    'REQUEST.Content', 
     26); 
     27 
    2228require_once( '../inc/header.inc.php' ); 
    2329require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' ); 
  • trunk/inc/classes/BxDolInstaller.php

    r13053 r13117  
    634634    } 
    635635 
    636     function _getLanguageHtmlFields () { 
    637         $aRet = array (); 
    638         $a = $GLOBALS['MySQL']->getAll ("SELECT `ID` FROM `sys_localization_languages`"); 
    639         foreach ($a as $r) { 
    640             $aRet[] = 'POST.string_for_'.$r['ID']; 
    641             $aRet[] = 'REQUEST.string_for_'.$r['ID']; 
    642         } 
    643         return $aRet;         
    644     } 
    645  
    646636    function addHtmlFields ($a) { 
    647         $s = getParam('sys_html_fields'); 
    648         $this->_aConfig['home_uri']; 
     637        $this->_addFields ('html', $a);       
     638    } 
     639 
     640    function removeHtmlFields () {         
     641        $this->_removeFields('html'); 
     642    } 
     643 
     644    function addJsonFields ($a) { 
     645        $this->_addFields ('json', $a);       
     646    } 
     647 
     648    function removeJsonFields () {         
     649        $this->_removeFields('json'); 
     650    } 
     651 
     652    function addExceptionsFields ($a) { 
     653        $this->_addFields ('exceptions', $a);       
     654    } 
     655 
     656    function removeExceptionsFields () {         
     657        $this->_removeFields('exceptions'); 
     658    } 
     659 
     660    //--- Protected methods ---// 
     661     
     662    function _addFields ($sType, $a) { 
     663        switch ($sType) { 
     664        case 'html': 
     665        case 'json': 
     666        case 'exceptions': 
     667            break; 
     668        default: 
     669            return array(); 
     670        }         
     671 
     672        $s = getParam("sys_{$sType}_fields"); 
    649673        if (!$s) { 
    650             $a = array ( 
    651                 $this->_aConfig['home_uri'] => $a,  
    652                 'system_email_templates' => $this->_getEmailTemplatesHtmlFields(), 
    653                 'system_langs' => $this->_getLanguageHtmlFields(), 
    654             ); 
     674            $a = array ($this->_aConfig['home_uri'] => $a); 
     675            if ('exceptions' == $sType) { 
     676                $a['system_email_templates'] = $this->_getEmailTemplatesHtmlFields(); 
     677            } 
    655678        } else { 
    656679            $a = array_merge (unserialize($s), array ($this->_aConfig['home_uri'] => $a)); 
     680            if ('exceptions' == $sType) { 
     681                unset($a['system_email_templates']); 
     682                $a['system_email_templates'] = $this->_getEmailTemplatesHtmlFields(); 
     683            } 
     684        } 
     685        $s = serialize ($a); 
     686        setParam ("sys_{$sType}_fields", $s); 
     687        // recreate cache 
     688        $GLOBALS['MySQL']->cleanCache ("sys_{$sType}_fields"); 
     689        $GLOBALS['MySQL']->fromCache ("sys_{$sType}_fields", 'getOne', "SELECT `VALUE` FROM `sys_options` WHERE `Name` = 'sys_{$sType}_fields' LIMIT 1"); 
     690    } 
     691 
     692    function _removeFields ($sType) { 
     693        switch ($sType) { 
     694        case 'html': 
     695        case 'json': 
     696        case 'exceptions': 
     697            break; 
     698        default: 
     699            return array(); 
     700        }         
     701 
     702        $s = getParam('sys_html_fields'); 
     703        if (!$s) { 
     704            return; 
     705        }  
     706        $a = unserialize($s); 
     707        unset ($a[$this->_aConfig['home_uri']]); 
     708        if ('exceptions' == $sType) { 
    657709            unset($a['system_email_templates']); 
    658             unset($a['system_langs']); 
    659710            $a['system_email_templates'] = $this->_getEmailTemplatesHtmlFields(); 
    660             $a['system_langs'] = $this->_getLanguageHtmlFields(); 
    661711        } 
    662712        $s = serialize ($a); 
     
    666716        $GLOBALS['MySQL']->fromCache ('sys_html_fields', 'getOne', "SELECT `VALUE` FROM `sys_options` WHERE `Name` = 'sys_html_fields' LIMIT 1"); 
    667717    } 
    668  
    669     function removeHtmlFields () { 
    670         $s = getParam('sys_html_fields'); 
    671         $this->_aConfig['home_uri']; 
    672         if (!$s) { 
    673             return; 
    674         }  
    675         $a = unserialize($s); 
    676         unset ($a[$this->_aConfig['home_uri']]); 
    677         unset($a['system_email_templates']); 
    678         unset($a['system_langs']); 
    679         $a['system_email_templates'] = $this->_getEmailTemplatesHtmlFields(); 
    680         $a['system_langs'] = $this->_getLanguageHtmlFields(); 
    681         $s = serialize ($a); 
    682         setParam ('sys_html_fields', $s); 
    683         // recreate cache 
    684         $GLOBALS['MySQL']->cleanCache ('sys_html_fields'); 
    685         $GLOBALS['MySQL']->fromCache ('sys_html_fields', 'getOne', "SELECT `VALUE` FROM `sys_options` WHERE `Name` = 'sys_html_fields' LIMIT 1"); 
    686     } 
    687  
    688     //--- Protected methods ---// 
     718     
    689719    function _updateLanguage($bInstall, $aLanguage, $iCategoryId = 0) { 
    690720        if(empty($iCategoryId)) 
  • trunk/inc/security.inc.php

    r13108 r13117  
    2222        $init->config['General']['tmp_path'] = '../../../tmp/'; 
    2323        $init->config['Caching']['path'] = '../../../tmp/default_filter.cache'; 
    24         $init->config['General']['html'] = bx_sys_security_get_html_fileds (); 
     24 
     25 
     26        if (defined('BX_SECURITY_JSON') && is_array($aBxSecurityJSON)) { 
     27            $init->config['General']['json'] = array_merge ($init->config['General']['json'], $aBxSecurityJSON); 
     28        } 
     29        $init->config['General']['json'] = array_merge($init->config['General']['json'], bx_sys_security_get_fields ('json')); 
     30 
     31 
     32        if (defined('BX_SECURITY_HTML') && is_array($aBxSecurityHTML)) { 
     33            $init->config['General']['html'] = array_merge ($init->config['General']['html'], $aBxSecurityHTML); 
     34        } 
     35        $init->config['General']['html'] = array_merge($init->config['General']['html'], bx_sys_security_get_fields ('html')); 
     36 
     37 
     38        if (defined('BX_SECURITY_EXCEPTIONS') && is_array($aBxSecurityExceptions)) { 
     39            $init->config['General']['exceptions'] = array_merge ($init->config['General']['exceptions'], $aBxSecurityExceptions); 
     40        } 
     41        $init->config['General']['exceptions'] = array_merge($init->config['General']['exceptions'], bx_sys_security_get_fields ('exceptions')); 
     42 
    2543 
    2644        $init->config['General']['HTML_Purifier_Path'] = BX_DIRECTORY_PATH_PLUGINS . 'htmlpurifier/HTMLPurifier.standalone.php'; 
     
    4765    } 
    4866 
    49     function bx_sys_security_get_html_fileds () { 
    50         $sCacheFile = BX_DIRECTORY_PATH_CACHE . 'db_sys_html_fields.php'; 
     67 
     68    function bx_sys_security_get_fields ($sType) { 
     69        switch ($sType) { 
     70        case 'html': 
     71        case 'json': 
     72        case 'exceptions': 
     73            break; 
     74        default: 
     75            return array(); 
     76        } 
     77 
     78        $sCacheFile = BX_DIRECTORY_PATH_CACHE . "db_sys_{$sType}_fields.php"; 
    5179        if (!file_exists($sCacheFile)) { 
    5280            require_once( BX_DIRECTORY_PATH_INC . 'db.inc.php' ); 
    53             $mixedVar = $GLOBALS['MySQL']->fromCache ('sys_html_fields', 'getOne', "SELECT `VALUE` FROM `sys_options` WHERE `Name` = 'sys_html_fields' LIMIT 1"); 
     81            $mixedVar = $GLOBALS['MySQL']->fromCache ("sys_{$sType}_fields", 'getOne', "SELECT `VALUE` FROM `sys_options` WHERE `Name` = 'sys_html_fields' LIMIT 1"); 
    5482        } else { 
    5583            include $sCacheFile; 
  • trunk/install/sql/v70.sql

    r13078 r13117  
    10821082INSERT INTO `sys_options` VALUES('license_expiration', '', 0, 'Dolphin License Expiration', 'digit', '', '', 0, ''); 
    10831083INSERT INTO `sys_options` VALUES('license_checksum', '', 0, 'Dolphin License Checksum', 'digit', '', '', 0, ''); 
    1084 INSERT INTO `sys_options` VALUES('sys_html_fields', 'a:1:{s:6:"system";a:18:{i:0;s:20:"POST.DescriptionMe.0";i:1;s:23:"REQUEST.DescriptionMe.0";i:2;s:20:"POST.DescriptionMe.1";i:3;s:23:"REQUEST.DescriptionMe.1";i:4;s:12:"POST.message";i:5;s:15:"REQUEST.message";i:6;s:9:"POST.body";i:7;s:12:"REQUEST.body";i:8;s:9:"POST.Text";i:9;s:12:"REQUEST.Text";i:10;s:12:"POST.Content";i:11;s:15:"REQUEST.Content";i:12;s:17:"POST.content_text";i:13;s:20:"REQUEST.content_text";i:14;s:12:"POST.content";i:15;s:15:"REQUEST.content";i:16;s:12:"POST.CmtText";i:17;s:15:"REQUEST.CmtText";}}', 0, 'HTML fields', 'text', '', '', 0, ''); 
     1084INSERT INTO `sys_options` VALUES('sys_html_fields', 'a:1:{s:6:"system";a:4:{i:0;s:12:"POST.message";i:1;s:15:"REQUEST.message";i:2;s:12:"POST.CmtText";i:3;s:15:"REQUEST.CmtText";}}', 0, 'HTML fields', 'text', '', '', 0, ''); 
     1085INSERT INTO `sys_options` VALUES('sys_json_fields', '', 0, 'JSON fields', 'text', '', '', 0, ''); 
     1086INSERT INTO `sys_options` VALUES('sys_exceptions_fields', '', 0, 'Exceptions fields', 'text', '', '', 0, ''); 
    10851087INSERT INTO `sys_options` VALUES('enable_dolphin_footer', 'on', 0, 'enable boonex footers', 'checkbox', '', '', NULL, ''); 
    10861088INSERT INTO `sys_options` VALUES('enable_modrewrite', 'on', 26, 'Enable friendly profile permalinks', 'checkbox', '', '', 1, ''); 
  • trunk/join.php

    r13020 r13117  
    2020* see license.txt file; if not, write to marketing@boonex.com 
    2121***************************************************************************/ 
     22 
     23define('BX_SECURITY_HTML', true); 
     24$aBxSecurityHTML = array( 
     25    'POST.DescriptionMe.0',  
     26    'REQUEST.DescriptionMe.0',  
     27    'POST.DescriptionMe.1',  
     28    'REQUEST.DescriptionMe.1', 
     29); 
    2230 
    2331define('BX_INDEX_PAGE', 1); 
  • trunk/modules/boonex/map_profiles/install/installer.php

    r9441 r13117  
    2727        parent::BxDolInstaller($aConfig); 
    2828    } 
     29 
     30    function install($aParams) { 
     31 
     32        $aResult = parent::install($aParams); 
     33 
     34        $this->addExceptionsFields (array ('POST.bx_map_key', 'REQUEST.bx_map_key'));  
     35 
     36        return $aResult; 
     37    }     
     38     
     39    function uninstall() {         
     40 
     41        $ret = parent::uninstall(array()); 
     42 
     43        $this->removeExceptionsFields (); 
     44 
     45        return $ret; 
     46    }     
    2947} 
    3048?> 
  • trunk/modules/boonex/open_social/os.php

    r10962 r13117  
    1818* see license.txt file; if not, write to marketing@boonex.com 
    1919***************************************************************************/ 
     20 
     21define('BX_SECURITY_EXCEPTIONS', true); 
     22$aBxSecurityExceptions = array( 
     23    'POST.request', 
     24    'GET.request', 
     25    'REQUEST.request', 
     26); 
    2027 
    2128require_once( '../../../inc/header.inc.php' ); 
  • trunk/pedit.php

    r12050 r13117  
    2121***************************************************************************/ 
    2222 
     23define('BX_SECURITY_HTML', true); 
     24$aBxSecurityHTML = array( 
     25    'POST.DescriptionMe.0', 
     26    'REQUEST.DescriptionMe.0',  
     27    'POST.DescriptionMe.1',  
     28    'REQUEST.DescriptionMe.1', 
     29); 
     30 
    2331require_once( './inc/header.inc.php' ); 
    2432require_once( BX_DIRECTORY_PATH_INC     . 'admin.inc.php' ); 
  • trunk/plugins/phpids/IDS/Config/Config.ini

    r13109 r13117  
    3535    exceptions[]    = REQUEST.__utmz 
    3636    exceptions[]    = REQUEST.__utmc 
     37    exceptions[]    = REQUEST.__gads 
    3738    exceptions[]    = COOKIE.__utmz 
    38     exceptions[]    = COOKIE.__utmc 
    39     exceptions[]    = REQUEST.bx_map_key 
    40     exceptions[]    = POST.bx_map_key 
     39    exceptions[]    = COOKIE.__utmc     
     40    exceptions[]    = COOKIE.__gads 
    4141 
    4242    ; PHPIDS should run with PHP 5.1.2 but this is untested - set  
  • trunk/plugins/phpids/IDS/default_filter.xml

    r13007 r13117  
    6161    </filter> 
    6262    <filter> 
    63         <id>6</id> 
    64         <rule><![CDATA[(?:with\s*\(\s*.+\s*\)\s*\w+\s*\()|(?:(?:do|while|for)\s*\([^)]*\)\s*\{)|(?:\/[\w\s]*\[\W*\w)]]></rule> 
    65         <description>Detects self contained xss via with(), common loops and regex to string conversion</description> 
    66         <tags> 
    67             <tag>xss</tag> 
    68             <tag>csrf</tag> 
    69         </tags> 
    70         <impact>5</impact> 
    71     </filter> 
    72     <filter> 
    7363        <id>7</id> 
    7464        <rule><![CDATA[(?:\d\s*[|&]{2}\s*\w)|(?:[=(].+\?.+:)|(?:with\([^)]*\)\))|(?:\.\s*source\W)|(?:\?[^:=]+:[^;]+(;|$))]]></rule> 
     
    424414    </filter>    
    425415    <filter> 
    426         <id>39</id> 
    427         <rule><![CDATA[(?:\\x[01fe][\db-ce-f])|(?:%[01fe][\db-ce-f])|(?:&#[01fe][\db-ce-f])|(?:\\[01fe][\db-ce-f])|(?:&#x[01fe][\db-ce-f])]]></rule> 
    428         <description>Detects nullbytes and other dangerous characters</description> 
    429         <tags> 
    430             <tag>id</tag> 
    431             <tag>rfe</tag> 
    432             <tag>xss</tag> 
    433         </tags> 
    434         <impact>5</impact> 
    435     </filter>    
    436     <filter> 
    437416        <id>40</id> 
    438417        <rule><![CDATA[(?:"\s*(?:#|--|{))|(?:\/\*!\s?\d+)|(?:ch(?:a)?r\s*\(\s*\d)|(?:(?:(n?and|x?or|not)\s+|\|\||\&\&)\s*\w+\()]]></rule> 
     
    477456        </tags> 
    478457        <impact>6</impact> 
    479     </filter>  
    480     <filter> 
    481         <id>44</id> 
    482         <rule><![CDATA[(?:\d"\s+"\s+\d)|(?:^admin\s*"|(\/\*)+"+\s?(?:--|#|\/\*|{)?)|(?:"\s*or[\w\s-]+\s*[+<>=(),-]\s*[\d"])|(?:"\s*[^\w\s]?=\s*")|(?:"\W*[+=]+\W*")|(?:"\s*[!=|][\d\s!=+-]+.*["(].*$)|(?:"\s*[!=|][\d\s!=]+.*\d+$)|(?:"\s*like\W+[\w"(])|(?:\sis\s*0\W)|(?:where\s[\s\w\.,-]+\s=)|(?:"[<>~]+")]]></rule> 
    483         <description>Detects basic SQL authentication bypass attempts 1/3</description> 
    484         <tags> 
    485             <tag>sqli</tag> 
    486             <tag>id</tag> 
    487             <tag>lfi</tag> 
    488         </tags> 
    489         <impact>7</impact> 
    490     </filter>  
    491     <filter> 
    492         <id>45</id> 
    493         <rule><![CDATA[(?:union\s*(?:all|distinct|[(!@]*)?\s*[([]\s*select)|(?:\w+\s+like\s+\")|(?:like\s*"\%)|(?:"\s*like\W*["\d])|(?:"\s*(?:n?and|x?or|not |\|\||\&\&)\s+[\s\w]+=\s*\w+\s*having)|(?:"\s*\*\s*\w+\W+")|(?:"\s*[^?\w\s=.,;)(]+\s*[(@]*\s*\w+\W+\w)|(?:select\s*[\[\]()\s\w\.,-]+from)]]></rule> 
    494         <description>Detects basic SQL authentication bypass attempts 2/3</description> 
    495         <tags> 
    496             <tag>sqli</tag> 
    497             <tag>id</tag> 
    498             <tag>lfi</tag> 
    499         </tags> 
    500         <impact>7</impact> 
    501     </filter> 
    502      <filter> 
    503         <id>46</id> 
    504         <rule><![CDATA[(?:(?:n?and|x?or|not |\|\||\&\&)\s+[\s\w+]+(?:regexp\s*\(|sounds\s+like\s*"|[=\d]+x))|("\s*\d\s*(?:--|#))|(?:"[%&<>^=]+\d\s*(=|or))|(?:"\W+[\w+-]+\s*=\s*\d\W+")|(?:"\s*is\s*\d.+"?\w)|(?:"\|?[\w-]{3,}[^\w\s.,]+")|(?:"\s*is\s*[\d.]+\s*\W.*")]]></rule> 
    505         <description>Detects basic SQL authentication bypass attempts 3/3</description> 
    506         <tags> 
    507             <tag>sqli</tag> 
    508             <tag>id</tag> 
    509             <tag>lfi</tag> 
    510         </tags> 
    511         <impact>7</impact> 
    512     </filter>  
     458    </filter> 
    513459    <filter> 
    514460        <id>47</id> 
     
    690636        <impact>5</impact> 
    691637    </filter> 
     638    <!--         
    692639    <filter> 
    693640        <id>67</id> 
     
    703650        <impact>7</impact> 
    704651    </filter> 
     652    -->     
    705653    <filter> 
    706654        <id>68</id> 
Note: See TracChangeset for help on using the changeset viewer.