—+ Security Alert: Code injection vulnerability in MAKETEXT macro,
Denial of Service vulnerability in MAKETEXT macro.
This advisory alerts you of a potential security issue with your Foswiki
installation. A vulnerability has been reported against the core Perl
module CPAN:Locale::Maketext, which Foswiki uses to provide translations
when {UserInterfaceInternationalization} is enabled in the
configuration. Because of this vulnerability it may be possible for a
user to run arbitrary shell commands and code on the server through a
crafted %MAKETEXT% macro. If your wiki allows commenting by users
without first logging in, then it may be possible for such an anonymous
user to exploit this vulnerability.
—++ Severity Level
Severity 1 issue: The web server can be compromised
The severity level was assigned by the Foswiki
Community.SecurityTaskTeam as documented in Development.SecurityAlertProcess
—++ Vulnerable Software Versions
All released versions of Foswiki are vulnerable to these issues
—++ MITRE Name for this Vulnerability
The Common Vulnerabilities and Exposures project has assigned the name
CVE-2012-6329 to this vulnerability, see
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-6329
CVE-2012-6330 was assigned to the Denial of Service vulnerability, see
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2012-6330
—++ Attack Vectors
Editing wiki pages and HTTP POST requests towards a Foswiki server with
enabled localization (typically port 80/TCP). Typically, prior
authentication is necessary.
A crafted %MAKETEXT{}% macro will pass through strings to
Locale::Maketext where they are executed under the control of the CGI
user on the server. Any user with the authority to edit a topic,
comment on a topic, or execute the Foswiki rendering code (eg. The
RenderPlugin) can take advantage of the vulnerability. (CVE-2012-6329)
A crafted %MAKETEXT{}% macro will consume large amounts of memory and
exhaust swap space. (CVE-2012-6330)
—++ Impact
Arbitrary code execution on the server can expose the file system.
A second less severe Denial of Service vulnerability is also addressed
by this alert.
—++ Details
A crafted %MAKETEXT{}% macro can cause multiple issues:
—++ Countermeasures
One of the following should be done as soon as possible.
In addition, CPAN:Locale::Maketext version 1.23 or newer should be
installed.
Upgrade to the latest patched production Download.FoswikiRelease01x01x07
once released
The Foswiki patch fixes other issues with the %MAKETEXT% macro beyond
the code execution issue. Even if the new Locale::Maketext is installed,
it is strongly recommended to apply the Foswiki patch.
—++ Hotfix for Foswiki Release 1.1.0 - 1.1.6
Install http://foswiki.org/Extensions.PatchItem12285Contrib and verify
that the patch has been applied to lib/Foswiki/Macros/MAKETEXT.pm. The
extension will attempt to apply two patches, and should report that 1
file was patched. Only one of the patches will match your system. This
patch fixes both CVE-2012-6329 CVE-2012-6330.
> Running Post-install exit for PatchItem12285Contrib…
> Processing /var/www/data/Foswiki-1.1.1/working/configure/patch/Item12285-001.patch
> …
> MD5 Matched - applying patch version Foswiki 1.1.0 - 1.1.2.
> Update successful for /var/www/data/Foswiki-1.1.0/lib/Foswiki/Macros/MAKETEXT.pm
> .
> 1 file patched
> …
> Processing /var/www/data/Foswiki-1.1.1/working/configure/patch/Item12285-002.patch
> …
> No files matched patch signatures
On a properly patched system, %MAKETEXT{" [_101] "}% should return an
error.
> Excessive parameter number 101, MAKETEXT rejected.
Note that this Contrib will also install the
Extensions.PatchFoswikiContrib as a prerequisite. PatchFoswikiContrib
patches the Extensions installer to accept the new style version strings
used for modules released as of 1.1.6.
—++ Hotfix for Foswiki Archived Release 1.0.0-1.0.10
This patch fixes both [[SecurityAlert-CVE-2012-6329]] and
[[SecurityAlert-CVE-2012-6330]].
This release should be manually patched.
In Foswiki.pm, in the sub MAKETEXT
============ vvv CUT vvv =============
— Foswiki.pm 2010-01-17 09:16:20.000000000 -0500
+++ Foswiki.pm 2012-12-10 10:06:37.389129654 -0500
@@ -4200,6 +4200,9 @@
$str =~
s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ $max = $2 if ($2 > $max); "[$1]"/ge;
============ —CUT— =============
—++ Manual patch for Foswiki Release 1.1.0 -> 1.1.6
Installing the Extensions.PatchItem12285Contrib is the best way to patch
your system - you can however see the patch we apply here. This patch
fixes both [[SecurityAlert-CVE-2012-6329]] and
[[SecurityAlert-CVE-2012-6330]]:
============ vvv CUT vvv =============
— lib/Foswiki/Macros/MAKETEXT.pm 2012-12-11 10:51:12.959268829 -0500
+++ lib/Foswiki/Macros/MAKETEXT.pm 2012-12-11 10:37:31.674486503 -0500
@@ -4,9 +4,19 @@
use strict;
use warnings;
+use Locale::Maketext;
+my $escape =
&& $Locale::Maketext::VERSION
&& $Locale::Maketext::VERSION < 1.23 );
sub MAKETEXT {
my ( $this, $params ) = @_;
$_[4] = 1; # Set error flag
return
+"<span class=\"foswikiAlert\">Excessive parameter number $_[2],
MAKETEXT rejected.</span>";
$_[4] = 1; # Set error flag
return
+"<span class=\"foswikiAlert\">Invalid parameter <code>\"$_[0]\"</code>,
MAKETEXT rejected.</span>";
1;
END
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
============ ^^^ CUT ^^^ =============
—++ Action Plan with Timeline