rpms/moodle/F-9 moodle-1.9.4-CVE-2009-1171-1.patch, NONE, 1.1 moodle-1.9.4-CVE-2009-1171-2.patch, NONE, 1.1 moodle.spec, 1.30, 1.31
Jon Ciesla
limb at fedoraproject.org
Wed Apr 1 19:56:05 UTC 2009
Author: limb
Update of /cvs/pkgs/rpms/moodle/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28032/F-9
Modified Files:
moodle.spec
Added Files:
moodle-1.9.4-CVE-2009-1171-1.patch
moodle-1.9.4-CVE-2009-1171-2.patch
Log Message:
CVE-2009-1171
moodle-1.9.4-CVE-2009-1171-1.patch:
--- NEW FILE moodle-1.9.4-CVE-2009-1171-1.patch ---
--- filter/tex/filter.php.orig 2009/02/17 05:24:35 1.18.4.4
+++ filter/tex/filter.php 2009/03/26 19:06:29 1.18.4.5
@@ -133,6 +133,16 @@
$text = str_replace($matches[0][$i],$replacement,$text);
}
+ // TeX blacklist. MDL-18552
+ $tex_blacklist = array(
+ 'include','def','command','loop','repeat','open','toks','output',
+ 'input','catcode','name','^^',
+ '\every','\errhelp','\errorstopmode','\scrollmode','\nonstopmode',
+ '\batchmode','\read','\write','csname','\newhelp','\uppercase',
+ '\lowercase','\relax','\aftergroup',
+ '\afterassignment','\expandafter','\noexpand','\special'
+ );
+
// <tex> TeX expression </tex>
// or <tex alt="My alternative text to be used instead of the TeX form"> TeX expression </tex>
// or $$ TeX expression $$
@@ -155,6 +165,19 @@
$align = "text-top";
$texexp = preg_replace('/^align=top /','',$texexp);
}
+ /// Check $texexp against blacklist (whitelisting could be more complete but also harder to maintain). MDL-18552
+ $invalidcommands = array();
+ foreach($tex_blacklist as $command) {
+ if (stristr($texexp, $command)) { /// Found invalid command. Annotate.
+ $invalidcommands[] = $command;
+ }
+ }
+ if (!empty($invalidcommands)) { /// Invalid commands found. Output error and continue with next TeX element
+ $invalidstr = get_string('invalidtexcommand', 'error', implode(', ', $invalidcommands));
+ $text = str_replace( $matches[0][$i], $invalidstr, $text);
+ continue;
+ }
+ /// Everything is ok, let's process the expression
$md5 = md5($texexp);
if (! $texcache = get_record("cache_filters","filter","tex", "md5key", $md5)) {
$texcache->filter = 'tex';
moodle-1.9.4-CVE-2009-1171-2.patch:
--- NEW FILE moodle-1.9.4-CVE-2009-1171-2.patch ---
--- filter/tex/filter.php.orig
+++ filter/tex/filter.php
@@ -133,16 +133,6 @@ function tex_filter ($courseid, $text) {
$text = str_replace($matches[0][$i],$replacement,$text);
}
- // TeX blacklist. MDL-18552
- $tex_blacklist = array(
- 'include','def','command','loop','repeat','open','toks','output',
- 'input','catcode','name','^^',
- '\every','\errhelp','\errorstopmode','\scrollmode','\nonstopmode',
- '\batchmode','\read','\write','csname','\newhelp','\uppercase',
- '\lowercase','\relax','\aftergroup',
- '\afterassignment','\expandafter','\noexpand','\special'
- );
-
// <tex> TeX expression </tex>
// or <tex alt="My alternative text to be used instead of the TeX form"> TeX expression </tex>
// or $$ TeX expression $$
@@ -165,19 +155,6 @@ function tex_filter ($courseid, $text) {
$align = "text-top";
$texexp = preg_replace('/^align=top /','',$texexp);
}
- /// Check $texexp against blacklist (whitelisting could be more complete but also harder to maintain). MDL-18552
- $invalidcommands = array();
- foreach($tex_blacklist as $command) {
- if (stristr($texexp, $command)) { /// Found invalid command. Annotate.
- $invalidcommands[] = $command;
- }
- }
- if (!empty($invalidcommands)) { /// Invalid commands found. Output error and continue with next TeX element
- $invalidstr = get_string('invalidtexcommand', 'error', implode(', ', $invalidcommands));
- $text = str_replace( $matches[0][$i], $invalidstr, $text);
- continue;
- }
- /// Everything is ok, let's process the expression
$md5 = md5($texexp);
if (! $texcache = get_record("cache_filters","filter","tex", "md5key", $md5)) {
$texcache->filter = 'tex';
--- filter/tex/latex.php.orig
+++ filter/tex/latex.php
@@ -44,9 +44,11 @@
* @return string the latex document
*/
function construct_latex_document( $formula, $fontsize=12 ) {
- // $fontsize don't affects to formula's size. $density can change size
-
global $CFG;
+
+ $formula = tex_sanitize_formula($formula);
+
+ // $fontsize don't affects to formula's size. $density can change size
$doc = "\\documentclass[{$fontsize}pt]{article}\n";
$doc .= $CFG->filter_tex_latexpreamble;
$doc .= "\\pagestyle{empty}\n";
--- filter/tex/lib.php.orig
+++ filter/tex/lib.php
@@ -34,8 +34,22 @@ function tex_filter_get_executable($debug=false) {
error($error_message1);
}
+function tex_sanitize_formula($texexp) {
+ /// Check $texexp against blacklist (whitelisting could be more complete but also harder to maintain)
+ $tex_blacklist = array(
+ 'include','def','command','loop','repeat','open','toks','output',
+ 'input','catcode','name','^^',
+ '\every','\errhelp','\errorstopmode','\scrollmode','\nonstopmode',
+ '\batchmode','\read','\write','csname','\newhelp','\uppercase',
+ '\lowercase','\relax','\aftergroup',
+ '\afterassignment','\expandafter','\noexpand','\special'
+ );
+
+ return str_ireplace($tex_blacklist, 'forbiddenkeyword', $texexp);
+}
function tex_filter_get_cmd($pathname, $texexp) {
+ $texexp = tex_sanitize_formula($texexp);
$texexp = escapeshellarg($texexp);
$executable = tex_filter_get_executable(false);
--- lib/db/upgrade.php.orig
+++ lib/db/upgrade.php
@@ -3106,6 +3106,13 @@ function xmldb_main_upgrade($oldversion=0) {
upgrade_main_savepoint($result, 2007101542);
}
+ if ($result && $oldversion < 2007101545.01) {
+ require_once("$CFG->dirroot/filter/tex/lib.php");
+ filter_tex_updatedcallback(null);
+ /// Main savepoint reached
+ upgrade_main_savepoint($result, 2007101545.01);
+ }
+
return $result;
}
--- version.php.orig
+++ version.php
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2007101540; // YYYYMMDD = date of the 1.9 branch (don't change)
+ $version = 2007101545.01; // YYYYMMDD = date of the 1.9 branch (don't change)
// X = release number 1.9.[0,1,2,3,4,5...]
// Y.YY = micro-increments between releases
Index: moodle.spec
===================================================================
RCS file: /cvs/pkgs/rpms/moodle/F-9/moodle.spec,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- moodle.spec 27 Feb 2009 20:39:53 -0000 1.30
+++ moodle.spec 1 Apr 2009 19:55:35 -0000 1.31
@@ -1,3 +1,4 @@
+%define _default_patch_fuzz 2
%define moodlewebdir %{_var}/www/moodle/web
%define moodledatadir %{_var}/www/moodle/data
@@ -7,7 +8,7 @@
Name: moodle
Version: 1.9.4
-Release: 3%{?dist}
+Release: 6%{?dist}
Summary: A Course Management System
Group: Applications/Publishing
@@ -104,6 +105,8 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Patch0: moodle-1.9.3-rce-texed.patch
+Patch1: moodle-1.9.4-CVE-2009-1171-1.patch
+Patch2: moodle-1.9.4-CVE-2009-1171-2.patch
BuildRequires: unzip
Requires: php-gd vixie-cron mimetex perl(lib) php-mysql php-xmlrpc
@@ -112,7 +115,7 @@
Requires: php-Smarty
Requires: php-adodb
#Requires: php-magpierss
-Requires: freefont
+Requires: gnu-free-sans-fonts
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
@@ -744,7 +747,7 @@
Summary: Moodle language pack for Khmer
Group: Applications/Publishing
Requires: moodle = %{version}-%{release}
-Requires: khmeros-fonts-base
+Requires: khmeros-base-fonts
%description km
This package contains the files needed to display Moodle in Khmer.
@@ -1111,7 +1114,7 @@
Summary: Moodle language pack for Samoan
Group: Applications/Publishing
Requires: moodle = %{version}-%{release}
-Requires: dejavu-fonts
+Requires: dejavu-sans-fonts
%description sm
This package contains the files needed to display Moodle in Samoan.
@@ -1270,7 +1273,7 @@
Summary: Moodle language pack for Tonga
Group: Applications/Publishing
Requires: moodle = %{version}-%{release}
-Requires: dejavu-fonts
+Requires: dejavu-sans-fonts
%description to
This package contains the files needed to display Moodle in Tonga.
@@ -1478,6 +1481,8 @@
sed -i 's/\r//' mod/wiki/ewiki/README.de
%patch0 -p0
+%patch1 -p0
+%patch2 -p0
%build
rm config-dist.php install.php tags filter/tex/mimetex.* filter/tex/README.mimetex
@@ -1525,7 +1530,7 @@
#Symlink to FreeSans, to save space.
rm -f $RPM_BUILD_ROOT%{moodlewebdir}/lib/default.ttf
-ln -s /usr/share/fonts/freefont/FreeSans.ttf $RPM_BUILD_ROOT%{moodlewebdir}/lib/default.ttf
+ln -s /usr/share/fonts/gnu-free/FreeSans.ttf $RPM_BUILD_ROOT%{moodlewebdir}/lib/default.ttf
#symlink to khmeros-base-fonts
rm -f $RPM_BUILD_ROOT%{moodlewebdir}/lang/km_utf8/fonts/default.ttf
@@ -1689,7 +1694,13 @@
%{_sbindir}/%{name}-cron
%changelog
-* Thu Feb 26 2009 Jon Ciesla <limb at jcomserv.net> - 1.9.4-3
+* Wed Apr 01 2009 Jon Ciesla <limb at jcomserv.net> - 1.9.4-6
+- Patch for CVE-2009-1171, BZ 493109.
+
+* Tue Mar 24 2009 Jon Ciesla <limb at jcomserv.net> - 1.9.4-5
+- Update for freefont->gnu-free-fonts change.
+
+* Thu Feb 26 2009 Jon Ciesla <limb at jcomserv.net> - 1.9.4-4
- Fix for symlink dir replacement.
* Mon Feb 23 2009 Jon Ciesla <limb at jcomserv.net> - 1.9.4-2
More information about the scm-commits
mailing list