Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fixes by NY
#3
Fix: Small/Large security hole in 1.71

Open admin/inc/base.php
Insert at the bottom after in_arrayi(); function
Code:
/*******************************************************
* @function alpha
* @param $string - the string / number / ect
* @param $check - what are we making sure the $string is?
* @about - checks a string / ect against regular expressions
*
*/
function alpha($string, $check = 'alpha')
{
    switch($check)
    {
        case "alpha":
            $regexp = "([a-z0-9])";
        break;
            
        case "alpha-space":
            $regexp = "([a-z0-9+ ])";
        break;
            
        case "alpha-underscore":
            $regexp = "([a-z0-9\_])";
        break;

    case "alpha-slug":
        $regexp = "([a-z0-9\_\-])";
    break;
            
        case "alpha-spacers":
            $regexp = "([a-z0-9-[\]_+ ])";
        break;
            
        case "num-dash":
            $regexp = "([0-9-])";
        break;
            
        case "alpha-extra":
            $regexp = "([a-z0-9+ \\\,\?\`\'\!\.\;\:\[\]\&\%\^\*\$\@\(\)\<\-\_\+\=])";
        break;
            
        case "num":
            $regexp = "([0-9])";
        break;
            
        case "strict":
            $regexp = "([a-z])";
        break;
    }
    
    return (preg_match('/^'.$regexp.'+$/i',$string)) ? true : false;
}
/******************************************************/

Open index.php, not admin/index.php
Find
Code:
// get page id (url slug) that is being passed via .htaccess mod_rewrite
    if (isset($_GET['id'])) {
        $id = strtolower($_GET['id']);
    } else {
        $id = "index";
    }

Replace With
Code:
if (isset($_GET['id'])) {
        if(alpha($_GET['id'], 'alpha-slug'))
        {
            $id = strtolower($_GET['id']);
        }
        else
        {
            $id = "index";
        }
    } else {
        $id = "index";
    }

Save and enjoy a little more security!
http://nijikokun.com
random stuff. idk.
Reply


Messages In This Thread
Fixes by NY - by Nijikokun - 2010-01-08, 03:13:48
Fixes by NY - by Nijikokun - 2010-01-08, 03:28:01
Fixes by NY - by Nijikokun - 2010-01-08, 03:35:04
Fixes by NY - by Nijikokun - 2010-01-08, 04:10:01
Fixes by NY - by Zegnåt - 2010-01-08, 05:29:27
Fixes by NY - by Nijikokun - 2010-01-08, 06:00:08
Fixes by NY - by Nijikokun - 2010-01-08, 06:32:37
Fixes by NY - by ccagle8 - 2010-01-08, 11:41:47
Fixes by NY - by ccagle8 - 2010-01-08, 11:44:19
Fixes by NY - by Nijikokun - 2010-01-08, 12:59:43
Fixes by NY - by Zegnåt - 2010-01-08, 19:48:27
Fixes by NY - by Nijikokun - 2010-01-09, 02:53:56



Users browsing this thread: 1 Guest(s)