We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
Tags:
create new tag
, view all tags

Question

potential security risk with CommentPlugin: if you enter some text which the twiki `engine' typically expands, e.g., %INCLUDE{Main.WebHome}%, this text is effectively expanded, i.e., including the text of the other page...

this problem can easily be avoided, e.g., by rewriting every % into something like <nop>%<nop>.

I tested this out by including the following line in Comment.pm: if line 257 reads $output =~ s/%/<nop>%<nop>/go;, the include statement does not get expanded...

I believe this is a bug...

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: CommentPlugin,Plugins.DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Plugins

-- TWikiGuest - 27 Jan 2005

Answer

The comment plugin expands the same variables as are expanded on topic creation, and $INCLUDE isn't one of them. Is the version of commentplugin the one from the release?

-- CrawfordCurrie - 16 Feb 2005

yes it is the commentplugin version of the release... I describe the installation procedure on http://godot.be/installingTwiki (I use debian/ubuntu and redhat/fedora). If you enter in a box like this one something like %INCLUDE{WebIndex}%, this variable will be expanded due to the non-post-processing of the percent sign... This "issue" can easily be solved by adding a single line to twiki/lib/TWiki/Plugins/CommentPlugin:

.../twiki/lib/TWiki/Plugins/CommentPlugin$ diff -bruN Comment.pm~ Comment.pm
--- Comment.pm~ 2005-01-26 23:38:23.000000000 +0100
+++ Comment.pm  2005-01-27 01:29:28.000000000 +0100
@@ -254,6 +254,7 @@
     my @t = gmtime();
     my $now = sprintf( "%02d:%02d:%02d", $t[2], $t[1], $t[0] );
     $output =~ s/21:49:49/$now/go;
+    $output =~ s/%/<nop>%<nop>/go;
 
     my $bloody_hell = TWiki::Func::readTopicText( $web, $topic, undef, 1 );
     my $premeta = "";

cu & thanks for the very neat twiki features...

-- DannyDeCock - 25 Jun 2005

I just tested this at TestComment, it works as expected. I am wondering what makes INCLUDE expand in your environment.

-- PeterThoeny - 24 Dec 2006

 
Topic revision: r7 - 24 Dec 2006 - 05:47:12 - PeterThoeny
Support.CommentPluginExpandsVariables moved from Support.DannyDeCock on 27 Jan 2005 - 17:05 by PeterThoeny - put it back
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback