Plugin Directory

Changeset 1250763


Ignore:
Timestamp:
09/21/2015 11:52:36 PM (10 years ago)
Author:
avdude
Message:

Fixed security bug in attendee ID transmitted in URL on confirmation page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • event-registration/trunk/public/evr_public-process_confirmation.php

    r1149350 r1250763  
    6969    }
    7070    #Now that the attendee record has been posted and we have id, redirect to confirmation page.
    71     $url_to_goto = evr_permalink($company_options['evr_page_id']).'action=show_confirm_mess&event_id='.$passed_event_id.'&reg_id='.$reg_id;
    72     echo '<meta http-equiv="refresh" content="0;url='.$url_to_goto .'" />';
     71    $urlData = new EVR_encryption();
     72    $url_id = $urlData->encode($reg_id);
     73     $url_to_goto = evr_permalink($company_options['evr_page_id']).'action=show_confirm_mess&event_id='.$passed_event_id.'&amp;reg_id='.$url_id;
     74   
     75    //$url_to_goto = evr_permalink($company_options['evr_page_id']).'action=show_confirm_mess&event_id='.$passed_event_id.'&amp;reg_id='.$reg_id;
     76       echo '<meta http-equiv="refresh" content="0;url='.$url_to_goto .'" />';
    7377}
     78
     79
     80class EVR_encryption {
     81    var $skey   = "asp"; // you can change it
     82   
     83    public  function safe_b64encode($string) {
     84   
     85        $data = base64_encode($string);
     86        $data = str_replace(array('+','/','='),array('-','_',''),$data);
     87        return $data;
     88    }
     89 
     90    public function safe_b64decode($string) {
     91        $data = str_replace(array('-','_'),array('+','/'),$string);
     92        $mod4 = strlen($data) % 4;
     93        if ($mod4) {
     94            $data .= substr('====', $mod4);
     95        }
     96        return base64_decode($data);
     97    }
     98   
     99    public  function encode($value){
     100       
     101        if(!$value){return false;}
     102        $text = $value;
     103        $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
     104        $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
     105        $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->skey, $text, MCRYPT_MODE_ECB, $iv);
     106        return trim($this->safe_b64encode($crypttext));
     107    }
     108   
     109    public function decode($value){
     110       
     111        if(!$value){return false;}
     112        $crypttext = $this->safe_b64decode($value);
     113        $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
     114        $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
     115        $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->skey, $crypttext, MCRYPT_MODE_ECB, $iv);
     116        return trim($decrypttext);
     117    }
     118}
     119
     120
     121
     122
     123
     124
     125
    74126function evr_show_confirmation()
    75127{
    76128    global $wpdb, $company_options;
    77129   // $company_options = get_option('evr_company_settings');
    78     if (is_numeric($_REQUEST['event_id'])){ $event_id = (int)$_REQUEST['event_id']; }
    79     if (is_numeric($_REQUEST['reg_id'])){ $reg_id = (int)$_REQUEST['reg_id'];}
     130    $urlData = new EVR_encryption();
     131    $url_id = $urlData->decode($_REQUEST['reg_id']);
     132   
     133       if (is_numeric($_REQUEST['event_id'])){ $event_id = (int)$_REQUEST['event_id']; }
     134    //if (is_numeric($_REQUEST['reg_id'])){ $reg_id = (int)$_REQUEST['reg_id'];}
     135    if (is_numeric($url_id)){ $reg_id = (int)$url_id;}
    80136    #
    81137    if (isset($company_options['info_recieved']) && ($company_options['info_recieved'] !='')){
Note: See TracChangeset for help on using the changeset viewer.