function pnSecureInput()
{
    // Cross-Site Scripting attack defense - Sent by larsneo
    // some syntax checking against injected javascript
    // extended by Neo
    if (count($_GET) > 0) {
        //        Lets now sanitize the GET vars
        foreach ($_GET as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script.*\"?[^>]*>", $secvalue) || eregi(".*[[:space:]](or|and)[[:space:]].*(=|like).*", $secvalue) || eregi("<[^>]*object.*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe.*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet.*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta.*\"?[^>]*>", $secvalue) || eregi("<[^>]*style.*\"?[^>]*>", $secvalue) || eregi("<[^>]*form.*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert.*\"?[^>]*>", $secvalue) || eregi("<[^>]*img.*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie.*\"?[^>]*>", $secvalue) || eregi("\"", $secvalue)) {
                    pnMailHackAttempt('pnAntiCracker', __LINE__, 'pnSecurity Alert', 'GET Intrusion detection.');
                    Header("Location: index.php");
                }
            }
        }
    }
    //        Lets now sanitize the POST vars
    if (count($_POST) > 0) {
        foreach ($_POST as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script.*\"?[^>]*>", $secvalue) || eregi("<[^>]*object.*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe.*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet.*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert.*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie.*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta.*\"?[^>]*>", $secvalue)) {
                    pnMailHackAttempt('pnAntiCracker', __LINE__, 'pnSecurity Alert', 'POST Intrusion detection.');
                    Header("Location: index.php");
                }
            }
        }
    }
    //        Lets now sanitize the COOKIE vars
    if (count($_COOKIE) > 0) {
        foreach ($_COOKIE as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script.*\"?[^>]*>", $secvalue) || eregi(".*[[:space:]](or|and)[[:space:]].*(=|like).*", $secvalue) || eregi("<[^>]*object.*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe.*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet.*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta.*\"?[^>]*>", $secvalue) || eregi("<[^>]*style.*\"?[^>]*>", $secvalue) || eregi("<[^>]*form.*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert.*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie.*\"?[^>]*>", $secvalue) || eregi("<[^>]*img.*\"?[^>]*>", $secvalue)) {
                    pnMailHackAttempt('pnAntiCracker', __LINE__, 'pnSecurity Alert', 'COOKIE Intrusion detection.');
                    Header("Location: index.php");
                }
            }
        }
    }
}
Ejemplo n.º 2
0
function pnSecureInput()
{
    /*      Lets validate the current php version and set globals
            accordingly.
            Do not change this value unless you know what you are
            doing you have been warned!
     */
    //require('includes/htmlfilter.inc');
    if (phpversion() >= "4.2.0") {
        $HTTP_GET_VARS = $_GET;
        $HTTP_POST_VARS = $_POST;
        $HTTP_COOKIE_VARS = $_COOKIE;
    } else {
        global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;
    }
    // Cross-Site Scripting attack defense - Sent by larsneo
    // some syntax checking against injected javascript
    // extended by Neo
    if (count($HTTP_GET_VARS) > 0) {
        /*        Lets now sanitize the GET vars
         */
        foreach ($HTTP_GET_VARS as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) || eregi(".*[[:space:]](or|and)[[:space:]].*(=|like).*", $secvalue) || eregi("<[^>]*object*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta*\"?[^>]*>", $secvalue) || eregi("<[^>]*style*\"?[^>]*>", $secvalue) || eregi("<[^>]*form*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert*\"?[^>]*>", $secvalue) || eregi("<[^>]*img*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie*\"?[^>]*>", $secvalue) || eregi("\"", $secvalue)) {
                    //pnMailHackAttempt(__FILE__,__LINE__,'pnSecurity Alert','Intrusion detection.');
                    //Header("Location: index.php");
                }
            }
        }
    }
    /*        Lets now sanitize the POST vars
     */
    if (count($HTTP_POST_VARS) > 0) {
        foreach ($HTTP_POST_VARS as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) || eregi("<[^>]*object*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) {
                    //pnMailHackAttempt(__FILE__,__LINE__,'pnSecurity Alert','Intrusion detection.');
                    //Header("Location: index.php");
                }
            }
        }
    }
    /*        Lets now sanitize the COOKIE vars
     */
    if (count($HTTP_COOKIE_VARS) > 0) {
        foreach ($HTTP_COOKIE_VARS as $secvalue) {
            if (!is_array($secvalue)) {
                if (eregi("<[^>]*script*\"?[^>]*>", $secvalue) || eregi(".*[[:space:]](or|and)[[:space:]].*(=|like).*", $secvalue) || eregi("<[^>]*object*\"?[^>]*>", $secvalue) || eregi("<[^>]*iframe*\"?[^>]*>", $secvalue) || eregi("<[^>]*applet*\"?[^>]*>", $secvalue) || eregi("<[^>]*meta*\"?[^>]*>", $secvalue) || eregi("<[^>]*style*\"?[^>]*>", $secvalue) || eregi("<[^>]*form*\"?[^>]*>", $secvalue) || eregi("<[^>]*window.*\"?[^>]*>", $secvalue) || eregi("<[^>]*alert*\"?[^>]*>", $secvalue) || eregi("<[^>]*document.*\"?[^>]*>", $secvalue) || eregi("<[^>]*cookie*\"?[^>]*>", $secvalue) || eregi("<[^>]*img*\"?[^>]*>", $secvalue)) {
                    pnMailHackAttempt(__FILE__, __LINE__, 'pnSecurity Alert', 'Intrusion detection.');
                    //Header("Location: index.php");
                }
            }
        }
    }
}