head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.4 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.2 pkgsrc-2012Q4-base:1.2 pkgsrc-2012Q1:1.1.0.2 pkgsrc-2012Q1-base:1.1; locks; strict; comment @# @; 1.2 date 2012.06.16.12.27.59; author taca; state dead; branches; next 1.1; 1.1 date 2012.03.28.15.14.24; author taca; state Exp; branches; next ; desc @@ 1.2 log @Remove contao210 for now. Use Contao 2.11, please. @ text @$NetBSD: patch-system_initialize.php,v 1.1 2012/03/28 15:14:24 taca Exp $ * Unofficial fix for CVE-2012-1297 by checking Referer as days of Contao 2.9. --- system/initialize.php.orig 2011-12-30 09:00:10.000000000 +0000 +++ system/initialize.php @@@@ -166,8 +166,24 @@@@ include(TL_ROOT . '/system/config/initco */ if ($_POST && !$GLOBALS['TL_CONFIG']['disableRefererCheck'] && !defined('BYPASS_TOKEN_CHECK')) { - // Exit if the token cannot be validated - if (!$objInput->post('REQUEST_TOKEN') || !is_array($_SESSION['REQUEST_TOKEN'][TL_MODE]) || !in_array($objInput->post('REQUEST_TOKEN'), $_SESSION['REQUEST_TOKEN'][TL_MODE])) + $bad = false; + + // Exit if traditional referer check is enabled. + if (!$GLOBALS['TL_CONFIG']['disableCompatRefererCheck']) + { + $self = parse_url($objEnvironment->url); + $referer = parse_url($objEnvironment->httpReferer); + + $bad = (!strlen($referer['host']) || $referer['host'] != $self['host']); + } + + if (!$bad) + { + // Exit if the token cannot be validated + $bad = (!$objInput->post('REQUEST_TOKEN') || !is_array($_SESSION['REQUEST_TOKEN'][TL_MODE]) || !in_array($objInput->post('REQUEST_TOKEN'), $_SESSION['REQUEST_TOKEN'][TL_MODE])); + } + + if ($bad) { header('HTTP/1.1 400 Bad Request'); @ 1.1 log @Add unofficial fix for CVE-2012-1297 by checking Referer as days of Contao 2.9. Bump PKGREVISION. @ text @d1 1 a1 1 $NetBSD$ @