From: garvinhicking Date: Thu, 30 Nov 2006 21:34:33 +0000 (+0000) Subject: Ensure to not be able to call s9y files under circumstances where .htaccess does... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e01bcdcdc5beb0064d962daa45d293981c031d40;p=s9y.git Ensure to not be able to call s9y files under circumstances where .htaccess does not deny request AND register_globals is turned on --- diff --git a/docs/NEWS b/docs/NEWS index c964b60..7ad63e8 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -1,5 +1,12 @@ +# $Id$ +Version 1.0.4 () +------------------------------------------------------------------------ + + * Fix local file inclusion bug on systems with two conditions: + register_globals=on AND missing .htaccess for restricting access to + .inc.php files. (garvinhicking) + Version 1.0.3 (November 7th, 2006) ------------------------------------------------------------------------ diff --git a/include/admin/configuration.inc.php b/include/admin/configuration.inc.php index a4af5e2..4ecb2cf 100644 --- a/include/admin/configuration.inc.php +++ b/include/admin/configuration.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + umask(0000); $umask = 0775; @define('IN_installer', true); @@ -47,7 +51,7 @@ switch ($_POST['installAction'] && serendipity_checkFormToken()) { $permalinkNew[] = $serendipity[$permitem['var']]; } } - } + } if (serendipity_checkPermission('siteConfiguration') && serialize($permalinkOld) != serialize($permalinkNew)) { printf(ATTEMPT_WRITE_FILE, $serendipity['serendipityPath'] . '.htaccess'); diff --git a/include/admin/installer.inc.php b/include/admin/installer.inc.php index 36ddc05..438aa35 100644 --- a/include/admin/installer.inc.php +++ b/include/admin/installer.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + umask(0000); $umask = 0775; @define('IN_installer', true); diff --git a/include/compat.inc.php b/include/compat.inc.php index 5b95d91..a71769e 100644 --- a/include/compat.inc.php +++ b/include/compat.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + $serendipity = array(); @ini_set('magic_quotes_runtime', 'off'); @@ -33,11 +37,11 @@ function memSnap($tshow = '') { static $avail = null; static $show = true; static $memUsage = 0; - + if (!$show) { return false; } - + if ($avail === false) { return true; } elseif ($avail === null) { @@ -48,11 +52,11 @@ function memSnap($tshow = '') { return false; } } - + if ($memUsage === 0) { $memUsage = $avail; } - + $current = memory_get_usage(); echo '[' . date('d.m.Y H:i') . '] ' . number_format($current - $memUsage, 2, ',', '.') . ' label "' . $tshow . '", totalling ' . number_format($current, 2, ',', '.') . '
' . "\n"; $memUsage = $current; diff --git a/include/functions.inc.php b/include/functions.inc.php index 0401053..dc21e36 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + $serendipity['imageList'] = array(); include_once(S9Y_INCLUDE_PATH . "include/db/db.inc.php"); include_once(S9Y_INCLUDE_PATH . "include/compat.inc.php"); diff --git a/include/functions_calendars.inc.php b/include/functions_calendars.inc.php index e347b5f..7ba735a 100644 --- a/include/functions_calendars.inc.php +++ b/include/functions_calendars.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + /** * Gregorian to Jalali Convertor * @@ -15,42 +19,42 @@ function g2j($g_y, $g_m, $g_d){ $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); - + $gy = $g_y-1600; $gm = $g_m-1; $gd = $g_d-1; - + $g_day_no = 365*$gy+floor(($gy+3)/4)-floor(($gy+99)/100)+floor(($gy+399)/400); - + for ($i=0; $i < $gm; ++$i){ $g_day_no += $g_days_in_month[$i]; } - + if ($gm>1 && (($gy%4==0 && $gy%100!=0) || ($gy%400==0))){ /* leap and after Feb */ ++$g_day_no; } - + $g_day_no += $gd; $j_day_no = $g_day_no-79; $j_np = floor($j_day_no/12053); $j_day_no %= 12053; $jy = 979+33*$j_np+4*floor($j_day_no/1461); $j_day_no %= 1461; - + if ($j_day_no >= 366) { $jy += floor(($j_day_no-1)/365); $j_day_no = ($j_day_no-1)%365; } $j_all_days = $j_day_no+1; - + for ($i = 0; $i < 11 && $j_day_no >= $j_days_in_month[$i]; ++$i) { $j_day_no -= $j_days_in_month[$i]; } - + $jm = $i+1; $jd = $j_day_no+1; - + return array($jy, $jm, $jd, $j_all_days); } @@ -102,10 +106,10 @@ function j2g($j_y, $j_m, $j_d){ } $gm = $i+1; $gd = $g_day_no+1; - + return array($gy, $gm, $gd); } - + /** * Format a string according to Jalali calendar (UTF) * @@ -116,7 +120,7 @@ function j2g($j_y, $j_m, $j_d){ * @return string Formatted local time/date according to locale settings */ function jalali_strftime_utf($format, $timestamp) { - + $g_d=date('j', $timestamp); $g_m=date('n', $timestamp); $g_y=date('Y', $timestamp); @@ -146,12 +150,12 @@ function jalali_strftime_utf($format, $timestamp) { 'Wed' => '5', 'Thu' => '6', 'Fri' => '7'); - + // calculate string $output_str=''; - + for ($i=0; $i 'شنبه', @@ -294,12 +298,12 @@ function jalali_date_utf($format, $timestamp) { 'Wed' => '5', 'Thu' => '6', 'Fri' => '7'); - + // calculate string $output_str=''; - + for ($i=0; $iget_config($config_item, false, true); } } - + if (isset($_POST['serendipity'][$postkey][$config_item])) { if (is_array($_POST['serendipity'][$postkey][$config_item])) { $hvalue = $_POST['serendipity'][$postkey][$config_item]; @@ -343,7 +347,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam } else { $selected_options = array($hvalue => $hvalue); } - + $pre_selected = (array)$cbag->get('select_preselected'); $select_size = $cbag->get('select_size'); $select = $cbag->get('select_values'); @@ -494,7 +498,7 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam case 'hidden': ?>
@@ -550,6 +554,6 @@ function serendipity_plugin_config(&$plugin, &$bag, &$name, &$desc, &$config_nam false, 'uriargs' => implode('/', serendipity_getUriArguments($uri, true)), diff --git a/include/lang.inc.php b/include/lang.inc.php index 68d2b4f..ab1b170 100644 --- a/include/lang.inc.php +++ b/include/lang.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + if (!defined('serendipity_LANG_LOADED') || serendipity_LANG_LOADED !== true) { // Try and include preferred language from the configurated setting if (@include(S9Y_INCLUDE_PATH . 'lang/' . $serendipity['charset'] . 'serendipity_lang_'. $serendipity['lang'] .'.inc.php') ) { diff --git a/include/plugin_internal.inc.php b/include/plugin_internal.inc.php index 902a224..c020387 100644 --- a/include/plugin_internal.inc.php +++ b/include/plugin_internal.inc.php @@ -2,6 +2,10 @@ # Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team) # All rights reserved. See LICENSE file for licensing details +if (IN_serendipity !== true) { + die ("Don't hack!"); +} + class serendipity_calendar_plugin extends serendipity_plugin { var $title = CALENDAR; diff --git a/plugins/serendipity_event_xhtmlcleanup/UTF-8/lang_tn.inc.php b/plugins/serendipity_event_xhtmlcleanup/UTF-8/lang_tn.inc.php index d07de6a..b3658e0 100644 --- a/plugins/serendipity_event_xhtmlcleanup/UTF-8/lang_tn.inc.php +++ b/plugins/serendipity_event_xhtmlcleanup/UTF-8/lang_tn.inc.php @@ -1,4 +1,4 @@ -