create new tag
, view all tags
What is TWiki?
A leading open source enterprise wiki and web application platform used by 50,000 small businesses, many Fortune 500 companies, and millions of people.
MOVED TO... Learn more.

Security Alert CVE-2014-9325: XSS Vulnerability with QUERYSTRING and QUERYPARAMSTRING Variables

ALERT! Get Alerted: To get immediate alerts of high priority security issues, please join the low-volume twiki-announce list - details at TWikiAnnounceMailingList

This advisory alerts you of two potential security issues with your TWiki installation: The TWiki Variables QUERYSTRING and QUERYPARAMSTRING may expose a cross-site scripting vulnerability. (See also related SecurityAlert-CVE-2014-9367.)

Vulnerable Software Version

Attack Vectors

Attack can be done by viewing wiki pages or by logging in by issuing HTTP GET requests towards the TWiki server (usually port 80/TCP).


Specially crafted parameters open up XSS (Cross-Site Scripting) attacks.

Severity Level

The TWiki SecurityTeam triaged this issue as documented in TWikiSecurityAlertProcess and assigned the following severity level:

  • Severity 3 issue: TWiki content or browser is compromised.

MITRE Name for this Vulnerability

The Common Vulnerabilities and Exposures project has assigned the name CVE-2014-9325 to this vulnerability.


A malicious person can use specially crafted URL parameters to TWiki scripts that execute arbitrary JavaScript code in the browser. Examples:

Specially crafted parameter to the view script of TWiki:

GET /do/view/Main/TWikiPreferences?'"--></style></script><script>alert('CVE-2014-9325 vulnerable')</script>

TWiki decodes the URL parameters and pops up a JavaScript alert box showing "CVE-2014-9325 vulnerable!"


  • Apply hotfix (see patch below).
  • Use the web server software to restrict access to the web pages served by TWiki.

Hotfix for TWiki Production Release

No TWiki patch release will be done to address this issue. Instead, apply the patches to the two files below.

Patch lib/TWiki.pm

Affected file: twiki/lib/TWiki.pm

--- TWiki.pm   (revision 28488)
+++ TWiki.pm   (working copy)
@@ -4803,7 +4803,10 @@
     my $this = shift;
-    return $this->{request}->queryString();
+    my $qs = $this->{request}->queryString();
+    # Item7595: Sanitize QUERYSTRING
+    $qs =~ s/(['\/<>])/'%'.sprintf('%02x', ord($1))/ge;
+    return $qs;

Patch lib/TWiki/UI/View.pm

Affected file: twiki/lib/TWiki/UI/View.pm

--- TWiki/UI/View.pm   (revision 28488)
+++ TWiki/UI/View.pm   (working copy)
@@ -349,8 +349,14 @@
       next if ($name eq 'topic');
       push @qparams, $name => $query->param($name);
-    $tmpl =~ s/%QUERYPARAMSTRING%/TWiki::_make_params(1,@qparams)/geo;
+    if ( $tmpl =~ /%QUERYPARAMSTRING%/ ) {
+        my $qs = TWiki::_make_params( 1, @qparams );
+        # Item7595: Sanitize QUERYPARAMSTRING
+        $qs =~ s/(['\/<>])/'%'.sprintf('%02x', ord($1))/ge;
+        $tmpl =~ s/%QUERYPARAMSTRING%/$qs/go;
+    }
     # extract header and footer from the template, if there is a
     # %TEXT% tag marking the split point. The topic text is inserted
     # in place of the %TEXT% tag. The text before this tag is inserted


Verify Hotfix

To verify the patch add the following parameter to any TWiki topic:

?'"--></style></script><script>alert('CVE-2014-9325 vulnerable')</script>

The site is vulnerable if a dialog box is shown with text "CVE-2014-9325 vulnerable!"

Authors and Credits

Action Plan with Timeline

External Links

-- Peter Thoeny - 2014-12-18


Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2014-12-19 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.