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

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2006-12-24 - 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.