Summary: | "Place in System Tray"option for application launching apparently doesn't work when argument contains characters that should be escaped | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Ned Boony <crazyned> |
Component: | general | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bugs+kde |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Ned Boony
2006-03-23 09:01:20 UTC
Seems to be a ksystraycmd bug. ~% cat test.sh #!/bin/sh for i; do echo "$i"; done ~% ./test.sh "The quick brown fox jumps over the lazy dog" The quick brown fox jumps over the lazy dog ~% ksystraycmd ./test.sh "The quick brown fox jumps over the lazy dog" The quick brown fox jumps over the lazy dog Looks like ksystraycmd, instead of executing the command, passes all the arguments on a command line to your shell, which inherently creates a security vulnerability. Let's say you downloaded a file named "Who let the dogs out&echo Gotcha&.mp3", if your media player is configured to execute through ksystraycmd, you get: ~% ksystraycmd amarok "Who let the dogs out&echo Gotcha&.mp3" Gotcha zsh: command not found: .mp3 ~% Note that "echo Gotcha" got executed. This should be considered a serious security bug. Anyone who checks the "Place in system tray" option is becoming vulnerable to a shell script insertion attack on filenames. SVN commit 572103 by mueller: fix argument getting de-quoted BUG:124116 M +2 -1 main.cpp --- branches/KDE/3.5/kdebase/ksystraycmd/main.cpp #572102:572103 @@ -5,6 +5,7 @@ #include <kcmdlineargs.h> #include <kdebug.h> #include <klocale.h> +#include <kprocess.h> #include "ksystraycmd.h" @@ -94,7 +95,7 @@ // Read the command QString command; for ( int i = 0; i < args->count(); i++ ) - command += QCString( args->arg(i) ) + " "; + command += KProcess::quote(QString::fromLocal8Bit( args->arg(i) )) + " "; if ( !command.isEmpty() ) cmd.setCommand( command ); SVN commit 572104 by mueller: fix argument quoting CCBUG: 124116 M +2 -1 main.cpp --- trunk/KDE/kdebase/workspace/ksystraycmd/main.cpp #572103:572104 @@ -5,6 +5,7 @@ #include <kcmdlineargs.h> #include <kdebug.h> #include <klocale.h> +#include <kprocess.h> #include "ksystraycmd.h" @@ -96,7 +97,7 @@ // Read the command QString command; for ( int i = 0; i < args->count(); i++ ) - command += QString( args->arg(i) ) + ' '; + command += KProcess::quote(QString::fromLocal8Bit( args->arg(i) )) + ' '; if ( !command.isEmpty() ) cmd.setCommand( command ); |