Changeset 3437 for branches/2.2/security


Ignore:
Timestamp:
10/29/10 10:14:12 (14 years ago)
Author:
rafaelraymundo
Message:

Ticket #990 - Vulnerabilidades no Anti robo Captcha do Login.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/security/captcha.php

    r3018 r3437  
    106106  
    107107 // ************  Fim da Classe  ************************* 
    108   
    109   
    110   //Cria o CAPTCHA( gera o string e a imagem ... 
     108 
     109function session_convert($str,$ky='') 
     110    { 
     111        if($ky=='') return $str; 
     112        $ky=str_replace(chr(32),'',$ky); 
     113        if(strlen($ky)<8) return ''; 
     114        $kl=strlen($ky)<32?strlen($ky):32; 
     115        $k=array(); 
     116        for($i=0;$i<$kl;$i++) 
     117            { 
     118                $k[$i]=ord($ky{$i})&0x1F; 
     119            } 
     120        $j=0; 
     121        for($i=0;$i<strlen($str);$i++) 
     122            { 
     123                $e=ord($str{$i}); 
     124                $str{$i}=$e&0xE0?chr($e^$k[$j]):chr($e); 
     125                $j++;$j=$j==$kl?0:$j; 
     126            } 
     127        return $str; 
     128    } 
     129 
     130  $key_convert = md5_file($_SERVER["DOCUMENT_ROOT"].'header.inc.php'); 
     131  //Cria o CAPTCHA,  gera o string e a imagem ... 
    111132  $GLOBALS['captcha'] = new captcha; 
    112133  // Guarda o string do captcha na session... 
    113   session_id($_REQUEST['xsid']);  
     134  session_name('ZABX'); 
     135  session_id(substr(session_convert(base64_decode($_REQUEST['ZABX']),$key_convert),32)); 
    114136  session_start();  
    115137  $_SESSION['CAPTCHAString'] = $GLOBALS['captcha'] ->GetCaptchaString(); 
Note: See TracChangeset for help on using the changeset viewer.