Changeset 6731

Show
Ignore:
Timestamp:
09/15/08 20:38:35 (3 months ago)
Author:
p_lindheimer
Message:

closes #3184 Secruity Issue allowing access of arbitrary files from authenticated ARI users with brute force cracking of a weak encryption key

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.5/amp_conf/htdocs/recordings/includes/login.php

    r6409 r6731  
    336336        $_SESSION['ari_user']['default_page'] = $default_page; 
    337337 
    338         // force the session data saved 
    339         session_write_close(); 
     338                                // Make sure nothing stale is here: 
     339                                // 
     340                                unset($_SESSION['ari_user']['recfiles']); 
     341 
     342        // don't force the session data saved, there may be voicemail or callmonitor files still 
    340343      }  
    341344    } 
  • freepbx/branches/2.5/amp_conf/htdocs/recordings/misc/audio.php

    r6699 r6731  
    77 
    88 
    9  
    10 if (isset($_GET['recording'])) { 
     9if (isset($_GET['recindex'])) { 
    1110 
    1211  chdir(".."); 
    1312  include_once("./includes/bootstrap.php"); 
    1413 
    15   global $ARI_CRYPT_PASSWORD
     14       $path = $_SESSION['ari_user']['recfiles'][$_GET['recindex']]
    1615 
    17   $crypt = new Crypt(); 
    18  
    19   $path = $crypt->decrypt($_GET['recording'],$ARI_CRYPT_PASSWORD); 
    20  
    21   // strip ".." from path and retrieve absolute path from filesystem for security 
    22   $path = realpath(preg_replace('/\.\./','',$path)); 
    23    
    2416  // See if the file exists 
    2517  if (!is_file($path)) { die("<b>404 File not found!</b>"); } 
  • freepbx/branches/2.5/amp_conf/htdocs/recordings/misc/recording_popup.php

    r6190 r6731  
    2323<?php 
    2424 
    25   $path = urlencode($_GET['recording']); 
     25        if (isset($_GET['recindex'])) { 
     26                $path = $_SESSION['ari_user']['recfiles'][$_GET['recindex']]; 
     27        } 
    2628 
    2729  if (isset($path)) { 
     
    3436 
    3537    echo("<br>"); 
    36     echo("<embed src='audio.php?recording=" . $path . "' width=300, height=25 autoplay=true loop=false></embed><br>"); 
    37     echo("<a class='popup_download' href=/recordings/misc/audio.php?recording="  . $path . ">" . _("download") . "</a><br>"); 
     38    echo("<embed src='audio.php?recindex=".$_GET['recindex'] . "' width=300, height=25 autoplay=true loop=false></embed><br>"); 
     39    echo("<a class='popup_download' href=/recordings/misc/audio.php?recindex="  . $_GET['recindex'] . ">" . _("download") . "</a><br>"); 
    3840  } 
    3941 
  • freepbx/branches/2.5/amp_conf/htdocs/recordings/modules/callmonitor.module

    r6579 r6731  
    6060    $files = array(); 
    6161    foreach($_REQUEST as $key => $value) { 
    62       if (preg_match('/selected/',$key)) { 
    63         array_push($files, $value); 
     62      if (preg_match('/selected/',$key) && isset($_SESSION['ari_user']['recfiles'][$value])) { 
     63        array_push($files, $_SESSION['ari_user']['recfiles'][$value]); 
    6464      } 
    6565    } 
     
    100100    global $CALLMONITOR_ALLOW_DELETE; 
    101101    global $AJAX_PAGE_REFRESH_ENABLE; 
    102     global $ARI_CRYPT_PASSWORD; 
    103102 
    104103    $display = new DisplaySearch(); 
    105     $crypt = new Crypt(); 
    106104 
    107105    // get the search string 
     
    204202 
    205203    // table body 
     204                unset($_SESSION['ari_user']['recfiles']); 
    206205    if (is_array($data)) foreach($data as $key=>$value) { 
     206                        $i++; 
    207207 
    208208      // recording file 
    209209      $recording = $recordings[$value['uniqueid'] . $value['calldate']]; 
    210       $fileCrypt = $crypt->encrypt($recording,$ARI_CRYPT_PASSWORD); 
    211       $recordingCrypt = urlencode($fileCrypt); 
    212210 
    213211      // date and time 
     
    216214      $time = $buf[1]; 
    217215 
    218       // recording delete checkbox 
    219       if ($CALLMONITOR_ALLOW_DELETE) { 
    220         $recording_delete_checkbox = "<td class='checkbox'><input type=checkbox name='selected" . ++$i . "' value=" . $fileCrypt . "></td>"; 
    221       } 
    222216 
    223217      $recordingLink = ''; 
    224218      if (is_file($recordings[$value['uniqueid'] . $value['calldate']])) { 
    225         $recordingLink = "<a href='#' onClick=\"javascript:popUp('misc/recording_popup.php?recording=" . $recordingCrypt . "&date=" . $date . "&time=" . $time . "'); return false;\">" . _("play") . "</a>"; 
    226       } 
     219                                $_SESSION['ari_user']['recfiles'][$i] = $recording; 
     220        $recordingLink = "<a href='#' onClick=\"javascript:popUp('misc/recording_popup.php?recindex=" . $i . "&date=" . $date . "&time=" . $time . "'); return false;\">" . _("play") . "</a>"; 
     221        // recording delete checkbox 
     222        if ($CALLMONITOR_ALLOW_DELETE) { 
     223                $recording_delete_checkbox = "<td class='checkbox'><input type=checkbox name='selected" . $i . "' value=" . $i . "></td>"; 
     224        } 
     225      } else { 
     226        if ($CALLMONITOR_ALLOW_DELETE) { 
     227                $recording_delete_checkbox = "<td class='checkbox'><input type=checkbox name='selected" . $i . "' value=" . "NO_VALUE" . "></td>"; 
     228        } 
     229                        } 
    227230     
    228231      $recording_body .= "<tr> 
     
    531534  function deleteRecData($files) { 
    532535 
    533     global $ARI_CRYPT_PASSWORD; 
    534  
    535     $crypt = new Crypt(); 
    536  
    537     foreach($files as $key => $fileCrypt) { 
    538       $file = $crypt->decrypt($fileCrypt,$ARI_CRYPT_PASSWORD); 
     536    foreach($files as $key => $file) { 
    539537      if (is_writable($file)) { 
    540538        unlink($file); 
  • freepbx/branches/2.5/amp_conf/htdocs/recordings/modules/voicemail.module

    r6478 r6731  
    149149    $files = array(); 
    150150    foreach($_REQUEST as $key => $value) { 
    151       if (preg_match('/selected/',$key)) { 
    152         array_push($files, $value); 
     151      if (preg_match('/selected/',$key) && isset($_SESSION['ari_user']['recfiles'][$value])) { 
     152        array_push($files, $_SESSION['ari_user']['recfiles'][$value]); 
    153153      } 
    154154    } 
     
    208208    global $ASTERISK_VOICEMAIL_FOLDERS; 
    209209    global $AJAX_PAGE_REFRESH_ENABLE; 
    210     global $ARI_CRYPT_PASSWORD; 
    211210 
    212211    $voicemail_audio_format = $_COOKIE['ari_voicemail_audio_format']; 
    213212 
    214213    $display = new DisplaySearch(); 
    215     $crypt = new Crypt(); 
    216214 
    217215    // args 
     
    385383 
    386384    // table body 
     385                unset($_SESSION['ari_user']['recfiles']); 
    387386    if (isset($data)) { 
    388387      foreach($data as $file=>$value) { 
    389  
     388                                $i++; 
    390389        // recording popup link 
    391390        $voicemail_audio_format = $voicemail_audio_format=='' ? '.wav' : $voicemail_audio_format; 
     
    398397        $duration = $value[duration]; 
    399398        if (is_file($recording)) { 
    400           $recordingCrypt = urlencode($crypt->encrypt($recording,$ARI_CRYPT_PASSWORD))
    401           $recordingLink = "<a href='#' onClick=\"javascript:popUp('misc/recording_popup.php?recording=" . $recordingCrypt . "&date=" . $date . "&time=" . $time . "'); return false;\"> 
     399                                       $_SESSION['ari_user']['recfiles'][$i] = $recording
     400                                       $recordingLink = "<a href='#' onClick=\"javascript:popUp('misc/recording_popup.php?recindex=$i&date=" . $date . "&time=" . $time . "'); return false;\"> 
    402401            " . _("play") . " 
    403402          </a>"; 
     
    406405          $_SESSION['ari_error'] = _("Voicemail recording(s) was not found.") . "<br>" . 
    407406                                   sprintf(_("On settings page, change voicemail audio format.  It is currently set to %s"),$voicemail_audio_format); 
    408         } 
    409  
    410         $fileCrypt = $crypt->encrypt($file,$ARI_CRYPT_PASSWORD); 
     407                                        $recordingLink = "<a href='#' onClick=\"javascript:popUp('misc/recording_popup.php?recindex=$i&date=" . $date . "&time=" . $time . "'); return false;\"> 
     408            " . _("play") . " 
     409          </a>"; 
     410        } 
    411411 
    412412        $tableText .= " 
    413413          <tr> 
    414             <td class='checkbox'><input type=checkbox name='selected" . ++$i . "' value=" . $fileCrypt . "></td> 
     414            <td class='checkbox'><input type=checkbox name='selected" . $i . "' value=" . $i . "></td> 
    415415            <td width=68>" . $date . "</td> 
    416416            <td>" . $time . "</td> 
     
    422422          </tr>"; 
    423423      } 
    424     } 
    425  
     424    }  
    426425    // options 
    427426    $url_opts = array(); 
     
    622621  function deleteVoicemailData($files) { 
    623622 
    624     global $ARI_CRYPT_PASSWORD; 
    625  
    626     $crypt = new Crypt(); 
    627  
    628     foreach($files as $key => $pathCrypt) { 
    629  
    630       // decrypt path 
    631       $path = $crypt->decrypt($pathCrypt,$ARI_CRYPT_PASSWORD); 
     623    foreach($files as $key => $path) { 
    632624 
    633625      // get file parts for search 
     
    666658 
    667659    global $ASTERISK_VOICEMAIL_PATH; 
    668     global $ARI_CRYPT_PASSWORD; 
    669  
    670     $crypt = new Crypt(); 
    671660 
    672661    $perm = fileperms($ASTERISK_VOICEMAIL_PATH); 
     
    723712    } 
    724713 
    725     foreach($files as $key => $pathCrypt) { 
    726       // decrypt path 
    727       $pathPlain = $crypt->decrypt($pathCrypt,$ARI_CRYPT_PASSWORD); 
     714    foreach($files as $key => $pathPlain) { 
    728715      // add plain path to new array 
    729716      $filesPlain[] = $pathPlain; 
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads